4

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?

  • 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 8 '14 at 22:22
3

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 8 '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 8 '14 at 23:08
  • 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 8:14
4

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.

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.