The simplest way to stop the hard drive is to use sg3-utils.
To install it just use this command:
sudo apt-get install sg3-utilsNow, if you want to stop the hard drive /dev/sda, use this command:
sudo sg_start --stop /dev/sdaThe disk will restart as soon as you will try to access it.
If you want your hard drive to stop every time you log onto your account, you can add the command to the list of software to start when you log in. However, to be able to do that, you will have to allow you to sudo sg_start without having to enter your password.
To do that if your user name is username then, edit /etc/sudoers and add the line:
username ALL=NOPASSWD:/usr/bin/sg_startTo edit /etc/sudoers you have to make it writable by root, then when you have edited it, do not forget to set it read only for root, and nothing for group and users. If you don't do that, or make an error in suoers file, sudo will no more work. So be carefull, and keep a root shell open while you test if sudo still work.
No comments:
Post a Comment