# spinning down the harddrive (part 2) [solved]

## Sade

A while ago i started this topic about my harddrive not spinning down. I found the solution but it turns out that it is not a solution, here is the short version of the topic:

By default the hdparm setting for the APM of the drive is set to -B 254 which disables spindown, so setting it to a value lower than 128 will allow the drive to spin down.

The problem is that now my drive spins down to quickly and thus too often, it seems to ignore the hdparm -S 12 completely, i.e. the drive is spundown and parked every second, which will quicken drive ware.

I wan't my drive to spin down but not every second, as i see it there are two paths to follow

1) use the -B 127 setting and fix the too frequent spindown

2) use the -B 254 setting and fix that the drive will spindown

which one to follow? and how? any suggestions?

P.S.

- I've disabled swap,

- I don't use atime (i.e. use the noatime option in /etc/fstab) although i do see kjournald popping up every couple of seconds.

- lm-profiler lists a couple of deamons accessing the drive (see the earlier topic)

----------

## Sade

sorry, bump...

----------

## Sade

Bump again........

I still would like to control when and how my drives spin down, and I'm currently experimenting with laptop-mode-tools.

There are two processes that keep activating the hard drive: nmbd and syslog-ng

1)

I can stop syslog-ng, but i would rather like a less frequent syslog-ng config, only these syslog configs are difficult to wrap your head around. Is there an easy way?

2)

The machine is primarily a file server, so i need samba, is there a way to have nmbd access the drive less often?

----------

## francofallica

Just q quick idea. 

You could use a ramdisk for /var/log and write it to disk on shutdowns. Of course if your box crashes you won't have any logs about it. (may use a cron job to write the ramdisk to hdd periodically)

franco

----------

## Sade

seems like a good idea, you think most of the writes are in /var??

I'm thinking about:

mount /var on a tmpfs, and then tar the /var directory to a file every 12 hours, and on shutdown?

surprisingly the dir is 1.2GB, most of which is in /var/log/messages and /var/log/portage

mayb use rsync instead of tar

----------

## francofallica

/var/log is obviously where syslog writes its stuff. so there will be a lot of writes there. for nmbd I honestly have no clue.  But you could shut it down (or pause?) on some acpi event and reactive when needed.

----------

## aidanjt

nmbd writes it's own logs instead of going through syslog by default.  You can reconfigure samba to use syslog instead: http://www.samba.org/samba/docs/using_samba/ch06.html

If you don't have a problem with system crashes, you can make /var/log a tmpfs and do a daily logrotate to keep hard copies of them in your email.

----------

## Sade

I can see that nmbd is accessing the disk, but i don't see which file it is accessing, more specifically where.

To be clear: 

nmbd is accessing the /var/log directory?

because smb.conf only mentions the samba logs, and not the nmbd logs.

----------

## aidanjt

In /var/log/samba, yes.

----------

## Sade

I have this onboard SD card reader which i never use, and i have an old SD card from my phone,

put 2 and 2 together, and mounted /var on the SD card, now finally the drive spins down, as it is supposed to.

yes, i know the SD card will ware.

in conclusion to the first post:

The hdparm -B option should be set higher then 127, i.e. 254, or else the drive will spin down erratically.

----------

## aidanjt

Be aware that /var/tmp is where portage unpacks, and compiles tarballs.  /var in general is very write heavy.

----------

## Sade

mayb it is better then to just mount /var/log on the SD

----------

## aidanjt

That's what I would do.

----------

