Cinan's world

GNU/Linux & free software, howtos, web development, scripts and other geek stuff

Fix System Freezing While Copying to a Flash Drive

I copied about 10 GiB data from my hard drive to a USB3.0 flash drive. Much to my surprise the system started freezing, songs playback became interrupted, etc. Eventually I had to wait until the copying process finished.

Well, something like that is simply unacceptable if you have 8-core i7 processor, 8 GiB RAM and SSD.

So I’ve found a simple solution. The problem was wrong setting of dirty pages (because of historical reasons). It’s a well-known Linux kernel problem.

What I did was:

1
2
3
echo 0 > /proc/sys/vm/dirty_background_ratio
echo 33554432 > /proc/sys/vm/dirty_background_bytes
echo 66554432 > /proc/sys/vm/dirty_bytes

After applying these changes CPU load dropped from 6 to 3 and system was fast and responsive. To make that changes persistent add the lines below to /etc/tmpfiles.d/dirty.conf:

1
2
3
w /proc/sys/vm/dirty_background_ratio - - - - 0
w /proc/sys/vm/dirty_background_bytes - - - - 33554432
w /proc/sys/vm/dirty_bytes - - - - 66554432

Maybe it’s already fixed in current kernel, I don’t know. I’m running OpenSUSE 13.1 with 3.11.10-7-desktop kernel.

Comments