13

Is there a way to actually send an eject to a USB device in Raspbian? As in:

sudo udisks --eject /dev/sda

In other Debian systems, this works fine. But on the Pi there seems to be complications.

I have specific hardware that requires eject. So unfortunately unmount and "safely remove" type answers are not helpful for me in this case.

Also, I noticed that the Raspbian file manager has an eject icon next to USB devices. While this works fine on Ubuntu, even this built in service is not performing the eject service and gives error messages.

Is anyone else able to perform an eject without an error message?

0
16

I found it! It was really simply that eject is just not installed. (That's a new one!)

You just need to do:

sudo apt-get install eject

Then udisks works just fine:

udisks --unmount /dev/sda
udisks --eject /dev/sda

It's somewhat a refreshing answer: Raspbian is so streamlined that they even thought to not give you something like eject unless you actually need it. (which most people do not, hence it should not be there by default)

5
  • 1
    It also works with: sudo umount /path/to/devicename
    – Hezarfen
    Feb 26 '15 at 12:50
  • 2
    I installed that, and it said that /dev/sda1 was not a disk - even though it was a USB thumb drive. So, I ended up shutting down the system to eject it. It is weird that it includes the Mathametica thing, games, and lots of other useless stuff, but doesn't include something as critical as ejecting a device plugged into the USB. (Or have it as a menu item / right click in file manager?) Very odd indeed. Apr 6 '15 at 16:47
  • 1
    sda1 is not a disk. I think its only sda that works. You will need to unmount first. And you probably should not be in the mounted directory. Other things i have experienced is issues when it was mounted by a different user. You can try sudo. If it still doesn't work, I have no idea.
    – SpiRail
    Jun 13 '16 at 10:06
  • 1
    sda1 is a partition, sda is a device. You can unmount a partition, but you cannot eject a partition.
    – Seamus
    Mar 24 '19 at 19:24
  • udisks isn't available on buster. Can someone add an answer with sudo apt install eject -y && sudo eject /dev/sda for buster users?
    – Kyle
    Mar 27 '20 at 12:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.