Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If you use dd to dump one hard drive to another, is the new hard drive a perfect clone of the old one? In what ways? What are the "gotchas" of cloning a hard drive with dd? Is a "dd-clone" truly a clone?
I have a Windows box that acts as a serial monitor/relay for some industrial equipment. The box was set up by an outside vendor and I don't have confidence in their ability to always be available for support. I was thinking it would be a good idea to clone the hard drive so that if anything happens I can always slap in the cloned hard drive and restore the box to a known working state. I was going to do this by using two SATA-USB adapters and my Linux laptop, and just dd the current 1TB drive to a new 1TB drive. If I do this, will Windows boot the clone drive? Will it even know anything happened? What if the new hard drive is a different model, or brand, or has a different amount of cache? I need to be confident the new hard drive will work, or there's no point to the exercise. I would like to actually clone the hard drive and then put the CLONED drive back in the computer when I'm done; then I know that the cloning is working as planned. But I don't want to mess anything up, and I know next to zero about Windows.
dd is used to create an image of just about anything. It is commonly used to clone partitions. Note that as far as I know you can't clone a whole drive at a time, only partitions. So you can create identical partitions on the second hard drive, and then dd the partitions to the new hard drive. For instance:
Code:
dd if=/dev/sda2 of=/dev/sdb2
That would essentially copy the data on /dev/sda2 and place it on /dev/sdb2. If you did this:
Code:
dd if=/dev/sda of=/dev/sdb
if I am not mistaken, it would just copy the MBR over to the other drive.
Oh. I thought if you did dd if=/dev/sda of=/dev/sdb, then it would make a bit-for-bit copy of the whole drive, including partitions, file system, MBR, everything.
If I had to prepare the destination drive by partitioning it, I'm not sure how to do that. I'm not sure how to make identical partitions on the destination drive, or what that even means...identical sizes? Identical starting points? Would they need a filesystem too? What about the disklabel?
Isn't there a way to just duplicate the hard drive, bit-for-bit?
very good thread for dd command. You learn lot about dd command.
Quote:
This post contains comprehensive documentation with examples for one of the most useful Linux/UNIX/Windows commands: dd. Dd is a bit-stream duplicator. If you have questions, post them. The latest addition, How to rescue data from a CD or DVD, or flash drive or memory card was on 07-23-2010:
Oh. I thought if you did dd if=/dev/sda of=/dev/sdb, then it would make a bit-for-bit copy of the whole drive, including partitions, file system, MBR, everything.
If I had to prepare the destination drive by partitioning it, I'm not sure how to do that. I'm not sure how to make identical partitions on the destination drive, or what that even means...identical sizes? Identical starting points? Would they need a filesystem too? What about the disklabel?
Isn't there a way to just duplicate the hard drive, bit-for-bit?
I think I am wrong after reading the info on the page that sem007 posted, but you may want to double check. If you were going to do it partition-by-partition, I believe the partition sizes would be the only thing that would need to be the same. The starting point would not matter, because you are simply cloning a partition, not a drive.
Now that I think about it, using USB-to-serial adapters, which are maybe 30MB/s, this is going to take 9.7 hours! That's longer than my working shift. I'd be better off using Sata, which at 3Gb/s, would be 45 min. Although I imagine the real speed will be much less than 3Gb/s which is the max drive speed.
Now that I think about it, using USB-to-serial adapters, which are maybe 30MB/s, this is going to take 9.7 hours! That's longer than my working shift. I'd be better off using Sata, which at 3Gb/s, would be 45 min. Although I imagine the real speed will be much less than 3Gb/s which is the max drive speed.
If these are not SSDs then yes it will take a whole lot longer. A better estimate is either to run 'hdparm -t /dev/sda' or just watch the transfer rate using a monitoring program. For my HDD it is about 73.75 MB/sec, but in reality it usually gets maybe 50-60 MB/sec in bursts, and it averages to more like 40-50 MB/sec. dd will also post the average transfer rate, so you can try transferring some files.
Last edited by H_TeXMeX_H; 09-08-2010 at 01:41 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.