How to shutdown a USB device (pen drive) from a console?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to shutdown a USB device (pen drive) from a console?
The umount command sync and release the USB device (pen drive or external HD) from the filesystem, but does not shutdown it, like Nautilus does with the safe remove. How can i properly shutdown it from the command line?
'umount' will report the device is busy if something is still accessing the device. Just execute 'umount /<mountpoint>'. If you want to be even more thorough, execute:
# sync;sync;umount <mountpoint>
...where mountpoint is the full directory path where it is mounted.
umount and sync are obvious and well knowed. thanks. ;-)
After the umount some usb devices still "on" with a lighting let and listed on the file browsers. For some devices is more secure to turn it "off" before remove from the USB slot. With this care the device life will be longer. By that you can see "umount" and "safe remove" on Nautilus and some other file browsers.
So... how to shutdown a USB device by the commandline?
You might want to look at ivman. It makes mounting removable devices easier from the console. ( and you may already have it installed ) You can use "halmount -e <device|mount point|label name>" to eject a device. You will need to cd out of a directory on the device before you can eject it.
For large pen drives (8 GB & greater) the light will remain lit after ejecting. It will dim & brighten about once a second. This will also be true for Macs as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.