I have done half an hour reading around to prepare to clone my hard drive. It has multiple partitions, including a Windows partition. I am going to buy a very large external hard drive for the backup. I would like to be able to use this clone to restore the whole drive in case something goes wrong (I'm about to do some OS re-shuffling). I want do learn how to do this using dd, as I like low-level tools that don't require installing anything.
I found the following useful code from the ubuntu forums (entered from a root shell using a live CD):
dd if=/dev/hda of=/dev/hdb & pid=$!
while kill -USR1 $pid; do sleep 1; done
(I know that I will have to edit the input and output locations.) However I have two questions. The first one is very noobie: this command is split across two lines. Surely when I press enter after the exclamation mark it will start the process?
Two, on other sites it recommended entering block size. Like this:
# dd if=/dev/hda conv=sync,noerror bs=64K of=/mnt/sda1/hda.img
I don't know anything about block sizes. Is 64K right? It looks like my block size is 512 bytes from the following, the output of sudo fdisk -ul:
Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xc3ffc3ff
Device Boot Start End Blocks Id System
/dev/sda1 * 63 143364059 71681998+ 7 HPFS/NTFS/exFAT
Partition 1 does not start on physical sector boundary.
/dev/sda2 976867328 1465147391 244140032 7 HPFS/NTFS/exFAT
/dev/sda3 143364094 976867327 416751617 5 Extended
Partition 3 does not start on physical sector boundary.
/dev/sda5 143364096 162895871 9765888 82 Linux swap / Solaris
/dev/sda6 162897920 205864959 21483520 83 Linux
/dev/sda7 205867008 976867327 385500160 83 Linux
Partition table entries are not in disk order
Disk /dev/mapper/cryptswap1: 10.0 GB, 10000269312 bytes
255 heads, 63 sectors/track, 1215 cylinders, total 19531776 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x433bb3a7
Disk /dev/mapper/cryptswap1 doesn't contain a valid partition table
Thank you.