Seagate Expansion external hard drive and removing STANDBY mode
A problem associated with several brands of external hard drives are the settings. Once setting in particular is the STANDBY mode. STANDBY mode is a resource saving mode, so the external USB drive does not consume power and kernel resources during periods of inactivity. The easiest way to disable the STANDBY mode is to attach the NTFS formatted device to a Window’s server, open the device’s management console, and disable the STANDBY setting. What if you have already attached the device to the Linux server?
The tool to working with USB devices is sdparm. In CentOS and RedHat you can obtain the version of sdparm compatible with your architecture using YUM. To find the package run: ‘sudo yum list \*sdparm\*`. The hardware I am using is i386, so the package returned is: sdparm.i386. Run: `sudo yum install sdparm.i386` to install the package.
To view the parameters of the device run: `sudo sdparm -a /dev/(device name for the USB disk)`.
sudo sdparm -a /dev/sdb
/dev/sdb: Seagate Desktop 0130
Power condition mode page:
PM_BG 0 [cha: n, def: 0, sav: 0]
STANDBY_Y 0 [cha: n, def: 0, sav: 0]
IDLE_C 0 [cha: n, def: 0, sav: 0]
IDLE_B 0 [cha: n, def: 0, sav: 0]
IDLE 0 [cha: n, def: 0, sav: 0]
STANDBY 1 [cha: y, def: 1, sav: 1]
ICT 0 [cha: n, def: 0, sav: 0]
SCT 9000 [cha: y, def:9000, sav:9000]
SAT ATA Power condition mode page:
APMP 0 [cha: n, def: 0, sav: 0]
APM 0 [cha: n, def: 0, sav: 0]
Running sdparm actually shows you the type of device. If you have an older device, you can use sdparm to see the device type. The parameter that is a concern with the Seagate Expansion external hard drive is the STANBY 1. That setting needs to be set to 0, so it is off.
You can run `sudo sdparm` to see a listing of options.
I ran `sudo sdparm –clear=STANDBY /dev/sdb` to clear or set to 0 the STANDBY mode. Now when I run `sudo sdparm -a /dev/sdb` this is what we see:
sudo sdparm -a /dev/sdb /dev/sdb: Seagate Desktop 0130 Power condition mode page: PM_BG 0 [cha: n, def: 0, sav: 0] STANDBY_Y 0 [cha: n, def: 0, sav: 0] IDLE_C 0 [cha: n, def: 0, sav: 0] IDLE_B 0 [cha: n, def: 0, sav: 0] IDLE 0 [cha: n, def: 0, sav: 0] STANDBY 0 [cha: y, def: 1, sav: 1] ICT 0 [cha: n, def: 0, sav: 0] SCT 4294967286 [cha: y, def:9000, sav:9000] SAT ATA Power condition mode page: APMP 0 [cha: n, def: 0, sav: 0] APM 0 [cha: n, def: 0, sav: 0]
That should be all you need to perform to remove the STANDBY mode. Now, be warned that once you restart the Linux system the device will return to the default settings. What I did to overcome this limitation was to place the following two lines in the /etc/rc.local file:
if [[ `/sbin/fdisk -l /dev/sdb`]] then /usr/bin/sdparm --clear=STANDBY /dev/sdb mount /dev/sdb1 /mnt/usb fi
The last script to run is the /etc/rc.local so the changes take place prior to the device being mounted. The if statement ensures the device exists.