Solaris Containers cheat sheet
This a quick cheat sheet of the commands that can be used when using zones (containers), for a more complete guide see solaris zones.
Zone States
Configured
Configuration has been completed and storage has been committed.
Additional configuration is still required.
Incomplete
Zone is in this state when it is being installed or uninstalled.
Installed
The zone has a confirmed configuration,
zoneadm
is used to verify the
configuration, Solaris packages have been installed, even through it has
been installed, it still has no virtual platform associated with it.
Ready (active)
Zone’s virtual platform is established. The kernel creates the
zsched
process, the network interfaces are plumbed and filesystems mounted. The
system also assigns a zone ID at this state, but no processes are
associated with this zone.
Running (active)
A zone enters this state when the first user process is created. This is
the normal state for an operational zone.
Shutting down + Down (active)
Normal state when a zone is being shutdown.
Cheat sheet
Creating a zone
zonecfg -z
see creating a zone for a more details
deleting a zone from the global ssytem
zonecfg -z
Display zones current configuration
zonecfg -z
Create a zone creation file
zonecfg -z
Verify a zone
zoneadm -z
Installing a zone
zoneadm -z
Ready a zone
zoneadm -z
boot a zone
zoneadm -z
reboot a zone
zoneadm -z
halt a zone
zoneadm -z
uninstalling a zone
zoneadm -z
Veiwing zones
zoneadm list -cv
login into a zone
zlogin
login to a zones console
zlogin -C
login into a zone in safe mode (recovery)
zlogin -S
add/remove a package (global zone) If the -G option is missing the package will be lists processes in a zone Quick and dirty ZFS cheatsheet Set pool mountpoint: System Controller Systems (4800, 6900) Command Action poweron all Turn on all boards and start systems booting setkeyswitch -d A The XSCF is provided on separate hardware from the main M5000 processing capacity. The network interfaces are distinct from those used by the server and are configured to connect via ssh. To gain access to the console ssh in to the XSCF controller and subsequently connect to domain 0 on the system. The M5000 servers are all configured with one domain at present. The controllers are registered in the format ‘jamaican-xscf.iso.port.ac.uk’. Action poweron -d 0 Power on domain 0 poweroff -d 0 Power off domain 0 sendbreak -d 0 Send a break signal to domain 0 console -d 0 Connect to the console of domain 0 integrated Lights Out Manager (iLom on the T5220) Action start /SP/console Connect to the console of the server
# pkgadd -G -d .
added to all zones
add/remove a package (non-global zone)
# pkgadd -Z -d .
added to all zones
Query packages in all non-global zones
# pkginfo -Z
query packages in a specified zone
# pkginfo -z
# ps -z
list the ipcs in a zone
# ipcs -z
process grep in a zone
# pgrep -z
list the ptree in a zone
# ptree -z
Display all filesystems
# df -Zk
display the zones process informtion (must be login into the zone)
# psrstat -Z
December 20, 2008
Create simple striped pool:
zpool create [pool_name] [device] [device] …
zpool create datapool c5t433127A900011C370000C00003210000d0 c5t433127B4001031250000900000540000d0
Create mirrored pool:
zpool create [pool_name] mirror [device] [device] …
zpool create datapool mirror c5t433127A900011C370000C00003210000d0 c5t433127B4001031250000900000540000d0
Create Raid-Z pool:
zpool create [pool_name] raidz [device] [device] [device] …
zpool create datapool raidz c5t433127A900011C370000C00003210000d0 c5t433127B4001031250000900000540000d0 c5t439257C4000019250000900000540000d0
Transform simple pool to a mirror:
zpool create [pool_name] [device] zpool attach [pool_name] [existing_device] [new_device]
zpool create datapool c5t433127A900011C370000C00003210000d0 zpool attach datapool c5t433127A900011C370000C00003210000d0 c5t433127B4001031250000900000540000d0
Expand simple pool:
zpool create [pool_name] [device] zpool add [pool_name] [new_device]
zpool create datapool c5t433127A900011C370000C00003210000d0 zpool add datapool c5t433127B4001031250000900000540000d0
Expand mirrored pool by attaching additional mirror:
zpool add [pool_name] mirror [new_device] [new_device]
zpool add datapool mirror c5t433127A900011C370000C00003460000d0 c5t433127B400011C370000C00003410000d0
Replace device in a pool:
zpool replace [pool_name] [old_device] [new_device]
zpool replace datapool c5t433127A900011C370000C00003410000d0 c5t433127B4001031250000900000540000d0
Destroy pool:
zpool destroy [pool_name]
zpool destroy datapool
zfs set mountpoint=/path [pool_name]
zfs set mountpoint=/export/zfs datapool
Display configured pools:
zpool list
zpool list
Display pool status info:
zpool status [-v] [pool_name]
zpool status -v datapool
Display pool I/O statistics:
zpool iostat [pool_name]
zpool iostat datapool
Display pool command history:
zpool history [pool_name]
zpool history datapool
Export a pool:
zpool export [pool_name]
zpool export datapool
Import a pool:
zpool import [pool_name]
zpool import datapool
Create a filesystem:
zfs create [pool_name]/[fs_name]
zfs create datapool/filesystem
Destroy a filesystem:
zfs destroy [pool_name]/[fs_name]
zfs destroy datapool/filesystem
Rename a filesystem:
zfs rename [pool_name]/[fs_name] [pool_name]/[fs_name]
zfs rename datapool/filesystem datapool/newfilesystem
Move a filesystem:
zfs rename [pool_name]/[fs_name] [pool_name]/[fs_name]/[fs_name]
zfs rename datapool/filesystem datapool/users/filesystem
Display properties of a filesystem:
zfs get all [pool_name]/[fs_name]
zfs get all datapool/filesystem
Make a snapshot:
zfs snapshot [pool_name]/[fs_name]@[time]
zfs snapshot datapool/filesystem@friday
Roll back filesystem to its snapshot:
zfs rollback [pool_name]/[fs_name]@[time]
zfs rollback datapool/filesystem@friday
Clone a filesystem:
zfs snapshot [pool_name]/[fs_name]@[time] zfs clone [pool_name]/[fs_name]@[time] [pool_name]/[fs_name]
zfs snapshot datapool/filesystem@today zfs clone datapool/filesystem@today datapool/filesystemclone
Backup filesystem to a file:
zfs send [pool_name]/[fs_name] > /path/to/file
zfs send datapool/filesystem@friday > /tmp/filesystem.bkp
Restore filesystem from a file:
zfs receive [pool_name]/[fs_name] < /path/to/file
zfs receive datapool/restoredfilesystem < /tmp/filesystem.bkp
Create ZFS volume:
zfs create -V [size] [pool_name]/[vol_name]
zfs create -V 100mb datapool/zvolume newfs /dev/zvol/dsk/datapool/zvolume
These systems have a system controller accessable over the network. They are given a name distinct from the system(s) they control because they can control multiple different systems. To gain access to the system controller, telnet to the relevant name and choose the ‘Platform Shell’ option. You will then need to provide a password. The other options in this list are for access to the relevant system consoles. At the command line, the following should be enough for basic operation :-
Turn off domain A (or C if you replace A in the command)
eXtended System Control Facility (XSCF on the M5000)
Command
showdomainstatus -a
show status of all domains
The iLom can be used both via ssh or a web browser interface. To connect to the to the iLom of a server use the name format ‘bread-lom.iso.port.ac.uk’. Although the servers are capable of making use of an aLom interface, Sun are reportedly standerdizing all controllers to the iLom model and as such it would be best to familiarize with the new commands.
Command
set /HOST send_break_action=break
send a break signal to the host