Prerequisites
In order to add vdisk online to a guest LDOM, the SMF service svc:/platform/sun4v/drd must be online in Guest LDOM :
ldom01 # svcs drd STATE STIME FMRI online Feb_12 svc:/platform/sun4v/drd:default
1. Adding ZFS volume
primary # zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT ldom 86.5G 14.6G 71.9G 16% 1.00x ONLINE - rpool 136G 20.5G 115G 15% 1.00x ONLINE - primary # zfs create -V 5G ldom/disk2 primary # ldm add-vdsdev /dev/zvol/dsk/ldom/disk2 disk2@primary-vds0 primary # ldm add-vdisk disk2 disk2@primary-vds0 ldom01
2. Adding a disk
primary # ldm add-vdsdev /dev/dsk/c1t0d0s2 disk2G@primary-vds0 primary # ldm add-vdisk disk2 disk2@primary-vds0 ldom01
3. Adding a file as vdisk
primary # mkfile 5g /ldom/disk2 primary # ldm add-vdsdev /ldom/disk2 disk2@primary-vds0 primary # ldm add-vdisk disk2 disk2@primary-vds0 ldom01
Saving the changes permanently
Make sure you save the configuration changes permanently to the SP-config :
primary# ldm add-spconfig config-feb122014 primary# ldm ls-spconfig factory-default config-feb122014 [current]
Verify
Make sure that the vdisk addition is successful in the guest LDOM :
ldom01 # devfsadm -Cv ldom01 # echo | format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 [SUN-DiskImage-20GB cyl 566 alt 2 hd 96 sec 768] /virtual-devices@100/channel-devices@200/disk@0 1. c0d1 [SUN-DiskImage-5GB cyl 17474 alt 2 hd 1 sec 600] /virtual-devices@100/channel-devices@200/disk@1 Specify disk (enter its number):
We can also verify the addition of vdisks from the control domain :
primary# ldm list -o disk ldom01 NAME ldom01 DISK NAME VOLUME TOUT ID DEVICE SERVER MPGROUP vdisk1 vol1@primary-vds0 0 disk@0 primary disk2 disk2@primary-vds0 1 disk@1 primary
Removing vdisk from Guest LDOM
Make sure that the vdisk is not being used in the guest LDOM.
primary # ldm rm-vdisk disk2 ldom01