Solaris QuickSheet List all disks on system List all user accounts that do not have passwords
Version: 0.18.0 iostat -En logins -p
Date: 8/23/7 Tape unit – X = device number, n = no rewind List file system usage of the /zones filesystem by user /dev/rmt/X n quot /zones • The /dev directory contains links to /devices Display login information for wfavorit Compatibility note: This document is based upon Sparc Solaris 10 • (format) slice flags are: logins -x -l wfavorit wm – Writeable Mountable (ie: A filesystem) Change the default shell to ksh for user wfavorit rm – ReadOnly Mountable usermod -s /usr/bin/ksh wfavorit OBP wu – Writeable Unmountable (ie: swap) Modify user accounts with usermod and delete accounts with userdel. • All the following commands are to be run from the OBP and not Create group accounts with groupadd, modify group accounts with the OS. They are only valid on Sparc hardware that uses the openboot Networking groupmod, and delete groups with groupdel. firmware. The eeprom command can be used from the OS to view or Show interfaces currently installed on system, speed, and duplex set openboot firmware variables. dladm show-dev – (ndd can be used to adjust speed and duplex) Service Management Facility Show the value of the auto-boot? variable List network interfaces from the global zone only List all services known to system and current status printenv auto-boot? ifconfig -aZ svcs -a Set the system to not auto boot Remove all host specific configuration from the system (and restart) Enable the webmin service (long FMRI) setenv auto-boot? false sys-unconfig svcadm enable svc:/application/management/webmin:default Restore the system default for auto boot • Primary IP configuration files Disable the webmin service (short name) set-default auto-boot? /etc/hostname.interface svcadm disable webmin Show the default boot device ,→ IP address for interface. Alternatively use ifconfig. List details of the ssh(d) service printenv boot-device /etc/nodename svcs -l ssh List the actual device path for the disk device alias ,→ hostname for the system. Alternatively set with hostname. Restart the ssh(d) service devalias disk /etc/defaultdomain svcadm restart ssh List all openboot variables, current, and default values ,→ System domain name. (svcadm restart domain after change) Verify that the AutoFS service is running printenv /etc/defaultrouter svcs system/filesystem/autofs Show devices seen by openboot ,→ gateway for the system. Alternatively set with route. Verify that the multiuser server milestone has been reached show-devs /etc/hosts svcs multi-user-server Show help on all OBP commands ,→ Linked to /etc/inet/hosts. For IPv4 addresses only. Disable the telnetd service (Use -e for enable) help /etc/inet/ipnodes inetadm -d telnet Boot the system into single user mode from the CD ROM ,→ For IPv4 and IPv6 addresses. Should be in sync with hosts file. List services that the multi-user-server milestone is dependent on boot cdrom -s /etc/netmasks svcs -d multi-user-server Boot the system into single user mode using the default device ,→ This is not a symlink to /etc/inet/netmasks. List services that depend upon multi-user-server milestone boot -s Temporarily set IP address on hme0 svcs -D multi-user-server Reset the system ifconfig hme0 plumb up 192.168.1.17 netmask 255.255.255.0 reset-all Temporarily create an alias on hme0 (hme0:1) Files ifconfig hme0:1 plumb up 192.168.1.18 netmask 255.255.255.0 /etc/vfstab – Filesystem mount table Packages Create permanent alias on hme0 interface /var/adm/loginlog – Log of login attempts Install the gcc package echo 192.168.1.18 > /etc/hostname.hme0:1 /etc/default/* – Important default settings pkgadd -d gcc-3.4.6-sol10-sparc-local Temporarily set the default route /etc/system – Kernel modules and config Check to see if gcc is installed on system route add default 192.168.1.1 /var/adm/messages – Syslog location pkginfo SMCgcc /or/ pkginfo | grep gcc Permanently add the same route as above /etc/auto * – Automounter config files Remove the gcc package echo 192.168.1.1 > /etc/defaultrouter /etc/inet/ipnodes – IPv4 & v6 host file (read before /etc/hosts) pkgrm SMCgcc Turn off traffic on qfe3 Check the installation of the gcc (SMCgcc) package ifconfig qfe3 down Inspecting the system pkgchk SMCgcc Disable an Ethernet device (qfe3) Find the total physical memory in system Show revisions of packages on system ifconfig qfe3 unplumb prtconf | grep Memory showrev -p List statistics on all interfaces on system Find the openboot firmware version Get expected file info and source package for a file netstat -i prtconf -V pkgchk -l -p /usr/sfw/bin/gcc List all open ports on system List information on all processors in the system Verify all packages (and files) on the system netstat -an | grep LIST psrinfo -v pkgchk List all open TCP connections Find the size of a disk Display information about a package netstat -f inet iostat -En (or use the format command) pkgchk -l SMCgcc Continuously ping a host Display info on dump device Display version information about an installed package ping -s www.tablespace.net dumpadm pkginfo -x SMCgcc • Use the snoop command to capture network packets List all swap devices List all patches on the system swap -l showrev -p /or/ patchadd -p Show swap usage List patches applied to the SUNWckr package User Management swap -s (Includes physical memory) pkgparam SUNWckr PATCHLIST Add a user wfavorit to system (& create home dir) using default options Show swap size (per device) • smpatch and updatemanager can be used to manage system patches. useradd -m wfavorit swap -l|grep -v swaplo|awk ’{ print $1, $4/2048 "m"}’ View the default settings for the useradd command Show swap used (per device) Devices useradd -D swap -l|grep -v swaplo|awk ’{ print $1, ($4-$5)/2048 "m"}’ Scan for new devices to the system Change the default useradd setting for base directory Show information about a binary (bash in this example) devfsadm useradd -D -b /export/home showrev -c /usr/bin/bash List (verbosely) all attachment points (configurable hardware) Delete the password for user wfavorit, force new password on login List time of most recent reboots cfgadm -val passwd -df wfavorit last reboot Tasks Sun Volume Manager Delete the snapshot (repository will remain) • Force the system to look for new devices on restart • Steps for encapsulating root is in tasks section fssnap -d /var touch /reconfigure List (verbose) the status of all metadevices in the system • Mirror root filesystems (c0t0d0 to c0t1d0) metastat NFS /, swap, /usr, and /var are on s0, s1, s3, and s4 respectively. s5 List (tree-formatted / grep-able) the metadevices in the system • Change startup parameters for the NFS daemon in /etc/default/nfs and s6 will be used for 10 meg metadb’s on each disk. The steps are metastat -c Temporarily export /src directory shown here with multiple reboots. This is to show the difference List each metadb, its status and device (with status descriptions) share /src between each type of operation. Multiple reboots are not required. metadb -i Permanently export by putting share command in /etc/dfs/dfstab . Duplicate c0t0d0’s layout onto c0t1d0 Create a soft partition (d30) on the metadevice d7 List all exported filesystems (on local system) prtvtoc /dev/rdsk/c0t0d0s2 | \ metainit d30 -p d7 10G dfshares /or/ showmount -e fmthard -s - /dev/rdsk/c0t1d0s2 Put a filesystem on the above device Share all filesystems listed in /etc/dfs/dfstab . Set up two meta databases on each disk echo y | newfs /dev/md/rdsk/d30 shareall metadb -a -f c0t1d0s5 Grow soft partition d30 by another 10 Gig Stop sharing all filesystems (not just those in /etc/dfs/dfstab) metadb -a c0t1d0s6 metattach d30 10g unshareall metadb -a c0t0d0s5 Grow the filesystem on the above device (currently mounted on /u01) List clients connected to NFS shares on this server metadb -a c0t0d0s6 growfs -M /u01 /dev/md/rdsk/d30 dfmounts Note: Multiple dbs can be put in a single slice using -c option. Find the size of a metadevice called d10 Soft mount the /proj directory from server paris . Encapsulate / on stripe 0 metastat -c d10 mount -F nfs -o intr,soft paris:/proj /proj metainit -f d10 1 1 c0t0d0s0 Remove all soft partitions on meta device d7 Show mount points on remote system called paris metainit d0 -m d10 metaclear -p d7 showmount -e paris metaroot d0 Remove the metadevice d7 lockfs -fa metaclear d7 Zones shutdown -i6 -g0 -y View the parameters (options) for metadevice d0 Begin interactive zone configuration for (a new) zone called “jubail” metainit d20 1 1 c0t1d0s0 metaparam d0 zonecfg -z jubail metattach d0 d20 Set disk d0 to read roundrobin, write parallel, and pass 1 List (-v)erbose information on all (-c)onfigured zones . Encapsulate /usr on stripe 3 (repeat this step for /var) metaparam -r roundrobin -w parallel -p 1 d0 zoneadm list -cv metainit -f d13 1 1 c0t0d0s3 Boot the zone called “jubail” metainit d23 1 1 c0t1d0s3 zoneadm -z jubail boot metainit d3 -m d13 ZFS Delete zone and configuration from system vi /etc/vfstab (Put metadevices in place of slices) Define a (simple) zpool called projects on a single stripe zoneadm -z jubail uninstall -F shutdown -i6 -g0 -y zpool create projects c0t1d0s7 Login to the console of the jubail zone from the global zone metattach d3 d23 Define a mirror zpool called datapool on stripe 7 of two disks zlogin -C jubail (Exit from session with ~. escape sequence) . Encapsulate swap zpool create datapool mirror c0t0d0s7 c0t1d0s7 Halt the jubail zone (no shutdown scripts will be run) metainit -f d11 1 1 c0t0d0s1 List the zpools and usage stats zoneadm -z jubail halt metainit d21 1 1 c0t1d0s1 zpool list Shutdown the jubail zone from the global zone metainit d1 -m d11 Remove the zpool called datapool zlogin jubail shutdown -i0 -g0 -y vi /etc/vfstab (Put metadevices in place of swap entry) zpool destroy -f datapool List what zone you are currently in shutdown -i6 -g0 -y Create the zfs heirarchy / filesystems zonename metattach d1 d21 zfs create datapool/home View zone performance statistics (from global zone) dumpadm -d /dev/md/dsk/d1 List all zfs filesystems prstat -Z . Optional: Allow quorum at only 50% zfs list vi /etc/system (Add line: set md:mirrored root flag=1) Limit the wfavorite filesystem to 5 Gig Other . Setup “mirror” alias and boot-device setting in firmware zfs set quota=5G datapool/home/wfavorite • smc is a graphical system management interface. ok nvedit 0: devalias mirror /pci@1f,0/pci@1,1/ide@3/disk@1,0 Performance Monitoring Additional Help 1: (Ctrl-C to exit) top-like command • Visit http://docs.sun.com or http://www.sun.com/bigadmin ok nvstore prstat Rebuild the windex database for the whatis command ok setenv use-nvramrc? true Show (top-like) process listing as well as top users catman -w ok setenv boot-device disk mirror prstat -a Find all instances of “system” in the man files (This can also be done from the OS using the eeprom command.) View continuous disk I/O stats, refreshed every 2 seconds whatis system • Restart the system iostat -xnm 2 Access the man page for “system” from section 4 (and not 3c) shutdown -i6 -g0 -y View continuous zfs disk I/O stats, refreshed every 2 seconds man -s 4 system • HUP a process (myappsrv) by name zpool iostat -v 2 Find all man pages related to zfs pgrep myappsrv (Use this to test your REGEX first) View continuous network statistics, refreshed every 2 seconds apropos zfs pkill -HUP myappsrv netstat -i 2 • Turn on the system locator beacon (turn off with -f ) View source of paging activities, refreshed every 2 seconds locator -n vmstat -p 2 About this QuickSheet • Mount an ISO image (device /dev/lofi/1 may vary) View per-processor statistics, refreshed every 2 seconds Created by: William Favorite (wfavorite@tablespace.net) lofiadm -a /projects/solaris10 disk2.iso mpstat 2 Updates at: http://www.tablespace.net mount -F hsfs -r /dev/lofi/1 /mnt View continuous root (/) filesystem stats, refreshed every 2 seconds Disclaimer: This document is a guide and it includes no express war- umount /mnt fsstat / 2 ranties to the suitability, relevance, or compatibility of its contents with lofiadm -d /dev/lofi/1 any specific system. Research any and all commands that you inflict • Check what file system type is on metadevice d30 Backup upon your command line. fstyp /dev/md/rdsk/d30 Create snapshot of /var file system using /u01 as a repository location Distribution: The PDF version is free to redistribute as long as credit fssnap -F ufs -o backing-store=/u01 /var to the author and tablespace.net is retained in the printed and viewable Mount the previously created snapshot on /mnt versions. LATEXsource not distributed at this time. mount -o ro /dev/fssnap/0 /mnt