I have a hard disk(A) containing two partitions - A1 is a NTFS partition containing a windows OS, and A2 is an NTFS partition containing data. I want to copy both of these partitions onto a different, smaller hard disk(B) and have B be bootable (so copying the MBR would be helpful).
I've resized A1 so that the sum of A1 and A2 is less than the total size of B, but I can't use dd to copy the drive since the source drive is still larger and there's a gap in the partition table between A1 and A2. I've tried clonezilla, but it seems to have the same problem.
Is there a way for me to copy these partitions to B without having to go out and buy Ghost?
I would do it with ntfsclone.
Here are the steps, but please keep in mind that they are dangerous and use them on your own risk!
backup the initial partition table with sfdisk:
sfdisk -d /dev/sda > backup_of_sda
copy MBR and the partition table to disk B
dd if=/dev/sda of=/dev/sdb bs=512 count=63
blockdev --rereadpt /dev/sdb
- to refresh the partition table on sdbntfsclone partitions from sda to sdb something like:
ntfsclone --overwrite /dev/sdb2 /dev/sda2
repeat the same for the second partition.clone with dd windows rescue partitions as they are vfat32
using
cfdisk /dev/sdb
set the partition type to 07 - otherwise windows may not recognize NTFS volumes ..you may need to run
dd if=/dev/sda of=/dev/sdb bs=512 count=1
to transfer MBR one more time.Shrinking the filesystems and partitions on disk A to make them small enough to fit on disk B was the correct first step. If you really need to be able to copy the MBR, then you have to move A2 so that it starts immediately after A1. I think gparted can do this.