illumos commands

Disk

diskinfo - list disks

it lists disks.

diskinfo
TYPE    DISK                    VID      PID              SIZE          RMV SSD
NVME    c6t002538B2214058E9d0   Samsung  SSD 980 PRO with Heatsink 2TB 1863.02 GiB   no  yes

Networking

This is like ip link in linux land. vnics created with dladm dont seem to be persistent because I have to re-create them every time i reboot.

# print all interfaces
dladm
LINK        CLASS     MTU    STATE    BRIDGE     OVER
igb0        phys      1500   up       --         --
igb1        phys      1500   unknown  --         --
ixgbe0      phys      1500   down     --         --
ixgbe1      phys      1500   down     --         --
vnic_prop0  vnic      1500   up       --         igb0
vnic_prop1  vnic      1500   up       --         igb0
# create a vnic `vnic_prop0` backed by real link `igb0`.
dladm create-vnic -t -l igb0 -m 02:08:20:ac:e9:16 vnic_prop0

# print out data about it
dladm show-vnic vnic_prop0
LINK         OVER         SPEED    MACADDRESS        MACADDRTYPE         VID
vnic_prop0   igb0         1000     2:8:20:ac:e9:16   fixed               0

ipadm - configure IP stuff

This is like ip addr in linux land but also handles configuring like, hcp. Configuration changes made with ipadm are persistent as far as I can tell.

One important difference from linux is you need to create IP object for a link with ipadm create-if before you can start configuring it.

# print IP objects on the system
ipadm
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
igb0/dhcp         dhcp     ok           172.16.254.67/24
ixgbe0/static     static   inaccessible 192.168.0.1/24
lo0/v6            static   ok           ::1/128
igb0/linklocal    addrconf ok           fe80::da5e:d3ff:fe8f:95f8/10

# Create an IP-level object associated with ixgbe0
ipadm create-if ixgbe0

# add a static IP to ixgbe0
ipadm create-addr -T static -a 192.168.0.1/24 ixgbe0/static

# add a DHCP client to ixgbe0
create-addr -T dhcp ixgbe0/dhcp

# turn on IP forwarding for igb0
ipadm set-ifprop -p forwarding=on -m ipv4 igb0

Services

svcs - list info about services

use -z <zone_name> to deal with services in a specific zone.

# show all services
svcs
STATE          STIME    FMRI
legacy_run     May_01   lrc:/etc/rc2_d/S20sysetup
disabled       May_01   svc:/platform/i86pc/acpihpd:default
online         May_01   svc:/system/omicron/baseline:default
maintenance    May_01   svc:/system/illumos/sled-agent:default

# show broken services and why they're considered broken
svcs -xv
svc:/system/illumos/sled-agent:default (Oxide Sled Agent)
 State: maintenance since May  1, 2023 at 02:09:09 AM UTC
Reason: Restarting too quickly.
   See: http://illumos.org/msg/SMF-8000-L5
   See: /var/svc/log/system-illumos-sled-agent:default.log
Impact: This service is not running.

# get the log file location for `sled-agent`
svcs -L sled-agent

# tail the log file
tail -f $(svcs -L sled-agent)

# btw for sled-agent specifically it uses bunyan-format
# json logs and you should really pipe things thru `looker`
# so that it is actually readable. go get looker from
# https://github.com/oxidecomputer/looker
tail -f $(svcs -L sled-agent) | looker

svcadm - manage a service

use -z <zone_name> to deal with services in a specific zone.

# tell the services system that it should try to run
# sled-agent again, after sled-agent has been marked as
# broken and put into the `maintenance` state as seen in
# the `svcs -xv` example. You need to do this, you can't
# just re-enable it or restart it afaict.
svcadm clear sled-agent

# disable the `sled-agent` service
svcadm disable sled-agent

# enable the `sled-agent` service
svcadm enable sled-agent

# restart the `sled-agent` service
svcadm restart sled-agent

Uncategorized

beadm - manage boot environments

Particularly useful if pkg goes awry.

beadm
BE                Active Mountpoint Space   Policy Created
helios            -      -          111.60M static 2022-12-04 03:32
helios-1          -      -          44.70G  static 2022-12-04 23:28
helios-2          -      -          40.38M  static 2023-03-22 05:10
helios-3          NR     /          66.48G  static 2023-04-30 03:40
helios-4          -      -          328.70M static 2023-05-02 07:35

beadm activate helios-4
Activated successfully

beadm
BE                Active Mountpoint Space   Policy Created
helios            -      -          111.60M static 2022-12-04 03:32
helios-1          -      -          44.70G  static 2022-12-04 23:28
helios-2          -      -          40.38M  static 2023-03-22 05:10
helios-3          N      /          6.17G   static 2023-04-30 03:40
helios-4          R      -          60.63G  static 2023-05-02 07:35

reboot

prstat - report active process statistics

this one is really useful for seeing CPU/SYS/LOCK/SLP split on a running process, broken down by threads.

# here's what I'm almost always using.
# this is a fish command, so use "$()" instead of () in bash.
prstat -p (ps ax | grep EXE_PATH | grep -v grep | head -n1 | awk '{ print $1 }') -mLc 1

Total: 1 processes, 35 lwps, load averages: 2.87, 2.40, 1.61
   PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWP   
 22181 vi       2.0 0.2 0.0 0.0 0.0  86  12 0.0  93   2 298   0 crudd/25 [tokio-runtime-worker]
 22181 vi       1.6 0.0 0.0 0.0 0.0  98 0.2 0.0  10   1  51   0 crudd/27 [tokio-runtime-worker]
 22181 vi       0.2 0.6 0.0 0.0 0.0  12  87 0.0 233   0 825   0 crudd/33 [tokio-runtime-worker]
 22181 vi       0.1 0.2 0.0 0.0 0.0 100 0.0 0.0   4   0  12   0 crudd/1
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   1   0   1   0 crudd/26 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/15 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/14 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/13 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/12 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/11 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/10 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/9 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/8 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/7 [tokio-runtime-worker]
 22181 vi       0.0 0.0 0.0 0.0 0.0 100 0.0 0.0   0   0   0   0 crudd/6 [tokio-runtime-worker]

psrinfo - displays information about processors

psrinfo -vp
The physical processor has 16 cores and 32 virtual processors (0-31)
  The core has 2 virtual processors (0 16)
  The core has 2 virtual processors (1 17)
  The core has 2 virtual processors (2 18)
  The core has 2 virtual processors (3 19)
  The core has 2 virtual processors (4 20)
  The core has 2 virtual processors (5 21)
  The core has 2 virtual processors (6 22)
  The core has 2 virtual processors (7 23)
  The core has 2 virtual processors (8 24)
  The core has 2 virtual processors (9 25)
  The core has 2 virtual processors (10 26)
  The core has 2 virtual processors (11 27)
  The core has 2 virtual processors (12 28)
  The core has 2 virtual processors (13 29)
  The core has 2 virtual processors (14 30)
  The core has 2 virtual processors (15 31)
    x86 (AuthenticAMD A00F11 family 25 model 1 step 1 clock 3000 MHz)
      AMD EPYC 7313P 16-Core Processor  [ Socket: SP3 ]