Tech Support Guy banner
Status
Not open for further replies.
1 - 5 of 5 Posts

·
Registered
Joined
·
1,894 Posts
Discussion Starter · #1 ·
can anyone help me set hdparm to run at every boot on ubuntu?

im a complete noob so simple instructions please, my laptop hard-drive is going crazy with the linux "parking heads" issue - i have a fix to try but i need it to run at boot - its the hdparm -B 254 /dev/sda thingy but it resets every boot

im on ubuntu 64-bit


thanks
 

·
Registered
Joined
·
3,924 Posts
hdparm is a Bash command and needs the kernel available first. I wouldn't have thought you can set it a boot time.

After Ubuntu has been booted up you can always issue it as a script which should give the same result.
 

·
Registered
Joined
·
20,583 Posts
can anyone help me set hdparm to run at every boot on ubuntu?

im a complete noob so simple instructions please, my laptop hard-drive is going crazy with the linux "parking heads" issue - i have a fix to try but i need it to run at boot - its the hdparm -B 254 /dev/sda thingy but it resets every boot

im on ubuntu 64-bit

thanks
Hi paulb100,

You need to be root to edit the file /etc/rc.local file which should already have executable permission.

I would first save the original file by renaming it to rc.local.original, and then cp -p rc.local.original rc.local and then edit the rc.local file, followed by reboot (if you have an installed Ubuntu 10.10 system (Maverick Meerkat). If it does not work on reboot, then revert the change by simply issuing the command: in /etc: mv rc.local.original rc.local, and then reboot.

For example,
$ sudo -i
# cd /etc
# cp -p rc.local rc.local.original
# vi rc.local (edit the rc.local file)
(insert the hdparm command before the exit 0 command)
:wq (to exit vi)
# shutdown -h now (to reboot immediately)

-- Tom
 

·
Registered
Joined
·
1,894 Posts
Discussion Starter · #4 ·
thanks Tom .but... quote "m a complete noob so simple instructions please," hehe
i dunno how to do anything of wot you mention - i think its a script i need to run as soon as ubuntu is loaded

this is the code to be run in terminal to fix my problem...
sudo hdparm -B 254 /dev/sda
i need this to run everytime ubuntu is loaded... this is because linux programmers have not incorporated any hard-drive power management settings like windows does, so in linux i get excessive head parking which i can hear and also wrecks my drive....why laptop hard-drive manufacturers do this i do not know

so how do i
A) create the script with the above code in? (i know in windows it would be a .BAT file)
and
B) where do I put the file for it too be executed every boot?

thanks
 

·
Registered
Joined
·
20,583 Posts
Hi paulb100,

In Ubuntu, execute the following commands (assume you are the default ubuntu user with the prompt: [email protected]:~$ where the '#' character is the root user's prompt you will see after the sudo command) Note: each line is followed by <Enter> which means press the Enter key on your keyboard except for the <Esc> line which means press the Escape key on your keyboard labeled "Esc" - i.e. it is not followied by <Enter> key press. Also, the 'i' command given below to enter the "insert" mode of the vi editor is not followed by <Enter> as there is no need for it.

[email protected]:~$ sudo -i<Enter>
# cd /etc<Enter>
# cp -p rc.local rc.local.original<Enter>
# vi rc.local<Enter>
:13<Enter>
i
hdparm -B 254 /dev/sda
<Esc>
:wq<Enter>
# shutdown -h now<Enter>

Note: There is no need to press the Enter key, i.e. <Enter>, after the hdparm command has been typed on line 13. Also, I used line 13 which is a blank line in my default /etc/rc.local file just before the exit 0 command in that file. The /etc/rc.local file in your system should be the same.

Here is what happens with each command line above:
sudo -i - will put you into root account
cd /etc - changes the current directory to the /etc directory
cp -p rc.local rc.local.original - saves the original rc.local file to its identical twin file named rc.local.original
vi rc.local - will launch the vi editor to edit the rc.local file in the /etc directory
:13 - will position you to the 13th line in the file, i.e. the line before the exit 0 command in the file
i - will put the vi editor into "insert" mode so that the following line can be inserted DO NOT PRESS ENTER
hdparm -B 254 /dev/sda - type only the characters you see and no others
<Esc> - this means press the Escape character on your keyboard which commands the vi editor to leave the "insert" mode
:wq - writes the rc.local file and quits the vi editor leaving you back at the root account's prompt, i.e. the "#" character
shutdown -h now - reboots your computer immediately

When your system is rebooted, if your hdparm command does what you wanted it to do, then you should be all set.

-- Tom
 
1 - 5 of 5 Posts
Status
Not open for further replies.
Top