Feb 142009
 

Spindown, as the name suggests is a free opensource command line utility to spin down your disks when no data is read or written of it. This should help save the precious energy and give the disks a longer life. It works by checking the number of blocks read from and written to the disks. When no blocks are read or written to the disk then it is considered idle. When a disk stays idle long enough spindown uses sg_start SCSI scripts to spin the disk down. It also works with usb disks and hotswappable disks because it doesn’t watch the device name (hda, sdb, …), but uses device id.

Install Spindown in openSUSE

To install Spindown, click this 1-click installer from Packman supported on openSUSE 11.1/11.0/10.3
oneclick1

This should download the YMP file and automatically launch the YaST package manager to add the required Repositories and download and install Spindown and the dependencies. Click next on the Spindown installation screen and Next again on the installation proposal window. This should start adding the required repositories, download and install Spindown and its required dependencies. Click Finish when the installation completes successfully.
spindown1 spindown2

spindown3
This should install the Spindown daemon under /etc/init.d/

Before we can start using Spindown utility, we need to quickly setup the config file /etc/spindown.conf

There are two sections where the paramters can be defined. One is [General] which holds the global configurations and the other [Disk]. The [Disk] section can be for as many choosen disk from the ones installed on your system like [disk 0] [disk 1]. Anything defined under disks overide the global configurations under General. The config file is commented very well to guide you through and the default configs under [General] are good enough. In a simple configuration on my PC, I add my only disk to the config.

To find the device ID,

linux-pa5r:/etc # ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root  9 Feb 14 20:03 ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 14 20:03 ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb 14 20:03 ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Feb 14 20:03 ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 Feb 14 20:03 ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 Feb 14 20:03 ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 Feb 14 20:03 ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921-part7 -> ../../sda7
lrwxrwxrwx 1 root root  9 Feb 14 20:03 edd-int13_dev80 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 14 20:03 edd-int13_dev80-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb 14 20:03 edd-int13_dev80-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Feb 14 20:03 edd-int13_dev80-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 Feb 14 20:03 edd-int13_dev80-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 Feb 14 20:03 edd-int13_dev80-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 Feb 14 20:03 edd-int13_dev80-part7 -> ../../sda7
lrwxrwxrwx 1 root root  9 Feb 14 20:03 scsi-SATA_WDC_WD2500BEVS-_WD-WXE608PV7921 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 14 20:03 scsi-SATA_WDC_WD2500BEVS-_WD-WXE608PV7921-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb 14 20:03 scsi-SATA_WDC_WD2500BEVS-_WD-WXE608PV7921-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Feb 14 20:03 scsi-SATA_WDC_WD2500BEVS-_WD-WXE608PV7921-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 Feb 14 20:03 scsi-SATA_WDC_WD2500BEVS-_WD-WXE608PV7921-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 Feb 14 20:03 scsi-SATA_WDC_WD2500BEVS-_WD-WXE608PV7921-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 Feb 14 20:03 scsi-SATA_WDC_WD2500BEVS-_WD-WXE608PV7921-part7 -> ../../sda7

Here my disk is “ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921“. I enter the Disk config in the /etc/spindown.conf as follows accepting the default global config under [General]:

[Disk 0]
id =ata-WDC_WD2500BEVS-75UST0_WD-WXE608PV7921
spindown = 1

Here, I define the Disk ID and set Spindown = 1 to enable the spinning down of the disk when idle. That completes the config.

Start the Spindown daemon as follows:

linux-pa5r:/etc # /etc/init.d/spindown start
Starting spindownd daemon…  spindownddone.

To check the status, use the command with “status” arguement.

linux-pa5r:/etc # /etc/init.d/spindown status
name           watched        active         idle-time      spindown-time
sda            1              1              0              3600

This to me is a simple and elegant tool which serves the useful purpose of saving some energy and extending the disk life. Click here to visit the project homepage hosted at Google Code for more information and more advanced documentation.