I am having problems where my various disks slow down from transfer rates of about 25 MB/s to about 0.3 MB/s. Sometimes a reboot works, but not necessarily for long. I had this with Ubuntu Mate, replaced that with Xubuntu, but no luck.
So searching, once more, at random, I found the thread Massive, unpredictable I/O performance drop in Linux
The author there said that
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
worked for him. I tried it and it worked. The USB disk stopped making grinding noises almost immediately and returned to normal speed.
But frankly, I have absolutely no clue what I am doing here. What is /proc/sys/vm/drop_caches
? This file is still empty after the echo? Why does this work, and are there any problems doing this? Does it indicate a hardware problem?
Addendum 1: I have implemented this by calling a script running sync and the echo in the root crontab that runs the backup jobs. The main backup job starts at 3:30 am and I call the script just before it and also at 4 am and 5 am. The backup only seemed to have picked up speed after the 4 am script, so it is not quite straightforward to implement this. But I can now reasonably run overnight system backups again.
Addendum 2: Maybe I should also point out that at one point I saw the 0.3 MB/s transfer rates while, IIRC, copying a 30 GB or so file structure from the Internet to the internal system hard disk /. So it is not obvious to me that the problem is the slower USB hard disks (which are not particularly slow anyway, in my opinion, at 30 Mb/s or more when the system is working properly, like after writing to /proc/sys/vm/dropped_caches.)
Addendum 3: changing vm.dirty_background_ratio, vm.dirty_ratio, vm.dirty_expire_centisecs, and vm.dirty_writeback_centisecs to what they are on my OK Laptop did not make a difference.
Addendum 4: Apparently this is a known bug, https://bugs.launchpad.net/ubuntu/+source/linux-meta-lts-trusty/+bug/1333294 A useful link from there is http://flaterco.com/kb/PAE_slowdown.html. Setting GRUB_CMDLINE_LINUX="mem=8192M" in /etc/default/grub, running update-grub, and rebooting seems to have returned disk writing to a reasonable speed without using drop_caches. (At the loss of 8GB of memory.)