Get a site

External drives on Arch Linux: shut them down

After basic installation of Arch Linux, when you unmount external drives (an hard disk or a USB key), they don’t shutdown completely, but they simple stop working, while disks continue to run.


If you are particularly finicky, and you would like to power off the device before to unplug it, you need to put in low-power your device. To do this, you have to install the hdparm package:

[email protected] ~ $ sudo pacman -S hdparm

This CLI tool is very simple to use (/dev/sdb1 is the path of my device):

[email protected] ~ $ sudo hdparm -C /dev/sdb1

to check the current IDE power mode status.

[email protected] ~ $ sudo hdparm -S 10 /dev/sdb1

to put the drive into idle (low-power) mode, and also set the standby (spindown) timeout for the drive.

[email protected] ~ $ sudo hdparm -Y /dev/sdb1

to force an IDE drive to immediately enter the low-power consumption standby.

However, write root password every time to run hdparm command might be uncomfortable. Thus, you have to digit in a terminal:

[email protected] ~ $ sudo nano /etc/sudoers

and add the command hdparm to the following line of script (at the end of the file):

your_username ALL=(ALL) NOPASSWD: usr/bin/hdparm

I use this trick with a lot of command as reboot, shutdown, wifi-menu.
But, if you are very very lazy, you might want to write less code as possible. So you can avoid to write sudo, creating the .bash_aliases file in your home. Following, I show you my .bash_aliases:

[email protected] ~ $ emacs -nw .bash_aliases

alias shutdown='sudo shutdown now'
alias reboot='sudo reboot'
alias wifi-menu='sudo wifi-menu'
alias yaourt='sudo yaourt'
alias wvdial='sudo wvdial'
alias hdparm='sudo hdparm'

To enable this configuration you have to load the changes to the .bash_aliases file as following:

[email protected] ~ $ source ~/.bash_aliases

To enable your aliases at start up, put the previous command in your .bashrc! GWH!!

Published by Francesco Serafin

I am a PhD student at the Department of Civil, Environmental and Mechanical Engineering at the University of Trento. My two greatest loves: Computer Science and Water (take three with my Lenovo!:D). As a result, the aim of my life is to make both passions coexist. My gpg public key available at

Leave a Reply

Your email address will not be published.

%d bloggers like this: