LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Putting harddisk to sleep... and keeping it sleepy (https://www.linuxquestions.org/questions/linux-hardware-18/putting-harddisk-to-sleep-and-keeping-it-sleepy-694940/)

crispy_chunks 01-04-2009 04:01 PM

Putting harddisk to sleep... and keeping it sleepy
 
Hello, ive got a machine which i use as a media center, running kubuntu (gnome is also installed). However, when im not using it it would be very nice to keep my harddisks powered down - I know how to do this with hdparm, but they always spin up again after like 5 seconds.

What i have tried:
laptop_mode start - this makes the harddisk turn off alright, but they still spin up after 5 secs.

unmounting all volumes from the discs i want to put to sleep - still same problem.

-- I have also observed a constant buzzing sound from the harddisks, which lasts 10-30s and reappears after 10-30s. Its sort of a writing sound, but at a much lower volume, kind of feels like it wants to write something but its afraid of something hehe.

johan162 01-05-2009 05:07 AM

You didn't state your disk configuration or or exactly what hdparm argument you were using so it's not that easy to help you.

If you only have one hdd you can never have it constantly sleep since the system will access logs (e.g. /var/log/messages etc) and thereby wake up the disk to write to it. Depending on your system setup the access to the log files can be several times a minute which makes putting the drive to sleep practically impossible.

If you only used "$> /sbin/hdparm -y /dev/sda" (for example) it will only put your disk in suspended state until the next wake up. If you want to set the standby parameter so it automatically goes to sleep after X minutes of inactivity on the disk you should use the "-S" command to hdparm.

(Please note the somewhat strange parameters to the "-S" command. Refer to "man hdparm for details.)

If you only have one hdd everything is not completely lost since in theory you could set up a tmpfs (temp filesystem) as a RAM disk and mount /var onto that. However, that is very dangerous thing to do since there are things on the var partition (e.g. databases) that you don't want to loose when the power goes down.

(I once did this on a UPS backedup server and had script several times a day do an rsync on the RAM disk back to a proper /var disk so in case of a fatal power outage.)

Johan

crispy_chunks 01-05-2009 09:44 AM

Oh yes sorry for the ovbiously missing information, my disk configuration is as follows: disk 1: 80 gb system drive, disc 2 and 3 mounted in /media/disk2 and disk3 - all formatted in ext3 - swap partition on disk 1.

I put my drives to sleep with sudo hdparm -Y <device>

The ramdisk solution seems very interesting - what kind of database loss could we be seeing? I will be running amarok and xbmc which both uses databases to keep track of music/other media, but i guess these could be configured to keep their databases out of the /var/ dir if they even keep them there. I guess database access from these are only active when they are needed eg. disks are spinning anyways.

I can probably turn off logs also.

My system will be very static (not changing many settings) once its set up if that helps out on the /var/ problem.

Maybe make a script that keeps saving the /var/ stuff as long as the disk is active, but saves it to ram when its not. I mean, how important can the stuff that needs to be saved to /var/ be when the computer is not doing anything?

crispy_chunks 01-05-2009 09:59 AM

Actually, what i really want is the computer to be silent when its not in use - but putting the whole system in suspend doesnt seem to work with the nvidia driver, and i need 3d accleration for xbmc :(

crispy_chunks 01-08-2009 07:43 AM

I discovered that if i mount the filesystem as ext2, and with async option (is this one necessary? I am not concerned about write/read speeds), the disk wont spin up again all the time - because there is not journal written as with ext3, but what is the consequence of mounting it like this? Like with good old fat that there will be possible file corruption in case of unclean shutdown?

johan162 01-09-2009 02:33 AM

The databases I was referring to is that by default mysql (and some other db:s) stores the DB files under /var. Just in case you have some applications that use databases or other type of storages (Besides log files) that must survive a power-outage.

The async mounting option will give you performance boost but at significant risk (the risk is a little bit dependent on what FS you use). If your files are truly temporary, then by all means, go ahead. However, if you have some problems it might be very hard (or almost impossible) to restore the files. Even fsck might have substantial difficulties recovering a damaged structure since it is possible to have structural damages on the fs if you have the power outage at just the wrong time when you are running async.

(Having said all that I run /tmp mounted async on our main UPS backed up server - but then again I only use ext2 on the /tmp folder to keep the overhead as low as possible. In addition to help train our users /tmp is cleaned once every 14 days)

/J


All times are GMT -5. The time now is 03:34 PM.