Under linux you can clone hard drive or partition by dd command.Īttention, when you'll make a mistake, you will lost all your data.Īt first, destination should not be in use, secondly source should be not used, or remounted into read only mode. The most info was described in previous inserted recipies, but not all was described. For example: dd if=/dev/hdb of=hdb.img bs=1024 I know of no way to overcome the third drawback.Īdditionally, you can speed up the copy time by telling dd to work with larger chunks of data. For example: dd if=/dev/hdb | (pv -s `fdisk -l /dev/hdb | grep -o '*\'`m) | cat > hdb.img The second drawback can be resolved by using the pipeview ( pv) tool. The first drawback can be resolved by gzipping the data as you make the copy. Once complete, hdb.img will be a byte-for-byte clone of the entire disk. Of course, make sure that you have proper permissions to read directly from /dev/hdb (I'd recommend running as root), and that /dev/hdb isn't mounted (you don't want to copy while the disk is being changed). To clone a disk, all you really need to do is specify the input and output to dd: dd if=/dev/hdb of=hdb.img I've never actually used the program, but it's worth considering, especially if the disk you're copying from is old, which can have bad sectors even if the system appears fine.
I spent some time researching solutions to this problem (after I had completed the task) and I found a program called ddrescue, which, according to the site, operates like dd but continues reading even if it encounters an error. At the time I couldn't find a way to tell dd to continue despite encountering a read error (though it appears as though it does have that setting), so I spent quite a bit of time manually specifying skip and seek to hop over the unreadable sections. It was then learned that dd doesn't handle read errors very well - there were several sectors on the disk that dd couldn't read, causing dd to give up and stop the copy. However, a while ago I had a hard drive that was about to die, so I used dd to try and copy what information I could off it before it died completely.
ECHO 3 SYSTEM CLONING SOFTWARE FREE
You can also do a direct disk-to-disk copy: dd if=/dev/hdb of=/dev/hdcīut you're still subject to the above limitations regarding free space.Īs far as issues or gotchas go, dd, for the most part, does an excellent job. Third, if you copy this image to other drives (again, using dd), they must be as large or larger than the original disk, yet you won't be able to use any additional space you may have on the target disk until you resize your partitions. Second, dd provides absolutely no progress indications, which can be frustrating because the copy takes a long time. First, dd will copy your entire disk, even empty space, and if done on a large disk can result in an extremely large image file.
There are a few drawbacks to using dd to clone disks. Once complete, image.img will be a byte-for-byte clone of the entire disk. Of course, make sure that you have proper permissions to read directly from /dev/hdb (I'd recommend running as root), and that /dev/hdb isn't mounted (you don't want to copy while the disk is being changed - mounting as read-only is also acceptable). To clone a disk, all you really need to do is specify the input and output to dd: dd if=/dev/hdb of=/image.img