LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-30-2012, 07:41 PM   #1
farnsy
LQ Newbie
 
Registered: Nov 2008
Location: Pennsylvania
Distribution: Fedora 19
Posts: 24

Rep: Reputation: 2
Ssh spins up all file server hard drives. Any ideas on why? (hdparm related)


I have a home file server (i.e., NAS) running Ubuntu 12.04 minimal. The system disk and home directories are on a USB flash drive and there are 6 spinning hard drives containing my data (They are separate disks, not configured for RAID). They are connected to SATA ports on my motherboard. Most of them get little regular use, so I keep the rotating disks spun down (i.e., I use hdparm to spin them down after an hour of inactivity). Whenever I try and read from one of them (generally over samba) it spins up without waking the other 5. That's just what I want.

Everything works great except that if I wait a few days and then ssh into the server, for some reason all 6 rotating disks spin up (the login takes a long time while it waits for them) despite the fact that I have not tried to access any of them. If I then spin them down (or let them spin down using the timeout) and then ssh in again, they do not spin up unless I try and access them, which is the behavior I want.

A few more specifics of my system, in case they matter:

* I do run apache, with all the apache content on the USB drive (available only to the LAN). I don't think it should be touching my data drives.

* I login to ssh using asymmetric key authentication. The .ssh directory is in my home directory, which is on the USB flash drive.

* I have a .hushlogin file in my home directory, so there's no message of the day or anything. Actually I'm not sure all of what .hushlogin does.

* My shell is bash.

* None of the data drives or their subdirectories is in my path.

* I can only test this once a day at most (probably less frequently than that) because if it hasn't been too long, there is no problem on login (i.e., none of the drives feel compelled to spin up unless they are actually desired.

* I do have to log in to this server relatively frequently as this is how I connect to my home box from outside the network (that is, I connect to my file server, which is always on, and run a script on it that wakes my regular box, then ssh to the regular box).

Do you have any ideas on what is causing the wakeup signal to be sent to all those drives? Or if there's a log file that is likely to have information on what happened, that would be a great start.

Last edited by farnsy; 09-30-2012 at 07:51 PM.
 
Old 09-30-2012, 08:40 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
Interesting. I wonder if spin-ups are controlled by the kernel or by user land? The "vm.block_dump" sysctl dumps inode nfo to syslog, can't remember if it logs device names as well though, and logging syscalls could be done using the audit service. Logging to disk needs syscalls too so at first best limit any rule to stat.* and read I think.
 
Old 09-30-2012, 11:22 PM   #3
farnsy
LQ Newbie
 
Registered: Nov 2008
Location: Pennsylvania
Distribution: Fedora 19
Posts: 24

Original Poster
Rep: Reputation: 2
Sorry, some of that went above my head. Tell me if I'm on the right track:

I tailed /var/log/syslog and the last entry was a couple of weeks ago although I experienced the spinup issue just now, so I don't think it's being logged there. I assume that's what you were referring to.

When one connects by ssh, what things happen? It should just be .profile, .bashrc, /etc/bash.bashrc, right?

Is there a sleep state (computerwide) that might be happening and when it wakes, it also spins up the drives? Shot in the dark, here.

I need to test whether it also happens when it log in with a password. I'll test tomorrow.
 
Old 10-01-2012, 12:27 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
Quote:
Originally Posted by farnsy View Post
I tailed /var/log/syslog and the last entry was a couple of weeks ago although I experienced the spinup issue just now, so I don't think it's being logged there. I assume that's what you were referring to.
If your last syslog entry was from weeks ago then you've edited your system logging to be even less than minimalistic I suppose? And no unless you explicitly 'sysctl -w vm.block_dump=1' it won't show anything as it's more of a debugging tool.


Quote:
Originally Posted by farnsy View Post
When one connects by ssh, what things happen? It should just be .profile, .bashrc, /etc/bash.bashrc, right?
In short I'd say: connection stream arrives, kernel hands request to sshd, which does handshaking, accepts connection and forks [priv] child, which forks ssh login under the users UID, which forks the users shell.
 
Old 10-13-2012, 09:30 AM   #5
farnsy
LQ Newbie
 
Registered: Nov 2008
Location: Pennsylvania
Distribution: Fedora 19
Posts: 24

Original Poster
Rep: Reputation: 2
I've been working on a new hypothesis and so far it seems to have worked (I'd like to check if it's even reasonable, though, in case it has been a coincidence):

The system drive is a USB flash drive, so I was thinking maybe the issue had to do with a USB suspend function (the computer itself never goes to sleep that I've seen). I was thinking maybe when I try and ssh in and the system drive (and my home directory) is not available a more general wakeup command got issued that affected the spinning drives.

To check this I pass usbcore.autosuspend=-1 to the kernel at boot. I've only been able to check the computer a few times since then, but each time the computer was working correctly and no time did it make me wait nor spin up all the SATA drives.

Do you think this is a coincidence, or can you imagine my hypothesis being correct? Somehow I thought USB suspend functions worked at a much higher frequency (like, a few seconds after last use) but until recently I had never even heard of USB suspend, so I'm by no means an expert on the subject.

Last edited by farnsy; 10-13-2012 at 09:37 AM.
 
  


Reply

Tags
hdparm, ssh, ubuntu 12.04


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh and Miscl server related issues puk007 Linux - Server 9 12-02-2010 10:44 AM
Can SME server or CentOS server use the 1Tb or 1.5 Tb sata hard drives? mindsgoneawol Linux - Hardware 3 10-18-2008 08:00 PM
Slow hdparm, memtest86-- hardware related? coldrecd Linux - Hardware 4 02-06-2007 11:39 AM
hdparm and Sata drives? Darkvater Linux - Hardware 3 02-17-2005 07:07 AM
hdparm -tT not working for my cd drives LavaDevil94 Linux - Hardware 11 05-01-2004 07:53 PM


All times are GMT -5. The time now is 08:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration