8

When I write data to an USB device (like a memory stick or a external HDD) Ubuntu shows the data being transfered at a very high rate, it is done very fast. But then, when Ubuntu says its done, the usb write LED flickers for a long time. And when I pull out the USB during the flickering, the data transfer is not actually done and not all the data will have been written.

Is there a fix to this?

Cheiron
  • 318
  • I think you may want to investigate right-clicking on the icon for the USB device and choosing 'Safely Remove' or 'Eject' - USB devices are often not quick to write data, and Ubuntu is indicating that it has finished writing to the cache. There is a good answer to this question here – Charles Green Dec 08 '14 at 22:22

2 Answers2

6

It happens because Ubuntu takes all the data from the disk that is to be written to the USB and save it in the RAM buffer (Depends on the capacity of RAM). Then Ubuntu shows that the data has been written to the USB but actually data is being transferred from the buffer to the USB at that time. So, if you remove your USB during the transfer (although Ubuntu has shown you the transfer is done), you'll find that all data has not been transferred. You can use

sudo iotop

to check for real time transfer between disk and other I/O and when you found that the transfer has really been done then you can safely remove the USB.

heemayl
  • 91,753
4

Unmount the drive properly before you pull it out.. From terminal, use sync to make it write now, sudo umount /path/to/stick to properly unmount it. From GUI file manager, there are quite a lot of ways to do this - you may have a symbol next to the drive icon, or right-click it & eject or unmount.

You can't reliably just pull out a stick in any common OS, as writes are cached to let your commands take priority - if you did multiple edits & it made you wait for each write, you'd not like it. It's the same as Windows 'safely remove..'

  • AFAIK sync is used for flushing buffers to the block devices that are formatted using ext but USBs are formatted using vfat or similar FS. So will sync work while writing to USB? – heemayl Dec 08 '14 at 22:57
  • Works for me! You can see the lights go, on sticks that have one.. You may be right & it's just doing the stick once the HDD is synced? – Mark Williams Dec 08 '14 at 23:08
  • 1
    After sudo sync (took a while) a pop up window informed me that now I can safely remove usb. Thanks. – Darkmoor Nov 12 '17 at 08:14
  • It's a shame that the system window "copying files" finished but it really not. Period. The system MUST tell the user when it REALLY finished copying files, as it did in the previous Ubuntu releases... – user2342558 Aug 25 '23 at 08:59
  • Doing an extra command to make it works is NOT a solution. It's only a trick to bypass a bug/UXbug – user2342558 Aug 25 '23 at 09:00