Wednesday, January 21, 2009



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 script
- FS0=<0>
- 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:

 zlogin -C 

~. (Exits the Console)

NOTE: If the zone did not auto boot - boot it manually:

 zoneadm -z  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:

- 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

create -b
set zonepath=/zfspool/psdmmba088/root
set autoboot=true
set pool=pool_psdmmba099 (Using the same CPU Resource pool as ba099)
set ip-type=shared
add net
set address=
set physical=e1000g0

- 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

0. English
1. French
2. German
3. es

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 '' from your system, login to the global zone and become root.

Shut down the zone:

 zlogin  shutdown    [Grace]


zoneadm -z halt [Force]

The first command is the opposite of the 'install' option of zoneadm and deletes all of the files under the zonepath:

 zoneadm -z  uninstall

Are you sure you want to uninstall zone (y/[n])? y

At this point, the zone is in the configured state. To remove it completely from the system use:

 zonecfg -z  delete

Are you sure you want to delete zone (y/[n])? y

ZFS Commands

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 list

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')

# 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
Device Type:
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
Device Type:
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
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
pool: usbdisk1
id: 414197119596802420
state: ONLINE
action: The pool can be imported using its name or numeric identifier.

usbdisk1 ONLINE
c4t0d0p0 ONLINE

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.

Readers who read this page, also read:

Bookmark and Share My Zimbio