Next let's try bigger than 512 divider, we have 41943040 physical sectors:Ĥ1943040 / 256 = 163840, very good, we can do bulk copy of 256 sectors. I/O size (minimum/optimal): 512 bytes / 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes historical geometry and total sector number, very important infoģ. you must calculate source, for example:Įxcept partition geometry (there can be GPT), you will fetch:Ģ. Next, destination should be the same or bigger than source. alternatively identifying can be based on device size, if it is different. please look at the dmesg, here is stored all needed info about device, with vendor etc. You must identify source and destination device. If you want clone entire hard drive, you must umount or remount all partitions. If you'll clone only one partition, this partition should be unmounted or remounted into RO: umount /mountpoint_or_device If it is possible, you can boot or change system level into 1, for single user mode, or you can directly reboot system into single user mode, it is distro depended. I prever knoppix, but this is your choose. If remounting is impossible, please make bootable drive (hdd/ssd/pendrive) any linux live distro. 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. 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
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |