1

When I remove large files, then use df to check the disk usage, often it takes a noticeable amount of time to update the disk usage percentage appropriately.

This affects several data management scripts that are removing files until the system gets down to a specific percent of disk utilization.

I know it's easy to just throw a sleep in there, but I prefer to understand why the update takes a while.

So my questions are:

  1. Why does df take some time to update?
  2. Is there a better way to check disk utilization immediately after removing files (fvstat or something like it)?
  3. Any recommendations on how to manage this data better (it's a lot of data, stacking up pretty quick...)?

I'll be satisfied with an answer for any of the above questions.

System: QNX Neutrino 6.4.1, PDKSH
Commands: `rm -rf bigdatafiles*.tar` and `df -kP`
  • What filesystem are you using? btrfs? – psusi Jul 11 '13 at 18:04
  • @psusi Good question. The file system is QNX6. – kmort Jul 11 '13 at 18:51
  • How exactly are you removing the files (not just the commands but also how they are chained)? Is there a chance that another process may have the files open when you remove them? – Gilles Jul 11 '13 at 21:29
  • @Gilles Yes, there is a remote chance they might be open, and it does happen when none are open. The logger might be writing to one. The script uses find to dump all the file names that match the criteria to a file, then removes each with rm -fv 'cat $FILELIST'. They files are independent, large binary data files, though some small text logs are also removed this way. Normally, I don't see the effect unless it's a large file (bigger than 5 meg). Does this address the question of "how are they chained?" (Note that the backticks were removed, so I put single quotes as placemarks.) – kmort Jul 11 '13 at 22:17
  • With a normal unix, the only reason the disk space wouldn't appear as free as soon as rm returns is that open files are not actually deleted until they are closed. It's possible that QNX is doing something unusual. – Gilles Jul 11 '13 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.