4

When I copy a large file to a flash drive, the progress bar reaches the end very fast, but then it stays like that until the file is really copied to the flash drive.

I looked on the web about this problem, and it doesn't seem to be a file explorer bug, but it seems te be a linux bug. So my question is : how is it possible that such an amazing kernel contains such annoying bug ; and no one did fix this for years (even now the bug is still occurring).

PS : I am using Ubuntu 15.10 and 16.04 with the default file manager (nautilus)

Sidahmed
  • 387

1 Answers1

4

I found the problem, and it's not in the file manager.

Temporary Solution

Execute this command at each boot:

echo 15728640 > /proc/sys/vm/dirty_bytes

Permanent Solution

Add this line to the end of the file /etc/sysctl.conf:

vm.dirty_bytes=15728640

Explanation

What is happening is that the kernel is transferring the file content in a buffered space in primary memory (RAM), and this space is extremely fast.

So the file manager thinks that the file content was completely copied into the destination, and tries to end the file copy. In that moment, the file manager get stuck because the kernel is now really copying the file to the destination media (hard drive, flash drive ...). It get stuck until the file is completely copied to the destination media.

The solution is to limit the space of that buffered space, lets say to 15Mb, to force the kernel to flush the content of the buffered space to the destination media each time the 15Mb space limit is reached. This way, the file manager doesn't receive a wrong progress information.

Sidahmed
  • 387