Creating a base LDOM image

From Peter Pap's Technowiki
Revision as of 04:27, 1 June 2011 by Ppapa (talk | contribs)

Jump to: navigation, search

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:

 # ldm list-services
 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  
     prod-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

8. Adjust boot parameters of the LDOM so that it will automatically boot when the host system starts up and it knows that the vdisk1 device is it's boot device:

 # ldm set-var auto-boot\?=true  base
 # ldm set-var boot-device=vdisk1 base svcadm enable vntsd

You can also change other boot parameters as you see fit

 # ldm set-var boot-file="-v -mverbose" base

9. Bind the new LDOM

 ldm bind base

10.