Novell is now a part of Micro Focus

How to Mount a Specific Partition of a Xen File-backed Virtual Disk

Novell Cool Solutions: Tip
By Tom Sandholm

Digg This - Slashdot This

Posted: 25 Aug 2007


How to mount a specific partition of a XEN file-backed virtual disk from the host OS.


  1. Locate the virtual-disk file and list it's content using fdisk. For example:
  2. beast2:/extra/xen/images/vm2 # fdisk -luC 530 ./hda
    Disk ./hda: 0 MB, 0 bytes
    255 heads, 63 sectors/track, 530 cylinders, total 0 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Device Boot      Start         End      Blocks   Id  System
    ./hda1              63     1060289      530113+  82  Linux swap / Solaris
    ./hda2   *     1060290    11550734     5245222+  83  Linux
    ./hda3        11550735    16771859     2610562+  83  Linux
    Partition 3 has different physical/logical endings:
         phys=(1023, 254, 63) logical=(1043, 254, 63)
    beast2:/extra/xen/images/vm2 #

  3. Identify the particular partition you wish to mount. In this example I wish to mount ./hda1, which is my root partition. You will need to multiply the starting cylinder number times 512 to obtain the mount offset. For example, the hda1 partition is at cylinder address 1060290, so I will multiple 1060290 * 512, which yields, 542868480.

  4. Use the mount command with loopback and offset options to mount the virtual-disk partition, for example:
  5. beast2:/extra/xen/images/vm2 # mount -o loop,offset=542868480 ./hda ./mnt
    beast2:/extra/xen/images/vm2 # ls ./mnt
    bin   dev  home  lost+found  mnt   mnt2  proc    root  srv      sys  usr
    boot  etc  lib   media       mnt1  opt   remote  sbin  success  tmp  var
    beast2:/extra/xen/images/vm2 #

Now you can see the content of my ./hda1 partition.


Using XEN on openSuSE 10.2, on an EMachines AMD +3000, with 2GB ram.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates