There's an issue with Ubuntu that hasn't been fixed yet, where the PC freezes or gets really slow whenever it is copying to an USB stick (see Why is my PC freezing while I'm copying a file to a pendrive?, http://lwn.net/Articles/572911/ and https://askubuntu.com/q/508108/234374).

A workaround is to execute the following commands as root (see here for an explanation) as root:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

How do I revert these changes? When I restart my PC, will it get rolled back to default values?

  • You need to write an init file. I would rewrite you question to ask about persisting changes to /proc, and not mention usb-sticks in the title. But keep the detail as an appendix to the question. Aug 7, 2014 at 16:07

2 Answers 2


These are sysctl parameters. You can set them either by writing to /proc/sys/CATEGORY/ENTRY or by calling the sysctl command with the argument CATEGORY.ENTRY=VALUE. These settings affect the running kernel, they are not persistent.

If you want to make these settings persistent, you need to set them at boot time. On Ubuntu, create a file in the directory /etc/sysctl.d called becko-vm-dirty.conf containing

# Shrink the disk buffers to a more reasonable size. See http://lwn.net/Articles/572911/
vm.dirty_background_bytes = 16777216
vm.dirty_bytes = 50331648

To revert the changes, write the old value back. There is no “restore defaults” command.

Note that these parameters are a bit peculiar: there are also parameters called vm.dirty_ratio and vm.dirty_background_ratio, which control the same setting but express the size as a percentage of total memory instead of a number of bytes. For each of the two settings, whichever of ratio or bytes was set last takes precedence.

  • 1
    A thousand times thank you for revealing to me where this can be set at boot time. But this is quite "global", if you will - are there ways of being more specific (setting these variables at boot time for I/O directed towards removable media only, because I might be otherwise happy with the Linux kernel's I/O policy towards internal HDDs/SSDs)? Dec 10, 2014 at 5:55
  • 3
    @IwillnotexistIdonotexist AFAIK this setting is global because the kernel doesn't maintain separate totals for dirty buffers on different block devices, but I'm not an I/O tuning expert. Dec 10, 2014 at 9:53

There is no way to reset these values to their default of 0. As of kernel 4.4, doing so fails with EINVAL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.