Documente Academic
Documente Profesional
Documente Cultură
Solaris Volume Management Backup and restore Misc useful stuff Lights out management Iloms seem to be a popular google search term Sun ILOM on v20z
To setup the ilom you can select Use Defaults from front panel and then add an admin user with ssh setup@ipaddress To enable serial over lan ssh admin@ipaddress platform set console -s sp -e -S 9600 To disable ssh admin@ipaddress platform set console -s platform Connect to the ilom with ssh then to start the console platform console To exit the console and return to the ilom CTRL-E c . or you can disconnect the ssh session with ~. To power on/off the system platform set power state on platform set power state off To display the mac address platform get mac
To get to the console start /SP/console To exit from console ESC-SHIFT-9 To power on/off and reset the system start /SYS stop /SYS reset /SYS show /SYS To reboot the ilom reset /SP
Show the IP address info for the ilom show /SP/network Set set set set set the IP address for the ilom /SP/network IPSource=static /SP/network IPAddress=xxx.xxx.xxx.xxx /SP/network Netmask=xxx.xxx.xxx.xxx /SP/network Gateway=xxx.xxx.xxx.xxx
Power on, off and reset the host start /SYS stop /SYS reset /SYS Power off the host gracefully set /SYS/CtrlInfo PowerCtrl=graceful_off Reboot to the BIOS set /SYS/CtrlInfo PowerCtrl=BIOSSetup Reboot to the diagnosis program set /SYS/CtrlInfo PowerCtrl=PCCheck_enable Start the console start /SP/AgentInfo/Console When started use ESC-SHIFT-9 to return to the SP (may need to try a few times) Stop the console stop /SP/AgentInfo/Console Display information on serial port settings (external and host) show /SP/serial/external show /SP/serial/host Set the serial port settings for terminal access set /SP/serial/host pendingspeed=57600 commitpending=true
# Show the IP address info for the ilom show /SP/network # Set the IP address for the ilom -> set /SP/network state=enabled -> set /SP/network pendingipdiscovery=static -> set /SP/network pendingipaddress=10.8.31.163 -> set /SP/network pendingipnetmask=255.255.252.0 -> set /SP/network pendingipgateway=10.8.31.248 -> set /SP/network commitpending=true -> set/SP/pendingipdiscovery=dhcp -> set /SP/network commitpending=true # Power on, off and reset the host start /SYS stop /SYS reset /SYS # Start the console start /SP/AgentInfo/Console When started use #. to return to the SP (may need to try a few times) # Create a user that has the ALOM interface - Needed if you want to upgrade the system firmware create /SP/users/admin role=Administrator cli_mode=alom
ZFS ZFS zfs tasks Just enter zpool or zfs to get a help screen. Here are some commands that are often useful.
# Some reminders on command syntax root@server:# zpool create stuff c0d0s0 root@server:# zpool create stuff mirror c0d0s3 c1d0s0 root@server:# zfs create stuff/www root@server:# zfs set mountpoint=/var/www stuff/www root@server:# zfs create stuff/home root@server:# zfs set mountpoint=/export/home stuff/home root@server:# zfs create stuff/home/peter root@server:# zfs create stuff/home/paul root@server:# zfs create stuff/home/mary root@server:# zfs set compression=on stuff/home root@server:# zfs set quota=5g stuff/home/paul root@server:# zfs set reservation=10g stuff/home/mary root@server:# zfs set sharenfs=rw stuff/home root@server:# zpool scrub stuff root@server:# zpool add stuff mirror c3d0s4 c4d1s2 # to set the filesystem block size to 8k root@server:# zfs set recordsize=8k stuff/home
# create one side of the mirror on the partition root@server:# metainit d11 1 1 c0t1d0s0 # and the other side of the mirror root@server:# metainit d12 1 1 c0t2d0s0 # now create a one sided mirror root@server:# metainit d10 -m d11 # attach the second side to the existing one sided mirror root@server:# metattach d10 d12
# If doing the root partition this will update /etc/vfstab to point to new root partition location. If doing non-root partitions then vi the file root@server:# metaroot d0 # Reboot so system uses half of the new raid 1 array root@server:# reboot # Add the second mirror to the raid array root@server:# metattach d0 d20 # To check on the status of the array and make sure it is syncing root@server:# metastat # Misc commands # To delete an SDR root@server:# metadb -d -f c?t?d?s? # Detach a mirror from an array root@server:# metadetach d0 d10 # Take mirror off line root@server:# metaoffline d0 d20 # Put mirror back in array and resync root@server:# metaonline d0 d20 # Create a UFS file system on the new array root@server:# newfs /dev/md/dsk/d? # Backup your metadb information root@server:# metastat -p > /etc/lvm/md.tab
# and remove the disk from the array root@server:# metaclear d10 # delete the SDR from the disk root@server:# metadb -f -d c?t?d?s? # If hot swap then replace the disk # Copy the vtoc from the good disk to a file root@server:# prtvtoc /dev/rdsk/c?t?d?s? > vtoc.c?t?d?s? # and copy to the new disk root@server:# fmthard -s vtoc.c?t?d?s? /dev/rdsk/c?t?d?s? # Add the new disk to the array root@server:# metainit d10 1 1 c?t?d?s? # and atach to the array. Will sync to existing drive
root@server:# metattach d0 d10 # add an SDR to the new disk root@server:# metadb -a -c 1 c?t?d?s?
Procedure to hot swap a disk from an array The following is a procedure I used to hot swap a disk that was part of a mirror on a system.
# remove d1 and d4 devices from the arrays root@server:# metadetach -f d0 d1 root@server:# metadetach -f d3 d4 # clear the data from the faulty disks root@server:# metaclear d1 root@server:# metaclear d4 # clear the svm database from the faulty disk root@server:# metadb -f -d c1t0d0s7 root@server:# format # find where the faulty disk is root@server:# cfgadm -alv # remove the disk from the kernel root@server:# cfgadm -c unconfigure c1::dsk/c1t0d0 # check the disk no longer appears ### If disk has gone then hot swap the disk ### root@server:# format # Tell the kernel about the device root@server:# cfgadm -c configure c1::dsk/c1t0d0 # copy the vtoc from existing disk to new disk root@server:# prtvtoc /dev/rdsk/c1t1d0s0 > /vtoc.c1t1d0s0 root@server:# fmthard -s /vtoc.c1t1d0s0 /dev/rdsk/c1t0d0s0 # Initialize and add the new disk to each array root@server:# metainit d1 1 1 c1t0d0s1 root@server:# metattach d0 d1 root@server:# metainit d4 1 1 c1t0d0s0 root@server:# metattach d3 d4 # create the svm databases root@server:# metadb -a -c 3 c1t0d0s7 # make the new disk bootable root@server:# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0
Delete an array
# Delete all replica databases root@server:# metadb -d -f c?t?d?s7
# Now load the md module #### For Solaris 9 root@server:# modload /kernel/drv/md #### For Solaris 10 root@server:# modload /kernel/drv/md OR update_drv -f md # and scan the disks root@server:# metainit -r # Make sure it all looks fine root@server:# metastat -p # If you change anything in md.conf then you MUST copy it back to the disks
Live Update Live update Pre-req's Read the Sun docs. There are many different options available and forward planning is the best solution. My setup Current root exists on SVM raid 1 array using c?t?d?s0 on two disks New boot ebvironment was to use SVM and c?t?d?s3 on the same disks Create the new boot environment
root@server:# lucreate -c "be1" -m /:/dev/md/dsk/d10:ufs,mirror -m /:/dev/dsk/c?t?d?s3:attach -m /:/dev/dsk/c?t?d?s3:attach -n "be2" Above does: - Create new boot environment be2 - Name existing environment be1
- create raid array called d10 and make it ufs - add c?t?d?s3 of two disks to the array
root@server:# lustatus
Live update from Solaris 10 to Solaris Express To upgrade from Solaris 10 to Solaris Express Create a new boot environment as above then mount the iso image. Then install the live update packages from Solaris Express
root@server:# /mnt/Solaris_11/Tools/Installers/liveupgrade20 -noconsole -nodisplay
# Fast reboot root@server:# init 6 # Shutdown and power off root@server:# init 5 # Shutdown to ok prompt root@server:# init 0 # to be nice to the system root@server:# shutdown -y -g 0 -i [level as above]
# Make the block device with lofiadm: root@server:# lofiadm -a /path/to/file.iso /dev/lofi/1
# Mount the image as a read-only filesystem: root@server:# mount -F hsfs -o ro /dev/lofi/1 /mountpoint
Mount CDROM root@server:# mount -F hsfs -o nomaplcase,ro /dev/sr0 /cdrom Show what options were used when a filesystem was mounted root@server:# mkfs -m /dev/dsk/c?t?d?s? Show what process is using a file or mountpoint. (can also kill the process) root@server:# ps -o pid,ppid,rss,args -p $(fuser -c /mountpoint 2>/dev/null) The useful 'p' and other programs
# See the man pages for more information # Most can add a -v for verbose output prtconf prtdiag psrinfo pagesize # # # # General system information System diag info including any current alerts processor information show avaialble memory page sizes
# The current state of the system vmstat mpstat iostat netstat swap # Some other more detailed stat commands kstat cpustat cputrack busstat trapstat # These take a process id as last argument ##### Read man page about warnings before using these ##### pmap # Show process memory mapping pargs # args used to start process also pargs -e # show environment for a process pfiles # files opn by a process - see warnings pstack # show current stack trace - see warnings pflags # process flags pcred # process owner etc pldd # dynamic libraries linked to process psig # signal handlers and headers pwdx # current working directory
Net booting
Network boot a server and install from jumpstart Control Break (CTRL-a f in minicom) ~break if using a Cyclades console server at the ok prompt type
root@server:# boot net - install root@server:# boot net:speed=100,duplex=full -v - install
To change the hostname edit root@server:# vim /etc/hosts root@server:# vim /etc/nodename root@server:# vim /etc/hostname.{interface name}
To get the interface name type ( i.e. hme0, bge0 ) root@server:# prtconf -D | grep network
Add an ip alias
root@server:# fconfig bge0:1 plumb root@server:# ifconfig bge0:1 192.168.1.2 root@server:# ifconfig bge0:1 up # use it and to remove it root@server:# ifconfig bge0:1 down root@server:# ifconfig bge0:1 unplumb # to clear the failed flag on an interface root@server:# ifconfig -a -failed
root@server:# for f in $(ls -1 /etc/hostname.*); do echo "Interface file -> $f; echo; cat $f; echo; done Interface file -> hostname.ce0 DUMMY1 netmask + broadcast + group production deprecated -failover up \ addif real.server netmask + broadcast + failover up Interface file -> hostname.ce1 DUMMY2 netmask + broadcast + group production deprecated -failover standby up
Service Manager
# to show what system services are running or disabled root@server:# svcs -a # To start, stop or restart a service root@server:# svcadm enable ssh root@server:# svcadm disable ssh root@server:# svcadm refresh ssh # to clear maintenance flag and start a service root@server:# svcadm clear ssh root@server:# svcadm enable ssh # Use -t to make change non persistant root@server:# svcadm enable -t ssh # to switch to a milestone root@server:# svcadm milestone svc:/milestone/single-user:default
root@server:# pkgadd -d . packagename root@server:# pkgchk packagename root@server:# pkgparam -v packagename # To show patch versions root@server:# showrev -p
Find files installed by packages Grep for filename in Show current patch levels
root@server:# grep packagename /var/sadm/install/contents # find what patches have been applied to a system root@server:# showrev -p | grep ?????
DTrace DTrace DTrace Oneliners # New processes with arguments, root@server:# dtrace -n 'proc:::exec-success { trace(curpsinfo->pr_psargs); }' # Files opened by process, root@server:# dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0)); }' # Syscall count by program, root@server:# dtrace -n 'syscall:::entry { @num[execname] = count(); }' # Syscall count by syscall, root@server:# dtrace -n 'syscall:::entry { @num[probefunc] = count(); }'
# Syscall count by process, root@server:# dtrace -n 'syscall:::entry { @num[pid,execname] = count(); }' # Read bytes by process, root@server:# dtrace -n 'sysinfo:::readch { @bytes[execname] = sum(arg0); }' # Write bytes by process, root@server:# dtrace -n 'sysinfo:::writech { @bytes[execname] = sum(arg0); }' # Read size distribution by process, root@server:# dtrace -n 'sysinfo:::readch { @dist[execname] = quantize(arg0); }' # Write size distribution by process, root@server:# dtrace -n 'sysinfo:::writech { @dist[execname] = quantize(arg0); }' # Disk size by process, root@server:# dtrace -n 'io:::start { printf("%d %s %d",pid,execname,args[0]->b_bcount); }' # Pages paged in by process, root@server:# dtrace -n 'vminfo:::pgpgin { @pg[execname] = sum(arg0); }' # Minor faults by process, root@server:# dtrace -n 'vminfo:::as_fault { @mem[execname] = sum(arg0); }'