Skip to content

Instantly share code, notes, and snippets.

@konradmb
Forked from 2E0PGS/linux-usb-file-copy-fix.md
Last active March 9, 2023 03:40
Show Gist options
  • Save konradmb/1d02551c5b1c95d04eb70befcf3c5546 to your computer and use it in GitHub Desktop.
Save konradmb/1d02551c5b1c95d04eb70befcf3c5546 to your computer and use it in GitHub Desktop.
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) | sudo tee /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) | sudo tee /proc/sys/vm/dirty_bytes

To revert the changes enter this in console

echo 0 | sudo tee /proc/sys/vm/dirty_background_bytes
echo 0 | sudo tee /proc/sys/vm/dirty_bytes

More info and references: https://unix.stackexchange.com/questions/107703/why-is-my-pc-freezing-while-im-copying-a-file-to-a-pendrive/107722#107722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment