Whenever I write a large file to a USB drive, write caching makes it very difficult to track process. I can disable it in various ways like echo 1000000 > /proc/sys/vm/dirty_bytes
which solves the problem. However then I also have to re-enable the old setting (or reboot).
How can I tell my system to bypass the dirty bytes entirely for a single write command? For example, something like:
DIRTYBYTES=nope pv file.bin > /dev/sdb1
Or
pv file.bin | cache_buster > /dev/sdb1
To clarify: The current behavior of pv file.bin > /dev/sdb1
is that the meter shoots to 100% immediately, and then the command hangs waiting for the USB to actually finish writing. Instead, I want to modify the command and make the meter gradually increase at about the correct write rate of the USB drive, without altering the dirty bytes etc settings in such a way that the next command will also bypass the cache.
cat 1000000 > /proc/sys/vm/dirty_bytes
, what does the file named1000000
contain ? – Paul_Pedant Nov 22 '21 at 09:29