Sometimes on Linux, when you copy alot of data to a slow USB flash drive, the operation is “done” in a second, but when you umount the drive (or run ‘sync’) it takes forever to write the cache to the actual device.
So, how to check the status (how much time is left, how much does it still need to write)?
The answer hides in
/proc/meminfo. Specifically the “
Dirty” and “
Writeback” lines in that virtual file. Very simplified, the “
Dirty” value tells you how much data is waiting in cache, and the “
Writeback” tells you how much data is being currently written to the device (chunk size).
You can check both values in semi-realtime with the following command:
watch "egrep -e '(Dirty:|Writeback:)' /proc/meminfo"
I have a Thinkpad X250 laptop (Core i7 5600U CPU) with integrated graphics. When I watch video, in some cases (usually window mode + flash player) causes very noticable video tearing effect (almost like interlacing). It usually didn’t bother me (I mostly watch video fullscreen, where there is no tearing).
And the fix? More obvious then i though. Create a file /etc/X11/xorg.conf.d/15-intel.conf with this inside:
Identifier "Intel Graphics"
Option "TearFree" "true"
Yeah, who would have thought I had to enable the "TearFree" option…
This is a quick hack, for when I used udpxrec (part of udpxy) to record an IPTV stream to an mpeg file, but instead of saving it to a network share (to watch it with some delay on my OpenElec box), i saved it to a local drive (by mistake). So here was a file, gradually increasing in size, which i wanted on my network drive (to start watching before the actual show/recording is finished). cp of course wont work, since it stops when it detects the end of file (does not detect new data being added, and wait for it), so you need to use something else.
When you think of a file with data being appended at the end, the first thought is “tail -f” (-f = follow and print the data being appended). Since tail only prints the last few lines (or bytes), you need to set it to output from the beginning with the “-c +0” (output bytes starting at the zero-th byte). I also pipe it through pv to follow the progress and copy rate.
So the command is:
tail -f -c +0 /path/source.mpg | pv > /destinationpath/destination.mpg