What makes my disk spin? [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1
















This question already has an answer here:



  • hard disks spin up by processes / applications that simply get a list of disks? How to prevent?

    2 answers




TL;DR Is there a way under Linux to know which file access caused an hard disk to
spin up?




Full story My laptop has a NVME disk, which contains the operating system and my home dir, and a spinning hard disk, which contains a second home dir which I use to store bulk data that do not fit on the NVME. I believe it is a common arrangement.



One of the nice things is this layout is that when I am not working on the projects that require files on the spinning disk, the disk itself can spin down, saving on energy, battery time, noise, etc. And this happens quite frequently.



However, every now and then the hard disk spins up even if what I am doing in that moment has no clear link with data that are stored there. It is still a consequence of an action done by me, not of a cron script or something else, because it still happens as a consequence of my doing something, like opening an application. However I cannot see what opening that application should produce an access to the spinning disk, knowing which file are supposed to be there. So I would like to understand more of what happens, and this justifies the question above.










share|improve this question













marked as duplicate by Stephen Kitt, Christopher, Jeff Schaller, Scott, slm Feb 21 at 13:09


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • Technically that question is on how to prevent spinning up, while mine is how to diagnose what is causing the spinning up. I admit that they are very related.

    – Giovanni Mascellani
    Feb 20 at 18:02











  • The answer explains how to trace the origin of disk activity.

    – Stephen Kitt
    Feb 20 at 19:05











  • Ok. Is it possible to mark the question as duplicate or already answered, while at the same time copying my own answer to the other question? I found a different answer, and I think it might be useful to keep it.

    – Giovanni Mascellani
    Feb 21 at 9:30











  • It should be possible, I’ve asked a moderator to do so. (Non-moderators can mark the question as already answered, but can’t move the answer. You could move your answer manually, by deleting it here and adding it to the target question, but you’d lose your upvote.)

    – Stephen Kitt
    Feb 21 at 9:34















1
















This question already has an answer here:



  • hard disks spin up by processes / applications that simply get a list of disks? How to prevent?

    2 answers




TL;DR Is there a way under Linux to know which file access caused an hard disk to
spin up?




Full story My laptop has a NVME disk, which contains the operating system and my home dir, and a spinning hard disk, which contains a second home dir which I use to store bulk data that do not fit on the NVME. I believe it is a common arrangement.



One of the nice things is this layout is that when I am not working on the projects that require files on the spinning disk, the disk itself can spin down, saving on energy, battery time, noise, etc. And this happens quite frequently.



However, every now and then the hard disk spins up even if what I am doing in that moment has no clear link with data that are stored there. It is still a consequence of an action done by me, not of a cron script or something else, because it still happens as a consequence of my doing something, like opening an application. However I cannot see what opening that application should produce an access to the spinning disk, knowing which file are supposed to be there. So I would like to understand more of what happens, and this justifies the question above.










share|improve this question













marked as duplicate by Stephen Kitt, Christopher, Jeff Schaller, Scott, slm Feb 21 at 13:09


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • Technically that question is on how to prevent spinning up, while mine is how to diagnose what is causing the spinning up. I admit that they are very related.

    – Giovanni Mascellani
    Feb 20 at 18:02











  • The answer explains how to trace the origin of disk activity.

    – Stephen Kitt
    Feb 20 at 19:05











  • Ok. Is it possible to mark the question as duplicate or already answered, while at the same time copying my own answer to the other question? I found a different answer, and I think it might be useful to keep it.

    – Giovanni Mascellani
    Feb 21 at 9:30











  • It should be possible, I’ve asked a moderator to do so. (Non-moderators can mark the question as already answered, but can’t move the answer. You could move your answer manually, by deleting it here and adding it to the target question, but you’d lose your upvote.)

    – Stephen Kitt
    Feb 21 at 9:34













1












1








1


1







This question already has an answer here:



  • hard disks spin up by processes / applications that simply get a list of disks? How to prevent?

    2 answers




TL;DR Is there a way under Linux to know which file access caused an hard disk to
spin up?




Full story My laptop has a NVME disk, which contains the operating system and my home dir, and a spinning hard disk, which contains a second home dir which I use to store bulk data that do not fit on the NVME. I believe it is a common arrangement.



One of the nice things is this layout is that when I am not working on the projects that require files on the spinning disk, the disk itself can spin down, saving on energy, battery time, noise, etc. And this happens quite frequently.



However, every now and then the hard disk spins up even if what I am doing in that moment has no clear link with data that are stored there. It is still a consequence of an action done by me, not of a cron script or something else, because it still happens as a consequence of my doing something, like opening an application. However I cannot see what opening that application should produce an access to the spinning disk, knowing which file are supposed to be there. So I would like to understand more of what happens, and this justifies the question above.










share|improve this question















This question already has an answer here:



  • hard disks spin up by processes / applications that simply get a list of disks? How to prevent?

    2 answers




TL;DR Is there a way under Linux to know which file access caused an hard disk to
spin up?




Full story My laptop has a NVME disk, which contains the operating system and my home dir, and a spinning hard disk, which contains a second home dir which I use to store bulk data that do not fit on the NVME. I believe it is a common arrangement.



One of the nice things is this layout is that when I am not working on the projects that require files on the spinning disk, the disk itself can spin down, saving on energy, battery time, noise, etc. And this happens quite frequently.



However, every now and then the hard disk spins up even if what I am doing in that moment has no clear link with data that are stored there. It is still a consequence of an action done by me, not of a cron script or something else, because it still happens as a consequence of my doing something, like opening an application. However I cannot see what opening that application should produce an access to the spinning disk, knowing which file are supposed to be there. So I would like to understand more of what happens, and this justifies the question above.





This question already has an answer here:



  • hard disks spin up by processes / applications that simply get a list of disks? How to prevent?

    2 answers







hard-disk monitoring






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 20 at 6:34









Giovanni MascellaniGiovanni Mascellani

314110




314110




marked as duplicate by Stephen Kitt, Christopher, Jeff Schaller, Scott, slm Feb 21 at 13:09


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Stephen Kitt, Christopher, Jeff Schaller, Scott, slm Feb 21 at 13:09


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Technically that question is on how to prevent spinning up, while mine is how to diagnose what is causing the spinning up. I admit that they are very related.

    – Giovanni Mascellani
    Feb 20 at 18:02











  • The answer explains how to trace the origin of disk activity.

    – Stephen Kitt
    Feb 20 at 19:05











  • Ok. Is it possible to mark the question as duplicate or already answered, while at the same time copying my own answer to the other question? I found a different answer, and I think it might be useful to keep it.

    – Giovanni Mascellani
    Feb 21 at 9:30











  • It should be possible, I’ve asked a moderator to do so. (Non-moderators can mark the question as already answered, but can’t move the answer. You could move your answer manually, by deleting it here and adding it to the target question, but you’d lose your upvote.)

    – Stephen Kitt
    Feb 21 at 9:34

















  • Technically that question is on how to prevent spinning up, while mine is how to diagnose what is causing the spinning up. I admit that they are very related.

    – Giovanni Mascellani
    Feb 20 at 18:02











  • The answer explains how to trace the origin of disk activity.

    – Stephen Kitt
    Feb 20 at 19:05











  • Ok. Is it possible to mark the question as duplicate or already answered, while at the same time copying my own answer to the other question? I found a different answer, and I think it might be useful to keep it.

    – Giovanni Mascellani
    Feb 21 at 9:30











  • It should be possible, I’ve asked a moderator to do so. (Non-moderators can mark the question as already answered, but can’t move the answer. You could move your answer manually, by deleting it here and adding it to the target question, but you’d lose your upvote.)

    – Stephen Kitt
    Feb 21 at 9:34
















Technically that question is on how to prevent spinning up, while mine is how to diagnose what is causing the spinning up. I admit that they are very related.

– Giovanni Mascellani
Feb 20 at 18:02





Technically that question is on how to prevent spinning up, while mine is how to diagnose what is causing the spinning up. I admit that they are very related.

– Giovanni Mascellani
Feb 20 at 18:02













The answer explains how to trace the origin of disk activity.

– Stephen Kitt
Feb 20 at 19:05





The answer explains how to trace the origin of disk activity.

– Stephen Kitt
Feb 20 at 19:05













Ok. Is it possible to mark the question as duplicate or already answered, while at the same time copying my own answer to the other question? I found a different answer, and I think it might be useful to keep it.

– Giovanni Mascellani
Feb 21 at 9:30





Ok. Is it possible to mark the question as duplicate or already answered, while at the same time copying my own answer to the other question? I found a different answer, and I think it might be useful to keep it.

– Giovanni Mascellani
Feb 21 at 9:30













It should be possible, I’ve asked a moderator to do so. (Non-moderators can mark the question as already answered, but can’t move the answer. You could move your answer manually, by deleting it here and adding it to the target question, but you’d lose your upvote.)

– Stephen Kitt
Feb 21 at 9:34





It should be possible, I’ve asked a moderator to do so. (Non-moderators can mark the question as already answered, but can’t move the answer. You could move your answer manually, by deleting it here and adding it to the target question, but you’d lose your upvote.)

– Stephen Kitt
Feb 21 at 9:34










1 Answer
1






active

oldest

votes


















1














auditd can be used to monitor Linux syscalls, and it support filtering according to the involved device. The following instructions are for a Debian system, but others will probably be very similar.



First install and start auditd:



# apt-get install auditd
# service auditd start


Then find the major and minor device number of the device you want to monitor, /dev/sda in my case:



# ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 feb 17 09:58 /dev/sda


So 8 is the major and 0 is the minor. At last, create and auditd rule like this:



# auditctl -a always,exit -F devmajor=8 -F devminor=0


Now look at /var/log/audit/audit.log, where all file accesses will be logged. This might help to find which process is causing the hard disk to spin up.



The log is probably very verbose and might fill up the disk quite quickly. Once you're done, you can shut down auditd:



# service auditd stop





share|improve this answer























  • I'm not familier with this tool, and acorrding to you it logs Linux syscalls, but as long as I know there is no syscall for spining the disk... When the OS noticed that the page or section of the wanted data is not in the main memory it brings it from the device using its driver, and its the internal device hardware that determine if to spin the disk. Am I wrong?

    – Z E Nir
    Feb 20 at 8:02











  • Yes. The point of my answer is to understand what syscall caused the data to be fetched in the first place.

    – Giovanni Mascellani
    Feb 20 at 18:03

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














auditd can be used to monitor Linux syscalls, and it support filtering according to the involved device. The following instructions are for a Debian system, but others will probably be very similar.



First install and start auditd:



# apt-get install auditd
# service auditd start


Then find the major and minor device number of the device you want to monitor, /dev/sda in my case:



# ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 feb 17 09:58 /dev/sda


So 8 is the major and 0 is the minor. At last, create and auditd rule like this:



# auditctl -a always,exit -F devmajor=8 -F devminor=0


Now look at /var/log/audit/audit.log, where all file accesses will be logged. This might help to find which process is causing the hard disk to spin up.



The log is probably very verbose and might fill up the disk quite quickly. Once you're done, you can shut down auditd:



# service auditd stop





share|improve this answer























  • I'm not familier with this tool, and acorrding to you it logs Linux syscalls, but as long as I know there is no syscall for spining the disk... When the OS noticed that the page or section of the wanted data is not in the main memory it brings it from the device using its driver, and its the internal device hardware that determine if to spin the disk. Am I wrong?

    – Z E Nir
    Feb 20 at 8:02











  • Yes. The point of my answer is to understand what syscall caused the data to be fetched in the first place.

    – Giovanni Mascellani
    Feb 20 at 18:03















1














auditd can be used to monitor Linux syscalls, and it support filtering according to the involved device. The following instructions are for a Debian system, but others will probably be very similar.



First install and start auditd:



# apt-get install auditd
# service auditd start


Then find the major and minor device number of the device you want to monitor, /dev/sda in my case:



# ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 feb 17 09:58 /dev/sda


So 8 is the major and 0 is the minor. At last, create and auditd rule like this:



# auditctl -a always,exit -F devmajor=8 -F devminor=0


Now look at /var/log/audit/audit.log, where all file accesses will be logged. This might help to find which process is causing the hard disk to spin up.



The log is probably very verbose and might fill up the disk quite quickly. Once you're done, you can shut down auditd:



# service auditd stop





share|improve this answer























  • I'm not familier with this tool, and acorrding to you it logs Linux syscalls, but as long as I know there is no syscall for spining the disk... When the OS noticed that the page or section of the wanted data is not in the main memory it brings it from the device using its driver, and its the internal device hardware that determine if to spin the disk. Am I wrong?

    – Z E Nir
    Feb 20 at 8:02











  • Yes. The point of my answer is to understand what syscall caused the data to be fetched in the first place.

    – Giovanni Mascellani
    Feb 20 at 18:03













1












1








1







auditd can be used to monitor Linux syscalls, and it support filtering according to the involved device. The following instructions are for a Debian system, but others will probably be very similar.



First install and start auditd:



# apt-get install auditd
# service auditd start


Then find the major and minor device number of the device you want to monitor, /dev/sda in my case:



# ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 feb 17 09:58 /dev/sda


So 8 is the major and 0 is the minor. At last, create and auditd rule like this:



# auditctl -a always,exit -F devmajor=8 -F devminor=0


Now look at /var/log/audit/audit.log, where all file accesses will be logged. This might help to find which process is causing the hard disk to spin up.



The log is probably very verbose and might fill up the disk quite quickly. Once you're done, you can shut down auditd:



# service auditd stop





share|improve this answer













auditd can be used to monitor Linux syscalls, and it support filtering according to the involved device. The following instructions are for a Debian system, but others will probably be very similar.



First install and start auditd:



# apt-get install auditd
# service auditd start


Then find the major and minor device number of the device you want to monitor, /dev/sda in my case:



# ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 feb 17 09:58 /dev/sda


So 8 is the major and 0 is the minor. At last, create and auditd rule like this:



# auditctl -a always,exit -F devmajor=8 -F devminor=0


Now look at /var/log/audit/audit.log, where all file accesses will be logged. This might help to find which process is causing the hard disk to spin up.



The log is probably very verbose and might fill up the disk quite quickly. Once you're done, you can shut down auditd:



# service auditd stop






share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 20 at 7:42









Giovanni MascellaniGiovanni Mascellani

314110




314110












  • I'm not familier with this tool, and acorrding to you it logs Linux syscalls, but as long as I know there is no syscall for spining the disk... When the OS noticed that the page or section of the wanted data is not in the main memory it brings it from the device using its driver, and its the internal device hardware that determine if to spin the disk. Am I wrong?

    – Z E Nir
    Feb 20 at 8:02











  • Yes. The point of my answer is to understand what syscall caused the data to be fetched in the first place.

    – Giovanni Mascellani
    Feb 20 at 18:03

















  • I'm not familier with this tool, and acorrding to you it logs Linux syscalls, but as long as I know there is no syscall for spining the disk... When the OS noticed that the page or section of the wanted data is not in the main memory it brings it from the device using its driver, and its the internal device hardware that determine if to spin the disk. Am I wrong?

    – Z E Nir
    Feb 20 at 8:02











  • Yes. The point of my answer is to understand what syscall caused the data to be fetched in the first place.

    – Giovanni Mascellani
    Feb 20 at 18:03
















I'm not familier with this tool, and acorrding to you it logs Linux syscalls, but as long as I know there is no syscall for spining the disk... When the OS noticed that the page or section of the wanted data is not in the main memory it brings it from the device using its driver, and its the internal device hardware that determine if to spin the disk. Am I wrong?

– Z E Nir
Feb 20 at 8:02





I'm not familier with this tool, and acorrding to you it logs Linux syscalls, but as long as I know there is no syscall for spining the disk... When the OS noticed that the page or section of the wanted data is not in the main memory it brings it from the device using its driver, and its the internal device hardware that determine if to spin the disk. Am I wrong?

– Z E Nir
Feb 20 at 8:02













Yes. The point of my answer is to understand what syscall caused the data to be fetched in the first place.

– Giovanni Mascellani
Feb 20 at 18:03





Yes. The point of my answer is to understand what syscall caused the data to be fetched in the first place.

– Giovanni Mascellani
Feb 20 at 18:03


Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay