Safe to remove USB device?

First of all, long term Ubuntu MATE user here and I love it, good job devs!

I’m currently running Ubuntu MATE 16.04 and for about as long as I’ve been running 16.04 I find it really frustrating how there is no pop up notification informing me when it is safe to remove a USB storage device. Quite often I will transfer large files to NTFS formatted external media, wait until the progress bar completes, eject the drive and give it a sec before removing only to find that the file had not finished fully transferring and I now have a completely corrupted drive! If the device has an activity light it’s not a problem, but it’s when a device has no activity light it becomes a real issue.

Is there a way to work around this that doesn’t involve waiting an extra 10 mins after the progress bar completes in the hope that all data transfer has completed? I really think this is an important issue that needs to be addressed.

1 Like

Can’t you right click on the mounted usb icon and select eject? that will take some time and then pop up a notification, safe to remove. At least this is how I remember it … an old timer’s workaround is to type sync 3 times like sync;sync;sync then you can remove the drive.

I eject as you described, but I never get the pop up notification? I don’t even remember there being a pop up notification in the whole time I’ve been running 16.04, is there supposed to be a notification?

you’re right (I was wrong) … my 16.04 does not pop the notification but 18.04 does. I don’t know if it is easily fixable. I’d use the sync;sync;sync trick.

OK, so the feature is present under 18.04? Interesting.

I’m going to eventually have to upgrade I think, I just can’t be bothered imaging the drive first and I’ve been so impressed with my 16.04 install that I wanted to keep it a little longer.

Supposedly, you can create your own udev rule … I’ll see if I can find something …

1 Like

I’ll try this, cheers my friend, thank you!

this discussion last year …


and more discussion on stackexchange

There seems to be some confusion regarding this matter as people wrongfully assume that once the icon disappears from the desktop the device can be safely removed, sadly this is most definitely not the case.

Quite often I can transfer a file, click ‘Eject’, wait a few seconds after the icon has disappeared from the desktop and unplug the device only to be met with an error as transfers have not yet completed and a corrupt file system as a result.

It’s most definitely an issue that really needs to be resolved.

In my case I haven’t face such problems. After file transfer has been finished, I unmount the USB, eject it and then remove it…

And I have worked with large files, not once I got any corruption or something like that( I learned my lesson on not ejecting media when I was in Windows :pensive:, so this ritual will continue for the foreseeable future)…

It’s not anything I’m doing, I do not remove the device for a good few seconds after the icon has disappeared once ejected. The simple fact is that the progress meter is not accurate and data is still being transfered once the meter has finished and vanished from the desktop and the device has been ejected and the icon has disappeared.

#Background
Safely remove mechanism was changed since Udisks were upgraded from 1.0 to 2.0.
Previously safe remove switched LED on flash off and removed device from the system.
For now after Ejecting the LED on flash remains on. But it depends on flash model.

We have reported bug 1067876 about having Eject instead of Safely remove.

#Software

Ancient

Previous versions of Ubuntu had nice looking application called Ejecter:

Description: application to unmount easily and safely external devices
Ejecter is a simple menu that sits in the system notification area, providing
you a quick way to unmount an external peripheral such as USB pendrive,
CD/DVD disk, external hard disk and so.
.
Ejecter will sleep behind the scenes and show an icon in the system tray when
one or more devices are connected to your computer.

It places its icon in notification area and allow to detach USB-device as in MS Windows. See screenshots (from here):

Ejecter active
Ejecter did safely remove

But is was removed from repositories since 14.04 LTS.
With some workaround we can get it working again on Ubuntu 16.04 LTS MATE and even on 18.04 LTS MATE (see this Q&A on AskUbuntu). But it does not spin-down USB HDDs.

##Current

On my systems I do the following: If I see only Eject option in the Caja window, then I launch GNOME Disks (gnome-disks or from Applications→Accessories→Disks), select appropriate device and click Power off the disk button:

After doing so I see that LED on flash is off or USB-HDD is spinned down.
But it is very likely that it is paranoid solution since unmounting with ejecting is enough to keep data safe :slight_smile:

The problem is I am doing everything right. I am waiting until the progress meter indicates that the job has apparently completed, I am ejecting the drive correctly, waiting a few seconds and removing the drive.

The problem is that even after the progress meter has indicated that data transfer has completed and even after I eject the drive correctly, data transfer is still in progress - Even though the icon has disappeared from the desktop after ejecting correctly. Therefore the issue is that on a drive that has no data transfer LED you have no idea when data transfer has actually completed and the drive is safe to remove.

It is for this very reason that a pop up indicating that the drive is safe to remove, or a more accurate data transfer indicator is really needed.

On a ~5GB transfer I can wait a full minute after ejecting and seeing the drives icon leave the desktop, pull the drive out and get an error that data transfer has not completed and have a garanteed corrupt file system. Guaranteed, every time.

1 Like
  1. Me too! I hate USB-flashes and disks without LEDs. I'm trying hard to buy devices with LED. But it is too difficult to find them nowadays.
  2. The second problem is that some flashes incorrectly report status of their write buffer.
  3. The third problem is that some external harddisk manufactures invented their own interface boards to make devices cheaper. Western Digital MyPassport is an illustration of this problem. Such devices have USB controller which is directly connected to the drive electronics (so it is not 2.5" SATA drive with USB-SATA bridge, it is 2.5" drive with direct USB connection and self-invented reduced buggy ATA-commandset).

I completely got Ejecter working on all LTS releases (see my answer on AskUbuntu):


You can try to it with your disks and report any success here :slight_smile:

All done my friend, I'm going to give this a shot. Thank you.

[EDIT] Just tried copying a large file and ejecting it, Ejecter works perfectly! Thanks Norbert_X!

1 Like

I got the same problem as @Bulletdust i transfert on a regular basis 2.7 GB on a usb thumb drive and discover many problems with “eject” or “remove safely” as well as the transfert bar being far to be accurate.

1 When formated as fat or dos the transfert bar take around 20 minutes to be full => but the thumb drive is still blinking (lucky to have a blinking light on the thumb drive) for at least 10 more minutes even when i right click then Eject and the icon disappear from the desktop… still blinking

2 When formated as ext4 (because fat or dos does not take in count .htaccess or any file starting with a period as well as lower/upper case it ask me to rename or overwrite thinking it’s the same file name) the progress bar goes a lot faster than in fat. it takes just 5 minutes but i need to wait 25 minutes before i can remove the usb thumb drive as it is still bliking during 25 minutes even after right click and eject.

For me it’s a Bug where the progress bar should be at least adjusted… And when we Eject, if the transfert is not finished we should have an alert saying that we cannot eject yet.

BTW i killed my phone micro SD card 2 years ago because of that (not knowing this, and with no possible way for me to know that the transfert was not finished yet)

1 Like

Hallo Bulletdust

You might find it useful to look at the “nmon” output in a small terminal window while you make such transfers.

To install:

sudo apt-get install nmon

To run:

nmon

Just an idea. :slight_smile:

2 Likes

Thanks alpinejohn, I’ve downloaded nmon and will definitely make use of it - Interesting software.

The problem is, people’s data is being lost, this issue really needs to be resolved at OS level. A proper ‘Your USB device can now be removed safely’ pop up is a must where it takes so long for the buffer to clear and the progress meter is so inaccurate.

So is it possible to integrate the Ejecter code into the OS in such a way as to make it work like that? (Resists urge to begin coding in language does not know…) Because I had a “cool” idea once to integrate Wine or some such emulator into the OS to improve performance, not that I would know how to do that.

OK, so there may be an issue with Ejecter on large file transfers to USB stick.

Yesterday I transferred a large movie file to USB stick. I waited for the file to transfer (the process took around 12 mins), once the file had completely transferred I waited about 15 seconds and ejected the USB stick using Ejecter and was informed the device was safe to remove. I removed the drive and went to watch the movie on my laptop. Half way through watching the movie playback failed, no matter what I did I could not get playback to resume even on my desktop PC using the same USB stick.

The original movie file plays back just fine off the hard drive of my desktop PC, the USB stick that was ejected correctly stops half way through, obviously the file is corrupted somehow.

Is there any way the devs can do something about the massive inaccuracies regarding the progress indicator in relation to file transfers to USB devices? It’s wildly inaccurate making it impossible to safely eject media.

Even better still, is there a way we can completely resolve the ejecting issue without using Ejecter? It’s a fair oversight that media is being corrupted due to an issue with file transfers to USB devices and ejecting media.