-3

I've got serious problem with this stupid file manager. When copying files from internal HDD to removable drives on USB 2.0 ports, the speed skyrockets to 70MiB/s, while the theoretical speed of an USB 2.0 port is only 32MiB/s.

After the files "finish" copying, if I leave my portable drive there for a while, it will be okay. But if I unmount the volume immediately and unplug it from the USB port, the files become corrupted.

I wonder if Canonical ever tested such horrible feature before releasing their software to the public? For now, all I want is to disable that caching mechanism. I'm using Nautilus version 1:3.26.4-0ubuntu7.2 on 18.10.

P.S: if anyone is going to say it was because of the drive's internal caching machanism, I can tell you that this bug does not happen on Windows at all. I have to reboot into Windows only to copy big files to the portable HDD.

Livy
  • 348
  • 1
  • 4
  • 16
  • @Rinzwind I've been using Windows long enough to know that it does not happen. When the file explorer finishes copying files and stops showing the copy dialog, the copy process is done, and safe to remove the portable drive. The first time I encounter this bug is when I copied nearly 1TB of data on Ubuntu from one drive to another, only to start over again because I could not tell if it was actually done or not. – Livy Jun 15 '19 at 15:11
  • @Livy You can configure windows to use more aggressive caching. In addition, Ubuntu will not tell you that it's safe to remove the device before the cache is flushed. If you wait until you see that notification (as in windows), you'll be fine. – vidarlo Jun 16 '19 at 13:37

1 Answers1

1

What you see in action is the file buffer. First, content is copied to the file buffer. When the buffer is full, copying continues to the file buffer, while on the other end, content is physically being flushed to the disk. Once copying is "finished" for the file manager, the buffer is still being flushed in the background until complete. This is how Linux works, and it will work the same with nautilus Files as with any other file manager on linux.

That you have gotten corrupt files is not the fault of Canonical. It is your fault. To correctly unmount a volume, you need to click the "eject" button in the file manager, or right-click and select "Safely unmount disk". If writing is still ongoing, you will get a notification that you should not yet unplug the drive. Once it is safe to eject the drive, you also will get a notification.

So await the notification before removing the drive. No software or instrumentation ever is 100% foolproof against unproper use.

vanadium
  • 88,010
  • I understand the purpose of a buffer, but cannot believe such a design that force users to guess if their files finish copying -- it could take a lot of time after the circle graph indicates the copy process completes. Is the same thing applied to distros without GUI such as Ubuntu Server if I use cp command? And if it is, how can I tell when to remove the drive? – Livy Jun 15 '19 at 15:23
  • As I indicated in my answer, you do not need to guess. You just need to unmount properly using software: then the system informs you. Also on a server a device must be properly unmounted. If using the terminal, the system will tell you it cannot if writing still is ongoing. – vanadium Jun 15 '19 at 15:46