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?

Peter Mortensen
  • 2,318
  • 5
  • 23
  • 24
  • 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 '11 at 20:00

4 Answers4

8

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

Cédric Julien
  • 391
  • 6
  • 12
6

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

inotifywatch -v -e modify  -r /root
1

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

Zach Kelling
  • 374
  • 3
  • 5
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.

lsd
  • 1,673
  • 10
  • 10