Will dd command make an exact copy (clone) of a disc
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Will dd command make an exact copy (clone) of a disc
Hi--I am still finding my way round Knoppix Linux so I have this question to ask as a newbie to Linux
I have a PVR which has an HDD in it. I want to make an exact copy of it to put it into another machine. This HDD has two Linux partitions (ext2). One contains the machine software and the other the data files. The machine boots from the first partition when powered on.
My question is, if I use the dd command e.g dd if=/dev/hda of=/dev/hdb where hda is the old disc and hdb the new one to be made, will this copy ALL the disc including the boot information and the partition details. The two discs are identical models. In other words is it a bootable exact copy.
If not any suggestions for the best way to proceed.
For dd, you have it exactly right. The only refinement might be to play with the block size to make it go a bit faster. I've never run tests, but I think that the block size that fits comfortably into available RAM is the fastest.
Do a couple of trial runs with something like these:
dd if=/dev/hda of=/dev/hdb bs=10M count=10
dd if=/dev/hda of=/dev/hdb bs=100M count=1
This will tell you which is fastest, and how long the total copy is going to take. (Hint: You may want to start it before going to bed.)
Finally, be REALLY SURE which drive is hda and which is hdb....
If I were you, I'd run the dd command from a live cd, it's not always a good idea to clone a system while it is running. And as pixellany said, be really really really sure which is /dev/sda and which is /dev/sdb or you will find that you have wiped your installation
I would say never even think about running dd on an active partition.
So could I, but I was being polite
No harm done though, as long as he doesn't get his disks muddled up, which is our primary concern.
If he does the dd on a running system, the cloned disk may not function as expected (the presence of lock-files and all that...) In which case I expect he'll be back, and read the solution here.
In your defence, knoppix is widely regarded as a brilliant liveCD for getting one out of the "Oops, I hadn't thought of that. Now how can I get back in there and .. [tweak my fstab or reinstall grub] so I can get my linux to boot?". We probably all have an old knoppix CD buried somewhere, that we dig out and boot live in case of another careless, drastic misconfiguration. So we (well, I) tend to think of it as a LiveCD, not an installation. That may yet be his situation, perhaps we'll discover.
So pixellany, I think you should take the hairshirt off right now
Just one thought. The disk that I will be copying TO is formatted with a single NTFS partion. Will DD command copy the ext2 file system over from the old HDD or should I reformat in Linux with a ext2 file system BEFORE I do the copy.
Regards to all
dd will copy to and from a file, but--for what you are doing--it reads and writes the raw data (which includes the filesystem, partition tables, etc. It does not matter what is on the target drive--it will wind up being exactly like the source.
Thanks to all. I will try it all out this weekend as Imagine that it will not be quick.
Ref AUS9 's remark re disc full message. No, the disc is fine in the PVR, just that it is a Panasonic PVR. I Have several of these but the most recently aquired one has the very original software on it which was full of problems. My other ones all have the latest software version and It is that I want to clone. Panasonic will not send out any more "over the air updates" nor will they offer any suppport directly so I am left with a cloning as the only way out short of legal action.
Thanks again and if it all works out I will post again.