Creating a base LDOM image
Now that the Control domain is setup, you can start creating LDOM's at will. The idea here is to create a base LDOM image that can be cloned to quickly provision new servers.
1. Create a ZFS file system to store the disk image for our LDOM
zfs create storage/base
This will create a ZFS file system called storage/base that will be mounted at /storage/base
2. Create a ZFS disk image to hold the LDOM's data
zfs create -V 36gb storage/base/disk0
This will create a 36Gb disk image. You can see the results in the zfs list output:
# zfs list NAME USED AVAIL REFER MOUNTPOINT rpool 25.4G 109G 93K /rpool rpool/ROOT 5.36G 109G 18K legacy rpool/ROOT/s10s_u7wos_08 5.36G 109G 5.36G / rpool/dump 10.0G 109G 10.0G - rpool/swap 10G 118G 16.4M - storage 37.1G 630G 36.5K /storage storage/base 37.1G 630G 34.9K /storage/base storage/base/disk0 37.1G 667G 26.6K -
3. Create the new LDOM
ldm add-domain base
4. Assign virtual CPU's to the new LDOM
ldm add-vcpu 8 base
5. Assign memory to the new LDOM
ldm add-memory 2G base
6. Create a virtual disk device and assign it to the new LDOM
ldm add-vdsdev /dev/zvol/dsk/storage/base/disk0 base-vol1@primary-vds0 ldm add-vdisk vdisk1 base-vol1@primary-vds0 base
This creates a virtual disk device called base-vol1@primary-vds0 that is then assigned to the LDOM base. ldm list-services should now look like this:
VCC NAME LDOM PORT-RANGE primary-vcc0 primary 5000-5100 VSW NAME LDOM MAC NET-DEV ID DEVICE LINKPROP DEFAULT-VLAN-ID PVID VID MTU MODE primary-vsw0 primary 00:14:4f:fa:40:c8 e1000g0 0 switch@0 1 1 1500 VDS NAME LDOM VOLUME OPTIONS MPGROUP DEVICE primary-vds0 primary base-vol1 /dev/zvol/dsk/storage/base/disk0
7. Add a virtual network interface to the new LDOM
ldm add-vnet vnet1 primary-vsw0 base