rachezor
2011-04-17 11:23:31 UTC
I'm currently in the process of building a new all-in-one server based on ESXi 4.1 with a VM running Solaris 11 Express as the file server.
I've added the disk to the Solaris VM as raw device maps, and want the to spin down after a set period of time. I've tried to use the build power management option and have edited the power.conf file to no avail.
Sendning the spin down command work fine when issuing "sg_start -S /dev/rdsk/c*t*d0 using the sg3_utils tools.
After a lot of googling I found this script for linux:
The first step in getting this going is a simple bash script that checks /proc/diskstats for disk activity, and if there is no activity, it uses the sdparm command to spin down the drive. The script is as follows:
#!/bin/bash
DISKNAME=`ls -l /dev/disk/by-uuid/ | grep "<strong>46BA-C6C7</strong>" | mawk '{ print $(NF) }' | sed s_\.\.\/\.\.\/__`
a=0
#check 100 times with 0.1s gaps,
#and go on adding
for i in `seq 0 100`
do
b=`cat /proc/diskstats | grep $DISKNAME | mawk '{ print $(NF-2) }'`
a=`expr $a + $b`
sleep 0.1s
done
echo $a
if [ $a == 0 ]
then
echo "No Activity"
sdparm -C stop /dev/$DISKNAME
else
echo "Disk Active"
fi
exit 0
originating url: http://everydaylht.com/howtos/multimedia/spin-down-idle-usb-drives/
Unfortunatly I suck at developing scripts or code in general. My skills only reach as far as to modify existing scripts, mostly on a trail and error basis :-)
Could someone help me and the comunity with making an equivalent script for Solaris based on the sg_start command ?
I've added the disk to the Solaris VM as raw device maps, and want the to spin down after a set period of time. I've tried to use the build power management option and have edited the power.conf file to no avail.
Sendning the spin down command work fine when issuing "sg_start -S /dev/rdsk/c*t*d0 using the sg3_utils tools.
After a lot of googling I found this script for linux:
The first step in getting this going is a simple bash script that checks /proc/diskstats for disk activity, and if there is no activity, it uses the sdparm command to spin down the drive. The script is as follows:
#!/bin/bash
DISKNAME=`ls -l /dev/disk/by-uuid/ | grep "<strong>46BA-C6C7</strong>" | mawk '{ print $(NF) }' | sed s_\.\.\/\.\.\/__`
a=0
#check 100 times with 0.1s gaps,
#and go on adding
for i in `seq 0 100`
do
b=`cat /proc/diskstats | grep $DISKNAME | mawk '{ print $(NF-2) }'`
a=`expr $a + $b`
sleep 0.1s
done
echo $a
if [ $a == 0 ]
then
echo "No Activity"
sdparm -C stop /dev/$DISKNAME
else
echo "Disk Active"
fi
exit 0
originating url: http://everydaylht.com/howtos/multimedia/spin-down-idle-usb-drives/
Unfortunatly I suck at developing scripts or code in general. My skills only reach as far as to modify existing scripts, mostly on a trail and error basis :-)
Could someone help me and the comunity with making an equivalent script for Solaris based on the sg_start command ?
--
This message posted from opensolaris.org
This message posted from opensolaris.org