Transferring the disk image to a SAN target

  • Shut down the operating system that you want to transfer to the SAN target.
  • Unplug the disk containing the operating system image, and attach it to the SAN target machine.
  • Take a look at the disk's partition table; on Linux this can be achieved by running fdisk -l (lower-case 'L') on the SAN target machine:
  fdisk -l /dev/sdX

where /dev/sdX is the disk that you just plugged in, containing the operating system image to be transferred. You should see something like:

  Disk /dev/sdX: 80.0 GB, 80026361856 bytes
  255 heads, 63 sectors/track, 9729 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
  
     Device Boot      Start         End      Blocks   Id  System
  /dev/sdX1   *           1        1825    14659281    7  HPFS/NTFS

In this example, the disk (/dev/sdX) contains a single partition (/dev/sdX1) which contains the operating system image that we want to extract. We need to extract enough of the disk to fully contain this partition. (We could just extract the whole disk, but this would be wasteful; the disk is 80GB but the partition we need is only 15GB).

The key numbers that we need to get from the fdisk output are the number of bytes per cylinder (8225280 in the above example) and the ending cylinder number of the partition that we are interested in (1825 in the above example). Once we have identified these numbers, we can construct the command to extract the relevant portion of the disk

  dd if=/dev/sdX of=/path/to/image/file.img bs=8225280 count=1825

A disk

where the numbers 8225280 and 1825 should be replaced with the numbers extracted from your own fdisk output.

This command will extract the relevant portion of the disk to a file (/path/to/image/file.img) on your SAN target. Note that dd is reading from /dev/sdX (i.e. the raw disk device) rather than /dev/sdX1 (the partition device); we cannot extract the partition alone because we also need the Master Boot Record located at the start of the disk.

Verifying the transferred image

Check that your extracted file is a valid hard disk image, by running fdisk -l on the extracted file:

  fdisk -l /path/to/image/file.img

You should see something like:

  Disk /path/to/image/file.img: 0 MB, 0 bytes
  255 heads, 63 sectors/track, 0 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
  
                    Device Boot  Start     End    Blocks  Id  System
  /path/to/image/file.img1   *       1    1825  14659281   7  HPFS/NTFS

Now that the disk image is available on the SAN target machine, you need to make the disk image available via the appropriate SAN protocol: