LDOM - Creating file/zfs based virtual disk Print E-mail
(2 votes, average: 4.50 out of 5)
Written by geekyS   
Monday, 29 December 2008 11:47


In LDOM, you can export a disk image file directly using the virtual disk service.The file is exported as a raw disk by the virtual disk server and can be used as an installation or data disk in the guest domain. The following steps explains the procedure for doing the same,

 

1)Create a disk image file as per your required virtual disk size in the primary domain.

primary# mkdir /ldoms
primary# /usr/sbin/mkfile   2g   /ldoms/file.img

2) Create a virtual disk service and virtual disk.

primary# ldm    add-vdiskserverdevice    /ldoms/file.img vdisk@primary-vds0
primary# ldm   add-vdisk    vdisk     vdisk@primary-vds0    testdom1

3) Guest domain should be rebooted so that changes will be reflected in the configuration

guest-testdom1# shutdown -i6 -g0 -y

guest-testdom1# ls /dev/dsk
c0d0s0        c0d0s1        c0d0s2         c0d0s3         c0d0s4         c0d0s5         c0d0s6         c0d0s7 

4) You need to run devfsadm to create the special devices(block and raw) for the new virtual disk

guest-testdom1# devfsadm -v

guest-testdom1# ls /dev/dsk
c0d0s0        c0d0s1        c0d0s2         c0d0s3         c0d0s4         c0d0s5         c0d0s6         c0d0s7 
c0d1s0        c0d1s1        c0d1s2         c0d1s3         c0d1s4         c0d1s5         c0d1s6         c0d1s7 

You can now create a new file system on the device and use it as a regular disk device. It can be used as the OS installation virtual disk. The same procedure can be used to export ZFS volume as virtual disk. You have to mention the zfs volume path in place of file image path as follows,

primary# ldm    add-vdiskserverdevice     /dev/zvol/rdsk/testpool/vol1    vdisk@primary-vds0
primary# ldm    add-vdisk    vdisk     vdisk@primary-vds0    testdom1

Last Updated on Monday, 29 December 2008 12:00