6

I've got a Ubuntu system which is writing a block to disk every 1-2 seconds. Some kind of log accruing an error. How do I find which file it is?

I've been poring over lsof output and tailing suspects with no luck. Is there a way to find it, really find it?

1
  • What makes you think something is writing to the disk every 1 -2 seconds? Are you basing this off the drive LEDs? It can be very tricky to get Linux to minimize writes to the disk. Some disk flushes happen automatically every few seconds.
    – mfarver
    May 15, 2011 at 20:00

4 Answers 4

8

Maybe you can check which process is writing frequently to disk with iotop, then spy this process with strace.

1
  • yea, iotop, that's the ticket, looks like it's just jbd2 ....
    – qbxk
    May 14, 2011 at 21:52
6

You could use inotifywatch(1). Something like this should get you closer

inotifywatch -v -e modify  -r /root
1
  • Interesting. I was not familiar with that command.
    – ewwhite
    May 15, 2011 at 22:42
1

Besides the other answers, you could also try just using find / -mtime -1 to list files recently modified.

1

I've done iostat to find what disk was getting the access, then lsof|grep to find files, perhaps look at what looks like log files, filter out tcp or something.

You must log in to answer this question.