I was wondering if there was a way to tell how many more "writes" are left on a file system device in linux? An example: when you move a lot of data to a flash drive, it may not write all data immediately. In this case, I would like to see (preferably) how much more is left to write, or even if it's a flag (such as 0 = writes complete or 1 = writes remain). Is there a particular command or file that holds that information?
2 Answers
Might be useful the following utilities:
lsof
dstat
.
Finally, you can force pending writes to be flush to the HDD subsystem with sync
CLI command.
-
I knew about the sync
sync
command, which is helpful but I want to be able to see when something needs to be "synced". Bothlsof
anddstat
are helpful, but seem to be a little too broad (not specific enough) for what I'm looking for... Dec 1, 2011 at 15:56
You can find out how many kilobytes globally are waiting to be written, contained in "dirty" pages, however I don't know how to do this for individual devices.
grep Dirty /proc/meminfo
There are tunables in /proc/sys/vm and /sys/block/${dev_name} which can affect how rapidly dirty pages are written out; usually, they are modified by software like laptop-mode-tools.