LDOMS and virtual disks

Have you ever had an LDOM that failed to boot due to some erroneous configuration files in the root file system? Ever wish you could modify the root filesystem of that LDOM without having to boot the LDOM?

Well, you could take the virtual disk and re-assign it to another LDOM, and restarting the LDOM you just re-assigned it to, then access it from there.

For example:

ldm rm-vdisk bootdisk broken_ldom
ldm add-vdisk broken_bootdisk broken_ldom_bootdisk@primary-vds0 working_ldom
ldm stop working_ldom
ldm start working_ldom

Once working_ldom boots, you can run “devfsadm” to create the device links for the new disk. At which point you can mount it and fix whatever you want to fix.

But what if you didn’t have an LDOM that you could restart at this point? What if you didn’t have the resources to create a new temporary LDOM for this purpose?

There is another way but it has limitations. You will only be able to access the first partition on that virtual disk.

If the virtual disk is a zfs volume you can mount it directly as follows:
mount -o rw /dev/zvol/dsk/zpoolname/volname /mountpoint

If the virtual disk is a file, then you can use lofiadm to create a device for it:
lofiadm -a /path/to/vdisk/file
mount -o rw /dev/lofi/1 /mountpoint

I’ve only tested this on volumes that have UFS file systems on it. It may work with other file systems (even ZFS), I just haven’t tried it.

Now if anyone can figure out how to create device files for the other partitions within the volume (by mapping that device file to an offset within the file), then managing every slice in a virtual disk file or volume would be possible and greatly simplified.

Leave a Reply