Page 1 of 2

Hard drive spin down prevented by webmin & samba

Posted: September 4th, 2011, 1:52 pm
by bradburts
Hi,
I have configured Ubuntu to power down disks when idle.
This works except every hour or so the disks power up. I have not investigated this yet.
I have now installed Samba and Webmin.
I cannot get my disks to idle at all now.

Webmin's miniserv.pl writes to /etc/webmin/miniserv.conf every 20 seconds or so.
I am fairly sure that the server is writting as I mounted root with noatime and the writes still happen, its not a read refresh causing a write then.
Checking modification times and I find that Samba writes to /var/cache/samba/browse.dat every 10 min or so.

How am I going to stop these writes?
I suppose that I could install the OS onto a flash card and partition most of the data to the harddrives.
I wanted a RAID system though and so how am I going to stop the writes?

Re: Hard drive spin down prevented by webmin & samba

Posted: September 4th, 2011, 5:57 pm
by Ian
Hi bradburts and welcome to the forums.

Are you trying to spin down your main OS drive? I've never tried doing that due to the constant log-writing that takes place. I've little experience with trying to suppress these logs so cannot offer any great insight I'm afraid. My OS drive spins 24/7 it's only the "data drives" that are spundown.

Or are you referring to drives in your machine other than the main OS drive? If so, I don't believe webmin or samba cause that (other than other devices on my network keeping the drives awake when connected via samba)

I'd be tempted to follow your suggestion and implement the OS onto something other than a data drive. Or maybe install FlexRAID? With FlexRAID you can RAID just the data you need to protect rather than the whole drive and thus not RAID the logs.

Sorry I can't be more helpful in solving your issue :cry:

Ian.

Re: Hard drive spin down prevented by webmin & samba

Posted: September 5th, 2011, 10:54 am
by bradburts
Thanks for the reply.
Yes, the disk contains the OS.
I have two disks in a RAID array. I wanted my system to be low power and so minimised disks. Doh.
I think that this issue would also be very relevant to those with their OS on a flash drive.
From my experience of embedded systems you want to avoid writes to flash devices especially writes to file systems. Problem is if power fails and then you are more likely to corrupt your whole FS than with a hard drive, but you can corrupt a hard drive mid write as well of course. For example XP Embedded has an Enhanced Write Filter to prevent OS logs for this reason. Enhanced as the first Write Filter did not work so well......

I am not too worried about logs as I could create a RAM disk for the regular logs, don't mind lossing those.
Suppose there are two ways that you could help;
1) Do you know what webmin is upto and how to stop or slow it?
2) Are you able to show me how to add startup script before webmin starts. I would create a RAM disk, copy the webmin file to RAM disk. I would then need a shutdown script to persist the webmin file. I could also cron a compare between RAM and persistant files and copy if it has really changed.
My bash is hopeless though and I am also not sure where startup and shutdown scripts go.
I am trying to get upto speed with bash, and whilst I consider myself a good programmer, I'm struggling to decode the examples I have!

Re: Hard drive spin down prevented by webmin & samba

Posted: September 5th, 2011, 7:34 pm
by Ian
Hi bradburts, from reading your posts you sound a lot more experienced with linux than me so I'm afraid I'm unable to offer you any pearls of wisdom. Infact I'd go as far as to say I'm tempted to pick your brains for help on things I'm stuck on :lol:

On my server I can see that Webmin starts very late in the boot process (level 99 when you issue the ls -l /etc/rc2.d command) so you just need to get your script to start with a lower number than that.

If you google for "update-rc.d" there are some good links which might help you.

Sorry to be such a let-down :oops:

Ian.

Re: Hard drive spin down prevented by webmin & samba

Posted: September 6th, 2011, 10:01 am
by bradburts
Well flattery will get you everywhere.
I don't have much Linux experience actually, mostly windows stuff.
Suppose I was expecting this issue had a quick solution as power saving should be a big thing for us all these days.

Thanks for the tip though, that shows me how to modify the startup process. Off to learn bash!

Re: Hard drive spin down prevented by webmin & samba

Posted: September 6th, 2011, 11:47 am
by Ian
I agree with you that power saving should be an issue for all of us. However, I do fear that trying to get the OS to spin-down and more importantly stay down is a challenge that will get the better of you (talk about laying down the gauntlet! :twisted: )

Modern SATA drives (the green ones) use around 3 watts on idle so at best you'll save 3 watts. At worst it'll cost you more if the drive keeps spinning back up again, plus of course the possibility of premature drive failure due to the constant stop-start cycles (a controversial topic).
Better efficiency gains can be had by buying efficient components (my server uses less than any desktop I've ever owned, yet is far more powerful).

If your server really is going to be used that infrequently have you considered using WOL?

Ian.

Re: Hard drive spin down prevented by webmin & samba

Posted: September 6th, 2011, 7:10 pm
by fpp
That's the reason (at least the rational one :-) I went with an SSD for the system disk.

However, I'm still having a strange problem with the regular hard drives (DRU and PPU).

If I spin them down explicitly (with hdparm -y), they now stay that way (thanks to your tip in another thread).

But setting a spindown timeout, either in hdparm.conf or explicitly (with hdparm -S) does not seem to do anything.
Every morning I find them all spinning, after being awakened by the nightly flexRAID update.

Even stranger, a few times I found one or two of the four on standby, not always the same ones, and never all of them.

That particular issue could be cured with a spindown script in cron, but it wouldn't do anything for regular use, and such un-derterministic behaviour bothers me...

Re: Hard drive spin down prevented by webmin & samba

Posted: September 6th, 2011, 10:09 pm
by Ian
Hi fpp, I agree that would bother me as well. Are your drives all the same make and model?

As a test maybe you could attach a screen and keyboard to your server and then remove the network cable. Then monitor spindown and if everything spins down nicely, and stays spun down, then you know the issue is network related rather than being either your OS or an installed app.

Obviously if your server is within earshot then you should be able to hear the drives spinning up and down and so don't need to connect the screen or keyboard just remove the network cable.

You've reminded me of the time when I had a NAS and the drives used to keep spinning up and down randomly. Turned out that when I had the DLNA server enabled it performed "housekeeping" which woke up the drives from time to time. :roll:

Ian.

Re: Hard drive spin down prevented by webmin & samba

Posted: September 7th, 2011, 10:33 pm
by fpp
Ian, maybe I wasn't quite clear in the previous post, but that issue you mention doesn't exist anymore : once my drives are spun down, they stay that way until some cron process intentionally activates them (like a FlexRAID nightly parity update).

The remaining issue is that they will not spin down automatically after setting a timeout with hdparm, or very erratically.

Last night I reset the timeout value on all four drives (hdparm -S 240), then spun them down manually (hdparm -y).
They were activated later by FlexRAID for its update. In the morning I found two on standby (DRU1 and DRU3), and two active (DRU2 and PPU0). Other times they are all active, or one on standby, etc. Very puzzling.

All drives are new, same make & model (Samsung F4).

Re: Hard drive spin down prevented by webmin & samba

Posted: September 7th, 2011, 11:05 pm
by Ian
Ah ok, I understand you now. I've been having too many conversations with too many people and can't remember who had what issues :roll:

I'm afraid I can't offer an explanation for the behaviour you're seeing.

I wonder whether it's a FlexRAID problem? Are the active drives ones that had changed data on them?
Did anything connect to those drives overnight (a streamer updating it's library perhaps?)

I'm purely throwing ideas into the mix here, I'm not aware of any problems with FlexRAID, merely trying to rack my brains as to what might be causing it. :?

Ian.