testTester
testTester

Reputation: 2649

Monitoring files that are being deleted

I would like help on how to find out what process/user is deleting images in a Linux filesystem folder. So, e.g., given a folder in which files are being deleted randomly, identify what deletes them.

More precisely, my problem is:

  1. I have a folder with around 1 million images.
  2. They sit in folder structure, e.g.: all images start with the name "abaco.jpg" sit inside the "media/a/b/abaco.jpg" path. These images are uploaded via back-end and, supposedelly, never deleted after that.
  3. In this specific client, hosted in this specific infrastructure, images are being deleted randomly. When we realise, entire folders of images are missing, e.g.: huge chunks or entire folders are deleted. I estimate around 20% every time.
  4. Currently we then restore a backup, but ideally we would find out what's deleting them in the first place. Hosting company says their NAS backup is running well and have no problems or other suspect processes, but there's no process on our end that deletes images.
  5. How can I start troubleshooting this as to find what is going on?

Some other information:

Any ideas on how to start debugging such problem?

Thanks.

Upvotes: 0

Views: 1175

Answers (1)

Suraj N
Suraj N

Reputation: 98

May be you can use the iwatch to watch for any changes in a directory

Or install inotifywait on the system and use it to wait for notifications for a directory by logging its output to a file

inotifywait -m -r -e delete dir_name

and log the above to a file to check how it goes.

Normally its very hard to exactly check who and when deletes a files as for most of the part that file is gone.

Upvotes: 2

Related Questions