Script to create FLARs

This one will login to a list of servers and create a flar in a NFS share

#!/bin/ksh

for h in `cat hosts.txt`;do
        echo "----------------------- $h"
cat <<EOF  > /tmp/$h
mkdir -p /b; mount -F nfs 10.80.120.219:/space /b; ls /b
time flarcreate -n "$h" -c -S -R / /b/flars/$h.flar
umount /b
EOF
scp /tmp/$h $h:/tmp
ssh $h /tmp/$h
done

Rsync many solaris server’s non-OS filesystems in parallel

This one will run rsyncs in the background for each host it finds in hosts.txt, and save each host’s progress in a log.

#!/bin/ksh
for h in `cat hosts.txt`;do
 echo "----------------------- $h"
 (
 ssh $h df -k | egrep -v 'cdrom|^Filesystem|/$|/devices$|/system/contract$|/proc$|/etc/mnttab$|/etc/svc/volatile$|/system/object$|/etc/dfs/sharetab$|/dev/fd$|/tmp$|/var$|/var/run$|/dev/vx/dmp$|/dev/vx/rdmp$|/cores$|/var/crash$' | awk '{ print $NF }' | while read l;do
 mkdir -p /space/$h$l
 echo "rsync --progress -zrtva $h:$l/ /space/$h$l/"
 rsync --progress -zrtva $h:$l/ /space/$h$l/
 done
 ) 2>&1 > ${h}.log &
 done

Reduce VirtualBox vdi image

if your vdi is larger than the space you’re using, you can reduce its size by installing “zerofree” inside your vm, and booting it in “recovery”, “failsafe” or “single user” mode, remount your “/” filesystem readonly, and supposing “/” is in /dev/sda1

# zerofree /dev/sda1

Shutdown your vm and in the VirtualBox host

# VBoxManage modifyhd linuxy.vdi compact

Solaris Trusted Extensions

To disable:

– for each zone

zonecfg -z thezone export > thezone.zcfg
zoneadm -z thezone halt
zoneadm -z thezone detach
zonecfg -z thezone delete

– disable the labeld service

svcadm disable labeld

– reboot the server

– verify with the command “plabel”

– recreate the zones

zonecfg -z thezone -f thezone.zcfg
zoneadm -z thezone attach
zoneadm -z thezone boot