I have an external drive connected to my computer, I want this drive to be in sleep mode unless i'm executing some backup tool.
For some reason, after 14 minutes I think, the hard drive always wakes up.
** edit **
i tried the following things:
btrace /dev/myexternal- to see which system call calls my external hard drive. unfortunately at the moment my hd wakes up I don't see any call.
fuser /dev/myexternal - to see which processes use this hd.
lsof - to see if there are files which has accessed.
mount the external drive manually to /mnt
stop lightdm and several processes/services.
How can I find which process wakes the hard drive?
More then likely your file manager or desktop enviroment is "scanning" the drive for indexing.
You can stop this by unmounting the drive when not in use, then mounting, backup, unmounting when you need to backup.
Other then that you can use tools like lsof to see what processes have files open on the drive. But this is can be very hit or miss, as the access that cause wake may be nothing more then a "Are you still there?" from the kernel.
To use lsof and not go crazy:
lsof | grep /media/external
changing the path to your mount point of course.
I Really recommend unmounting though if you don't want the drive to be in use.