ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

"Safely" Remove USB Devices in *N*X

(1/2) > >>

ewemoa:
Recently I came across the "Safe Removal" feature in palimpsest (aka Gnome Disk Utility) and I've started using it before detaching some of my USB devices.  I'm not quite sure what it does, but LEDs seem to turn off so I get the sense that using the feature may be better than not.

I'd like to be able to do this or something comparable from the command line though.

Anyone know how that might be done?

The local context is various Debian-based things -- so I guess I'm looking for a GNU/Linux-ish answer :)

40hz:
The umount Command

The umount command is used to manually unmount filesystems on Linux and other Unix-like operating systems.

A filesystem in this context is a hierarchy of directories that is located on a single partition (logically independent section of a hard disk drive) or other device, such as a CDROM, DVD, floppy disk or USB key drive, and has a single filesystem type (i.e., method for organizing data).
--- End quote ---

See the man pages for full syntax (i.e. $man unmount) or here for a complete how-to in normal understandable English.
 :)

ewemoa:
Thanks for the feedback.

As near as I can tell in this environment, even after performing umount on all the partitions on a device (so df doesn't show anything mounted for the drive), the physical device's LED is on.  So as far as I can tell, "Safely Remove" is not the same thing as umount.  IIRC, palimpsest's UI has a button per partition for unmounting and a single button for "Safely Remove" for the whole device.


Came across this too:

Safely remove an USB hard drive in Linux

MilesAhead:
http://linux.about.com/library/cmd/blcmdl8_sync.htm

At least buffers would be flushed to disk. As for all the rest of it, suspending the USB port etc.. I don't know if they have all that perfected yet. Half the time it doesn't work in Windows either. If the eject works for a drive I'll use it. But most of the time it just hangs. Usually I just run sync.exe to flush buffers to disk then pull the drive or shut it off if it has a power switch. It's been some time since I ran Linux. I'm just going by the link you posted.

40hz:
1. FWIW I've never had a issue or experienced data loss using unmount with any mainstream Linux distro since about the era of Ubuntu 8.0.4.  Although in day to day practice I tend to use the eject menu option from the graphic environment since that is the preferred "safe" eject procedure in most distros. YMMV.

2. There is an eject command available in many distros as well. Syntax can be found here.

3. Supposedly this command accomplishes the same thing as the eject menu command does:

      sudo echo 1>/sys/bus/usb/devices/usb1/remove

Can't vouch for it however, since it comes to me by way of another Nix user and I've never used it personally. It's an interesting approach and you could always script it to make your own command(s). Requires root access.

Luck!  8)

Navigation

[0] Message Index

[#] Next page

Go to full version