星期五, 四月 15, 2011

umount + turn off hdd

On a Linux machine, if you just umount a hdd, the hdd will still be spinning, making it unsafe to remove. I now use this script to eject a external hdd:

#!/usr/bin/env bash
umount $1
sdparm --command=sync $1
sdparm --command=stop $1

Of course, this script should be run under super privilege. And if the hdd won't stop, try the last command several times. I don't know why.

没有评论: