Low Orbit Flux Logo 2 D

Disk Imaging

Take image of each disk:

sudo time dd if=/dev/sdb conv=sync,noerror bs=128K  >  OS_disk_image
sudo time dd if=/dev/sdc conv=sync,noerror bs=128K  >  DATA_disk_image

To mount a single partition from an image of an entire disk you will need to know the offset of that partition. You can find the offset of the partitions in an image with the fdisk command like this:

user1@zippy-zap:/mnt$ fdisk -lu DATA_disk_image
Disk DATA_disk_image: 931.53 GiB, 1000204926976 bytes, 1953525248 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbfcce30b

Device           Boot Start        End    Sectors   Size Id Type
DATA_disk_image1       2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT

In the above output we can see that the partition starts at 2048. We multiply this by the block size of 512 like this to get the actual offset that we will need:

The offset will be 1048576 which we can now pass to the mount command.

Mount partitions based on offsets:

sudo mount -o loop,offset=32256 OS_disk_image /mnt3

The other disk:

sudo mount -o loop,offset=2048 DATA_disk_image /mnt3
sudo mount -o loop,offset=1048576 DATA_disk_image /mnt3

Boot VM with disk image:

virt-install --name desk1 --ram=8192 --disk /mnt/xxxx  --os-type=windows --os-variant=win7 --import

Write image to physical disk:

sudo dd if=OS_disk_image of=/dev/sdb bs=1m
sudo dd if=DATA_disk_image of=/dev/sdc bs=1m