On 16 May 2011 07:31, Adam Carter <adamcart...@gmail.com> wrote: > >> > To check my understanding - would it be correct to say that; >> > 1. Using dd to copy the first 512 bytes (MBR) is ALL that is needed to >> > setup the partitions - that is i wont need to run fdisk etc afterward. >> >> This is correct if you only have primary partitions. It will not copy the >> extended partition and any logical partitions in it. They reside in the >> first >> sector of the extended partition, which is not a boot sector, but contains >> the >> logical partition table. (I found this out the hard way!) >> >> Have a look at this to see how you can back up the extended partition >> tables >> with sfdisk (there's more than one of these, if you have more than one >> logical >> partition) : >> >> http://www.partimage.org/Partimage-manual_Backup-partition-table >> >> >> > 2. Using dd in this way of course will not update the kernel's knowledge >> > of >> > the partition table so a partprobe is necessary >> >> Yes, or a reboot. >> >> >> > 3. When using fdisk to write a partition table and exit, it calls a >> > re-read >> > of the partition table by the kernel so any changes should be ready >> > straight away. (there's a message about calling ioctl when it exits - so >> > i >> > guess that is the update) >> >> They are ready (i.e. written) but not yet read by the OS. Tools like >> gparted >> (part)probe the device to re-read the partition table after saving changes >> to >> disk. > > Thanks Mick. Great info, esp about the extended partitions. Fortunately, I > dont have any on this disk but good to know.
OK, this is what I would do: dd over the MBR (bs=512 count=1). This will bring over the bootloader code and the primary partition table. Any primary partitions you had will be copied over, same number and same size. Then reboot. This will read the new primary partition table. Then run your dd command on the respective partition. It should not error out on the first bs, but I suggest that you also add conv=notrunc. and perhaps conv=notrunc,noerror. The notrunc is necessary to copy all sectors, otherwise dd will stop as soon as it reaches unused sectors and truncate the test of the copy. The noerror will make it carry on even if there are read errors. In this way what you get on the new disk should be identical bit by bit with what's on the old disk including empty space. Then you can use gparted and resize partitions, add new ones, etc. BTW do not resize ntfs partitions unless you have booted into them defragged them first. Let us know how it goes. -- Regards, Mick