0

How can I safe remove a usb drive from the Gnome 3.6.2 GUI? This feature used to be available in the past (up to 16, I haven't used 17) from the Desktop and Computer tab in nautilus.

The eject arrow and the unmount features do not power down the device. So, is there a way to do this "old" safe remove?

4
  • 3
    Are you sure that this actually matters? I think it is the same difference between, eg, pulling a plug out of a wall, and flipping a breaker to cut power to the plug. From a device perspective, it is the exact same event anyway. You can "spin the drive down" by unplugging it, or by cutting the power. 6 == 2*3
    – goldilocks
    Feb 5, 2013 at 18:10
  • @goldilocks I do think it is safer to cut the power off before unplugging the device.
    – slybloty
    Feb 5, 2013 at 18:18
  • 1
    I understand that you think that is true, I was just wondering if you had any particular reason for thinking that, beyond superstition. No offence ;)
    – goldilocks
    Feb 5, 2013 at 18:29
  • @goldilocks I wouldn't call it "superstition" I'd call it assurance.
    – slybloty
    Feb 5, 2013 at 19:19

2 Answers 2

0

Apparently this feature has been removed from Gnome, and neither nautilus nor nemo file browsers have it.

So I wrote this small script and added a new udev rule to allow me to safe remove my usb drives.

udev rule:

/etc/udev/rules.d/91-usb_device_rule.rules 
ACTION=="add", KERNEL=="sd?[1-9]", SUBSYSTEM=="block", RUN+="/home/user/usb_script '%k'"

usb_script:

#!/bin/bash

DEV="/dev/$1"
DEVR="/dev/${1:0:3}"

for DISKLABEL in `find /dev/disk/by-label/ -type l`; do 
    RES=`readlink -f $DISKLABEL`
    if [ $RES == $DEV ]; then
        LABEL="${DISKLABEL//*\//}"
    fi
done

FILE="/home/user/Remove_$LABEL"

echo '#!/bin/bash' > $FILE
echo "umount $DEV" >> $FILE
echo "udisks --detach $DEVR"  >> $FILE
echo "rm -fr $FILE" >> $FILE

chmod +x $FILE

exit

I've tested it on usb hard drives and flash dives as well.

1
  • 1
    Please report this issue (with workaround/fix) to the Fedora bugzilla. That way all Fedora users benefit.
    – vonbrand
    Feb 25, 2013 at 16:36
-1

While I can't speak exactly for Gnome and Fedora, a simple and safe approach in a terminal window would be

# sudo umount /dev/sdaXXXX

where /dev/sdaXXXX represents whatever the usb drive is. That information is easily obtained with just

# mount

When the umount command finishes, it is entirely safe to remove the USB drive from the computer.

1
  • 2
    Please read the question before answering.
    – slybloty
    Feb 5, 2013 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .