SmartOS Cheat Sheet
SmartOS main commands #
Command | Description |
---|---|
sysinfo | Displays global system information |
prstat | Top like utility for solaris (there is no top on solaris |
prstat -Z | Display per zone resource consumption |
prstat –z UUID | Display a specific zone processes |
ps -Zaef | sort -k3 | grep global | Display global zone processes sorted by PID |
echo ::memstat | mdb -k | Displays the Overall ram consumption |
arcstat | Displays ARC statistics |
arcstat -f arcsz,c | Displays current ARC size and the desired ARC size |
zlogin | Logs into a running Solaris Zone (OS zone only) |
Virtual Machine/Zone management #
Image Management #
Command | Description |
---|---|
imgadm | Command to operate Images from which create zones |
imgadm avail | Lists repository images available to import |
imgadm import UUID | Imports a selected image from repository to SmartOS |
Imgadm delete UUID | Deletes a previously imported zone |
Imgadm install –m MANIFEST –f FILE | Imports an image from local image data |
Imgadm create UUID | Creates a local image from an existing Zone/VM |
Imgadm update UUID | Updates local images |
Imgadm sources | Lists imgadm sources |
Imgadm sources -e | Edits imgadm sources |
Zone management #
Command | Description |
---|---|
vmadm | Command to operate all Zone |
vmadm create –f dataset.js | Creates a new Zone from a JSON manifest |
vmadm get UUID | Displays properties of a zone in JSON format |
vmadm start UUID | Starts a stopped zone |
vmadm stop UUID | Stops a started zone |
vmadm send UUID | lzma -1 > backup.xz | Makes a backup from a zone |
vmadm info | Displays info about a KVM zone |
Package Management #
Command | Description |
---|---|
pkgin | Command to manage SmartOS packages |
pkgin se PACKAGE | Search for a package. |
pkgin ls | List installed packages. |
pkgin avail | List available packages. |
pkgin in PACKAGE | Perform packages installation or upgrade. |
pkgin up PACKAGE | Create and populate the initial database. |
pkgin rm PACKAGE | Remove packages and depending packages. |
pkgin –y | Flag to auto send flag yes when pkgin requires it |
pkgin clean | Cleans package cache |
Storage Management #
Command | Description |
---|---|
zfs | Command to manage the ZFS File System |
zfs list | Lists the ZFS file systems |
zfs create FS | Creates a new ZFS file system |
zfs set PROPERTY=VALUE FS | Sets properties to ZFS file systems |
zfs set compression=lzjb zones | Sets the compression property to lzjb on zones file system |
zfs set dedup=on zones | Sets the deduplication property to enabled on zones file system |
zfs get PROPERTY [FS] | Gets properties from ZFS file systems |
zfs get all [FS] | Gets all properties from all ZFS file systems |
zfs get all zones | Gets all properties from zones file system |
zpool | Command to manage ZFS pools |
zpool list | Lists available ZFS pools |
zpool list -v | Lists available ZFS pools with verbose output |
zpool create | Creates a new ZFS pool |
zpool create -f zones mirror c1t0d0 c1t1d0 | Creates a mirrored (RAID 1) ZFS pool |
zpool set PROPERTY=VALUE ZPOOL | Sets properties to ZFS pools |
zpool get PROPERTY [ZPOOL] | Gets properties from zfs pools |
zpool get autoexpand zones | Gets the autoexpand property from the zpool zones |
zpool get all | Gets all the properties from all the ZFS pools |
zpool status | Displays the status and health of the ZFS pools |
zpool scrub | Scans hardware/files system errors and repairs them |
zpool history | Displays the ZFS pool history and lifecycle |
zpool iostat | Displays the ZFS pool I/O traffic |
zpool iostat -v | Displays the ZFS pool I/O traffic (per device) |
zdb | ZFS pool debugging tool |
zdb | Displays all ZFS pool information (very verbose) |
zdb –S zones | Creates a table that shows ZFS statistics such as saved space using compression and deduplication (allocated space vs referenced) |
diskinfo | Displays available disks on the system (even USB, PCI) |
disklayout | Displays a more verbose output of the available disks on the system |
Network Management #
Command | Description |
---|---|
dladm | Data Link Administration |
dladm show-phys | Shows the physical NIC information, speed, link, duplex, etc |
dladm show-vnic | Shows all the virtual NICs and the zone which they belong to |
sysinfo | json “Network Interfaces” | Displays all the physical network interfaces |
Service Management #
Command | Description |
---|---|
svcs | Command to show service status |
svcs –a | Shows all services running and not running |
svcs SERVICE | Shows the specified SERVICE status |
svcs –xv SERVICE | Shows verbose and debug SERVICE information |
svcadm enable SERVICE | Enable the specified SERVICE |
svcadm disable SERVICE | Disables the specified SERVICE |
svcadm restart SERVICE | Restarts the specified SERVICE |
svcadm refresh SERVICE | Reloads the SERVICE configuration |
svcadm clear SERVICE | Clears maintenance state from a the SERVICE |
svccfg import manifest.xml | Imports the selected manifest |
svccfg verify manifest.xml | Verifies the integrity of the XML manifest |
svccfg delete SERVICE | Deletes the specified service from SMF |
svccfg list | Lists all the SMF imported services |
svccfg export SERVICE manifest.xml | Exports the service to an importable XML Manifest |
Smart Machine Commands #
Command | Description |
---|---|
sm-meminfo rss | Displays the Smart Machine memory usage |
sm-meminfo swap | Displays the Smart Machine swap usage |
sm-summary | Displays general Smart Machine information |
sm-cpuinfo | Displays the current CPU usage |
sm-lsof | Displays “lsof” information for the Smart Machine |
sm-set-timezone | Sets the time zone for the Smart Machine |
sm-set-hostname | Sets the hostname for the Smart Machine |
sm-reboot | Reboots the Smart Machine |
sm-shutdown | Powers off the Smart Machine |