#!/bin/ksh
( N=`format < /dev/null | egrep -i 'emc|hit' | wc -l| sed 's/ //g'`
/usr/ucb/echo -n "metainit d1 $N "
format < /dev/null | egrep -i 'emc|hit' | awk '{ print $2 }' | while read d;do
/usr/ucb/echo -n "1 ${d}s2 "
done
echo "" ) > /tmp/makevol.ksh
chmod 755 /tmp/makevol.ksh
Uncategorized
mount using sshfs
Mounting example
$ sshfs -p 32 kraftek.com:/u01 /u01
To unmount it
$ fusermount -u /u01
check if async io is enabled
# cat /proc/sys/fs/aio-nr;cat /proc/sys/fs/aio-max-nr
110456
1048576
Get WWN tree info for an hba
To get all the wwns attached to an hba you can use this
# cfgadm -al -o show_FCP_dev | egrep ‘disk|tape’
create user’s homes from the entries at /etc/passwd
i don’t like to do a # cat /etc/passwd and manually create the users and chown their dirs… So, this is a one liner:
# grep -i home /etc/passwd | awk -F: ‘{print “mkdir ” $6 ” ; chown ” $1 ” ” $6 }’ > somefile; chmod 755 somefile;./somefile 183/433
scan for new disks inside a linux vmware vm
Just do this:
ls /sys/class/scsi_host/ | while read h;do echo "- - -" > /sys/class/scsi_host/$h/scan;done
Print extended info about your rpms
Use the queryformat modifier to print more info about your rpm
# rpm -qa –queryformat %-{name}-%{version}-%{release}-%{arch}”n”
You can grep for something there, because it is a full listing
Thanks to Fergus O’hea
“swapon -s” shows swap spaces as “(deleted)” if these are lvm volumes
[root@mylinux]# swapon -s
Filename Type Size Used Priority
/dev/systemvg/swapvol (deleted) partition 4095992 0 -3
According to http://kbase. redhat.com/faq/FAQ_79_4331.shtm we need to
add “swapoff -a && swapon -a” to the end of /etc/rc.d/rc. sysinit
We can also run
#swapoff -a && swapon -a
To fix it live, and we’ll see:
[root@mylinux]# swapon -s
Filename Type Size Used Priority
/dev/systemvg/swapvol partition 4095992 0 -3
114/433
changing a label from EFI to SMI
If your slice 2 is empty and you got partitions 0-9 in your disk when checkign it in “format”, you have an EFI label.
If you want to change it to a SMI label, you need to use “format -e” and when prompted for the label type,
choose SMI
partition> label
[0] SMI Label
[1] EFI Label
Specify Label type[1]: 0
Warning: This disk has an EFI label. Changing to SMI label will erase all
current partitions.
Continue? y
Auto configuration via format.dat[no]?
Auto configuration via generic SCSI-2[no]?
partition>
68/433
Quick and dirty script to query NIC speed
I already have a script like this in "miniexplorer", but it generates html and that may be overkill, so this is a quickie one to
query all network card ports in your solaris server about NIC speed.
#!/bin/ksh
ifconfig -a | grep flags | grep -v 'lo' |awk -F: '{ print $1 }' |uniq|while read IF;do
D=`echo $IF| sed s/[0-9,:]*$//`
IN=`echo $IF| sed 's/^[a-z]*//'`
echo "$D $IN -------------------------------------------------"
ndd -set /dev/$D instance $IN
(ndd -get /dev/$D ?|awk '$1!~/^?/{print$1}'|while read p;do
/usr/ucb/echo -n $p:;ndd -get /dev/$D $p;
done
kstat ${D}:${IN}) | egrep 'adv|link|speed' |sed 's/ //g'
done