LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   HDD spindown info as normal user (script) (https://www.linuxquestions.org/questions/linux-server-73/hdd-spindown-info-as-normal-user-script-4175486542/)

benjalien 12-02-2013 07:31 AM

HDD spindown info as normal user (script)
 
Hi all,

I'm trying to monitor my HDD spin state: are they running or idle.
I have a build a small script using hdparm, but it needs to be run as root, wich is absolutely not an option.

Does someone know how I could get this info a normal user? Some cat /proc/something?

Thanks!

Benjamin

druuna 12-03-2013 03:11 AM

Did you have a look at /sys/block/sd?/device/?

state might be of interest to you.

benjalien 12-03-2013 03:29 AM

Thanks!
 
Thanks a lot, indeed it looks like what I'm looking for :)

Now I just need to find out what are the different states...

druuna 12-03-2013 03:46 AM

Quote:

Originally Posted by benjalien (Post 5074449)
Thanks a lot, indeed it looks like what I'm looking for :)

Now I just need to find out what are the different states...

running is one (confirmed) and I do believe offline is another one (cannot confirm that atm).

benjalien 12-03-2013 04:27 AM

Well, I think I rejoyed too quickly... :(

root@raid:/home/benjalien# cat /sys/block/sdf/device/state
running
root@raid:/home/benjalien# hdparm -C /dev/sdf

/dev/sdf:
SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
drive state is: standby

One command is giving "standby" and the other "running" :'(


All times are GMT -5. The time now is 06:36 PM.