Saturday, September 06, 2008

No "Raw Device Mapping" for Xen

One invaluable feature of the Vmware ESX architecture, is the Raw Device Mapping (RDM). This allows a virtual machine to access a partitions and format it using the "native file system of the guest operating system." (In other words, a Windows VM would format it as NTFS. A Linux VM would format it as EXT3.) The advantage to this is that a physical machine could easily access the same data, should the VM crash or become corrupted.

Unfortunately, this doesn't seem to work as I had hoped under Xen. I carved a partition out of Dom0's hard drive and mapped it to the VM:
# virsh attach-disk valkyrie /dev/hda7 xvdb
This failed, until I formatted the partition. That makes sense.

Once the partition attached, the DomU could see the partition as a separate drive, but not as file system. It was necessary to fdisk /dev/xvdb, then mke2fs -j /dev/xvdb1. So far, so good. The tricky part came when I tried to access partition from Dom0:
]# virsh detach-disk valkyrie xvdb
# mount /dev/hda7 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/hda7,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Now, it doesn't recognize that the partition is formatted. What a bummer. This seems to imply that the avoid data loss due to a corrupted image file, we need to place the data on Dom0, then cluster to the local VMs through the local bridge, virbr0.

No comments:

Post a Comment