Handy Zone Commands
zoneadm list (run from the Global zone to list all RUNNING zones)
Creating a Zone
Create a dedicated ZFS storage pool for the zones to use. See the ZFS Pool commands below. The Scripts assume that you have a ZFS pool already created. You will need to know the name of your zpool (use "zfs list" and/or "zpool list")
In the Global Zone, as root, use the Scripts located in /vol.unix/scripts/zone_scripts These will create your zfspool, setup processor pools, and install your zone.
Copy the ZONE_scripts.tar file to your global zone and edit the files as necessary.
- REVIEW the README.txt file
- Edit the setenv.sh script
- MIN/MAX CPUS=
- Edit zone_cmd_template.txt to define your installation
- See comments in the File
After the Zone is installed, log into the console from the global zone:
~. (Exits the Console)
NOTE: If the zone did not auto boot - boot it manually:
boot # then log back into the console to watch it boot
Answer the SYSIDCFG information to define the Zone and you are in!
Cloning a Zone
To make a "copy" of an existing non-global Zone follow the Steps here: http://docs.sun.com/app/docs/doc/819-2450/6n4o5mdm0?a=view
- Shut down the Zone you want to Clone from the Global Zone. This example uses psdmmzz001 as the Global, and psdmmba099 as the source we want to clone From. Plan is to create a new clone called psdmmba088.
psdmmzz001# zoneadm -z psdmmba099 halt
- Dump the configuration of pdsmmba099 so we can edit it to feed to psdmmba088
psdmmzz001# zonecfg -z psdmmba099 export -f /zfspool/zone_cfgs/psdmmba099_master
cd /zfspool/zone_cfgs cp psdmmba099_master psdmmba088_master
edit psdmmba088_master to include new info for name/IP/location
set pool=pool_psdmmba099 (Using the same CPU Resource pool as ba099)
- Create the new zone(psdmmba088) by using the commands in the file (psdmmba088_master)
psdmmzz001# zonecfg -z psdmmba088 -f /zfspool/zone_cfgs/psdmmba088_master
- Install the new zone(psdmmba088) by cloning (psdmmba099)
psdmmzz001# zoneadm -z psdmmba088 clone psdmmba099
Cloning zonepath /zfspool/psdmmba099/root...
- List all the ZONES on the system:
psdmmzz001# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
1 psdmmdb099 running /zfspool/psdmmdb099/root native shared
- psdmmba099 installed /zfspool/psdmmba099/root native shared
- psdmmba088 installed /zfspool/psdmmba088/root native shared
- Boot the Zones:
psdmmzz001# zoneadm -z psdmmba099 boot
psdmmzz001# zoneadm -z psdmmba088 boot
- Log into the console of new Zone (pdsmmba088) and complete the System Configuration:
psdmmzz001# zlogin -C psdmmba088 [Connected to zone 'psdmmba088' console]
Select a Language
Please make a choice (0 - 3), or press h or ? for help:
Zone is UP!
Removing a Zone
There is no undo, so make sure this is what you want to do before you do it!!
If you want to completely remove a zone called '
Shut down the zone:
The first command is the opposite of the 'install' option of zoneadm and deletes all of the files under the zonepath:
Are you sure you want to uninstall zone
At this point, the zone is in the configured state. To remove it completely from the system use:
Are you sure you want to delete zone
Command to Create the initial ZFS Pool - This command creates the ZFS storage pool - Mounts it to a mount point with the same name as the pool
zpool create zfspool mirror c1t0d0s6 c1t1d0s6
Commands to create ZFS storage areas on the pool that was just created.
zfs create zfspool/
zfs create zfspool/
/root # this is where the Zone OS will be installed
zfs create zfspool/
/oracle # only necessary for Oracle DB Zones
zfs set quota=3G zfspool/
/root # limits the size of the root zone
zfs set quota=5G zfspool/
/oracle # limits the size of the oracle file system
zfs destroy zfspool/nvnammmdo001/root # destroy one zfs volume
zfs destroy -r zfspool/nvnammmdo001 # recursive destory
Using a USB Drive with Solaris and ZFS
Attach the drives to a running Solaris System capable of reading ZFS over USB. (some older version of Solaris are not capable out of the Box.)
NOTE - You May need/want to disable 'vold' if you encounter issues
Verify your system recognizes the drive ('rmformat')
Looking for devices...
1. Logical Node: /dev/rdsk/c0t0d0p0
Physical Node: /pci@0,0/pci108e,cb84@2/storage@4/disk@0,0
Connected Device: American Virtual Cdrom De 0100
2. Logical Node: /dev/rdsk/c1t0d0p0
Physical Node: /pci@0,0/pci108e,cb84@2/storage@5/disk@0,0
Connected Device: AMI Virtual Floppy 1.00
3. Logical Node: /dev/rdsk/c2t0d0p0
Physical Node: /pci@0,0/pci-ide@6/ide@0/sd@0,0
Connected Device: MATSHITA CD-RW CW-8124 DZ13
Device Type: DVD Reader
--> 4. Logical Node: /dev/rdsk/c4t0d0p0
Physical Node: /pci@0,0/pci108e,cb84@2,1/hub@6/storage@2/disk@0,0
Connected Device: JMicron JM20338 SATA, US 0100
Device Type: Removable
Create a NEW ZFS pool on a NEW "unformatted" device.
# zpool create usbdisk1 c4t0d0p0
This will create the ZFS Pool, the /usbdisk1 mount point, and mount it for usage.
# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
usbdisk1 928G 881G 47.4G 94% ONLINE -
Connecting a previously formated ZFS USB Disk.
Run 'zpool import' as root to view available zpools to connect.
# zpool import
action: The pool can be imported using its name or numeric identifier.
Connect the ZFS Pool - as root (this will mount the drive and create the mountpoint)
# zpool import usbdisk1
Interact with the Data
# cd /usbdisk1
UNMOUNTING Drives before removing
When you are finihsed with the drive, unmount it from the system before disconnecting the USB cable.
# zpool export usbdisk1
This will unmount the drive and remove the mountpoint.