Solaris Quick Tips

These have been gathered from around the web:


  • Add inherit-pkg-dir is really a great way to conserve space. It makes zone creation inherit an additional filesystem, not using more hard disk space in the process.
    In zonecfg add:
    add inherit-pkg-dir
    set dir=/opt
  • If you are going install an application in the zone that will sit on an inherited directory you can use this, zfs makes this easy and cool way of doing it.At the command line, create a ZFS filesystem to hold the package.

    zfs create poolname/package
    zfs set mountpoint=legacy poolname/package
    zfs set compression=on poolname/package # optional
    zfs set atime=off poolname/package # optional
    and then add this to your zonecfg:

    add fs
    set dir=/opt/package
    set special=poolname/package
    set type=zfs
  • Most of the how-to documents always use ipv4# for the address section, but it can ipv6 or even a hostname. The later makes it more efficient so you can later reconfigure your network easier.

    add net
    set address=hostname
    set physical=hme0
  • Configure another network interface
    Have Solaris connect the networking stuff to the interface.ifconfig interfacename# plumb
    give the interface an ip#
    ifconfig intername# ip# upthe “up” is not optional as it is in Linux, if you don’t add the up, Solaris doesn’t create the routing
    information for the interface, you can later add the up with ifconfig interface# up if you forgetTo make it permanent create a file called and put its hostname in it./etc/hostname.interface#
    Add a line /etc/hosts with the ip# and hostname in it. newhost
  • Making Solaris a router:Now that you have more than one network interface in the system you most likely want to make the box a router. Here is the quick way to make it happen.

    routeadm -u -e ipv4-routing
    routeadm -u -e ipv4-forwarding
    your solaris box is now a router and will be permently until you reverse all that.Disks:
  • List all disks in the system withformat < /dev/null
    oriostat –En — This has been iffy for me
  • Get the amount of space left on the filesystem you are in.df –h or df -k in Pre-Solaris 10
  • Where is all my disk space, aka show only the top 10 largest files and directories in the current directory.du –sk * | sort –n | head OS details:
  • truss the equivalent of strace in linux
  • prstat: equivalent of top, add –Z space each zone is using, you can find this handy even if the only zone in use is the global one.
  • iostat: shows disk usage, my favorite arguments are –xz 1 then it only shows the active disks with each disk having its own line.
  • vmstat: shows info about the systems memory and virtual memory
  • fsstat: show activitity on a filesystem arguments are path interval count
  • mpstat: multi processor report
  • netstat: show network statistics, -in shows interfaces, -rn shows routing table
  • nfsstat: show details about nfs filesystems
  • kstat: show kernel statistics
  • dmesg | tail