You are not logged in.

#1 2016-01-25 15:37:33

hachel
Member
Registered: 2011-05-03
Posts: 25

Log if and when external hard disk gets woken up

Hi there,

I have an external usb hard drive whose sleep cycle I set with this udev rule:

ACTION=="add", SUBSYSTEM=="block", KERNEL=="sda", RUN+="/usr/bin/hdparm -S 180 /dev/sda"

Now occasionally it get's woken up without me activly doing anything at my pc. Is it possible to identify the process thats wakes it up or at least see at what exact times it gets woken up and/or goes to sleep?

thanks in advance,

hachel

Offline

#2 2016-01-26 16:32:33

hachel
Member
Registered: 2011-05-03
Posts: 25

Re: Log if and when external hard disk gets woken up

It would already help if someone could tell me how I could monitor in real time if the hard drive gets woken up or goes to sleep (like checking the output of hdparm -C every 10 seconds, but sometimes hdparm -C wakes up my harddrive in the first place).

Offline

#3 2016-01-26 17:17:38

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: Log if and when external hard disk gets woken up

The only thing coming to my mind is

blktrace -d /dev/sdx -o - | blkparse -i -

This simply prints all I/O operations to the device, together with names of requesting processes. It seems that blktrace is in AUR.

Offline

#4 2016-01-26 18:38:09

hachel
Member
Registered: 2011-05-03
Posts: 25

Re: Log if and when external hard disk gets woken up

ok that's something, thanks! Is it safe though? Or do I risk something, like data corruption or similar?

Offline

#5 2016-01-26 18:42:35

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: Log if and when external hard disk gets woken up

Should be safe. It just asks the kernel what operations are currently being performed and prints them.

Offline

Board footer

Powered by FluxBB