Monday, June 2, 2008

How to stop a noisy hard disk with Linux

The hard disk I use to host my Windows is extremely noisy. Furthermore, since I use Ubuntu 99% of the time and nearly never access this hard drive during this time, keeping the disk spinning is absolutely useless.
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-utils
Now, if you want to stop the hard drive /dev/sda, use this command:
sudo sg_start --stop /dev/sda
The 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_start
To 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.

Sunday, June 1, 2008

nvidia 8800 GT GPU temperature with linux

This modification of nvclock works and is accurate with my video card, but I accept no responsibility for damages this modified software may create. This software and information is provided 'As Is'.

I'm the unlucky owner of an ASUS EN8800GT.

This card basically do the job. However, ASUS has disabled the standard temperature and fan control system to allow only their own ugly software which works only with windows to monitor the card.
Under linux, nvidia-setting software return nothing for temperature. This is disappointing.

Luckily, I found a solution to be able to read, at least the GPU temperature on my Ubuntu Box.
I found that nvclock v0.8 beta3 was able to report a GPU temperature. However, this value is not good. So I modified nvclock to report correctly the temperature. Find below the patch for the file src/backend/nv50.c:
139a140,146
>
> //Temperature support for G92
> if(( (nv_card->bios->device_id&0xff00) == 0x600)||( (nv_card->bios->device_id&0xff00) == 0x610))
> {
> temp = nv_card->PMC[0x20008/4]&0x3fff;
> return (-13115 + temp) / 18.7 + 1;
> }

Nicolas (see comment below and thank you for your update) reported that since nvclock 0.8 beta4, a new patch is necessary to provide the good temperature (not -380° or so). Here is the code:

--- src/backend/nv50_old.c 2009-01-04 11:46:39.000000000 +0100
+++ src/backend/nv50.c 2009-05-26 14:21:12.000000000 +0200
@@ -229,7 +229,7 @@
printf("divider=%f, offset=%f\n", divider, offset);
}

- temp = nv_card->PMC[0x20008/4] & 0x1fff;
+ temp = nv_card->PMC[0x20008/4] & 0x3fff;
return (int)(temp + offset)/divider;
}

Now, it reports the temperature correctly, and other video cards still work correctly.

The result looks like that:



I hope this is helpful to you.