Difference between revisions of "Creating a base LDOM image"
| (9 intermediate revisions by the same user not shown) | |||
| Line 64: | Line 64: | ||
# ldm set-var auto-boot\?=true base | # ldm set-var auto-boot\?=true base | ||
| − | # ldm set-var boot-device=vdisk1 base | + | # ldm set-var boot-device=vdisk1 base |
You can also change other boot parameters as you see fit | You can also change other boot parameters as you see fit | ||
| Line 91: | Line 91: | ||
CONTROL | CONTROL | ||
failure-policy=ignore | failure-policy=ignore | ||
| − | + | ||
DEPENDENCY | DEPENDENCY | ||
master= | master= | ||
| Line 100: | Line 100: | ||
VCPU | VCPU | ||
| − | VID PID CID UTIL | + | VID PID CID UTIL STRANDK99mksysidcfg |
0 8 1 100% | 0 8 1 100% | ||
1 9 1 100% | 1 9 1 100% | ||
| Line 163: | Line 163: | ||
nfs4_domain=dynamic | nfs4_domain=dynamic | ||
| − | 14. | + | 14. Create the script '''/etc/rc0.d/K99mksysidcfg''' with the following contents |
| + | |||
| + | #!/bin/sh | ||
| + | |||
| + | /usr/bin/cp -p /etc/sysidcfg.bk /etc/sysidcfg | ||
| + | |||
| + | /usr/bin/rm /etc/rc0.d/K99mksysidcfg | ||
| + | |||
| + | Make sure it is executable | ||
| + | |||
| + | chmod 744 K99mksysidcfg | ||
| + | |||
| + | 15. Create the script [http://www.peterpap.net/index.php/S99ldomreconfig /etc/rc3.d/S99ldomreconfig] to add host file entries and sendmail configs. Make sure it is executable | ||
| + | |||
| + | chmod 744 S99ldomreconfig | ||
| + | |||
| + | 16. We now unconfigure the LDOM to remove it's identity. This will remove it's hostname, IP, host file entries. Hence the reason for steps 13 and 14! To do this: | ||
| + | |||
| + | # sys-unconfig | ||
| + | WARNING | ||
| + | |||
| + | This program will unconfigure your system. It will cause it | ||
| + | to revert to a "blank" system - it will not have a name or know | ||
| + | about other systems or networks. | ||
| + | |||
| + | This program will also halt the system. | ||
| + | |||
| + | Do you want to continue (y/n) ? '''y''' | ||
| + | |||
| + | The LDOM will now shutdown and will have no identity! | ||
| + | |||
| + | 17. Exit out of the telnet console, and unbind the LDOM | ||
| + | |||
| + | ldm stop-domain base | ||
| + | ldm unbind base | ||
| + | |||
| + | The LDOM is now ready to clone!!! | ||
Latest revision as of 04:53, 2 June 2011
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
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
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
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. Check the parameters associated with your LDOM
# ldm list-bindings base
NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME
base bound ------ 5000 8 2G
UUID
16277b70-4c8c-c240-da5b-f73075ba2a89
MAC
00:14:4f:f9:33:a5
HOSTID
0x84f933a5
CONTROL
failure-policy=ignore
DEPENDENCY
master=
CORE
CID CPUSET
1 (8, 9, 10, 11, 12, 13, 14, 15)
VCPU
VID PID CID UTIL STRANDK99mksysidcfg
0 8 1 100%
1 9 1 100%
2 10 1 100%
3 11 1 100%
4 12 1 100%
5 13 1 100%
6 14 1 100%
7 15 1 100%
MEMORY
RA PA SIZE
0x8000000 0x88000000 2G
VARIABLES
auto-boot?=true
boot-device=vdisk1
boot-file=-v -mverbose
NETWORK
NAME SERVICE ID DEVICE MAC MODE PVID VID MTU LINKPROP
vnet1 prod-vsw0@primary 0 network@0 00:14:4f:f8:78:9c 1 1500
PEER MAC MODE PVID VID MTU LINKPROP
prod-vsw0@primary 00:14:4f:fa:40:c8 1 1500
DISK
NAME VOLUME TOUT ID DEVICE SERVER MPGROUP
vdisk1 base-vol1@primary-vds0 0 disk@0 primary
VCONS
NAME SERVICE PORT
base primary-vcc0@primary 5000
This shows that the console port for telnet is 5000, the MAC address of the virtual NIC is 00:14:4f:f8:78:9c, amongst other valuable information :-)
11. Start the new LDOM
ldm start-domain base
12. Log on to the console of the new LDOM. It should be waiting at the OK prompt for you to do a Jumpstart install. Use the MAC address you got from the previous step and Jumpstart install an OS on the LDOM over the network.
telnet localhost 5000
NOTE: The MAC address that you get from the OBP banner command is NOT the MAC adderess of the vnet1 interface! You will need the MAC address you got from the previous step!
13. Once you've built the LDOM OS and have customized it to your liking, you will need to create a sysidcfg file. However, in this instance make the file /etc/sysidcfg.bk. The reasons will become evident shortly.
You can find details of how to create a sysidcfg using man sysidcfg. My sysidcfg file looks like this:
system_locale=en_US.UTF-8
timezone=Australia/Victoria
timeserver=localhost
terminal=vt100
name_service=DNS{domain_name=mydomain.com.au
name_server=192.168.1.101
search=mydomain.com.au}
network_interface=PRIMARY {default_route=192.168.1.1
netmask=255.255.255.0
protocol_ipv6=no}
security_policy=NONE
root_password=my_password_hash
nfs4_domain=dynamic
14. Create the script /etc/rc0.d/K99mksysidcfg with the following contents
#!/bin/sh /usr/bin/cp -p /etc/sysidcfg.bk /etc/sysidcfg /usr/bin/rm /etc/rc0.d/K99mksysidcfg
Make sure it is executable
chmod 744 K99mksysidcfg
15. Create the script /etc/rc3.d/S99ldomreconfig to add host file entries and sendmail configs. Make sure it is executable
chmod 744 S99ldomreconfig
16. We now unconfigure the LDOM to remove it's identity. This will remove it's hostname, IP, host file entries. Hence the reason for steps 13 and 14! To do this:
# sys-unconfig
WARNING
This program will unconfigure your system. It will cause it
to revert to a "blank" system - it will not have a name or know
about other systems or networks.
This program will also halt the system.
Do you want to continue (y/n) ? y
The LDOM will now shutdown and will have no identity!
17. Exit out of the telnet console, and unbind the LDOM
ldm stop-domain base ldm unbind base
The LDOM is now ready to clone!!!