I want to know how to umount
my USB drive via command line. I am using Ubuntu 12.04 LTS 32-bit.
3 Answers
Suppose your usb drive is mounted to /media/usb
then it would be sufficient to do
sudo umount /media/usb
Suppose the your usb is /dev/sdb1
then you could also do
sudo umount /dev/sdb1
You may also have a look at the anwers of one of my questions, how to umount all attached usb devices with a single command: Umount all attached usb disks with a single command
-
3The command
sudo fdisk -l
can be helpful if you don't know where a drive is mounted.– Brian ZMar 13, 2015 at 4:12 -
That's
umount
, notuNmount
, in case anyone else is wondering why the command is not recognized. May 28, 2019 at 19:03
You can also use
udisks --unmount /dev/sdb1
which does not require root.
For macOS:
diskutil umount /dev/sdb1
-
This is the what I was looking for. Do the same unprivileged action the desktop does for mounting the device. TIL.– jgomo3Oct 24, 2018 at 0:16
-
udisks command is changed to udisksctl in debian derivatives (available in 'udisks2' package).
udisksctl unmount -b /dev/sdb1
– finnFeb 26, 2019 at 13:44 -
2Don't forget to power down the USB stick as well:
udisksctl unmount -b /dev/sdb1 && udisksctl power-off -b /dev/sdb
– vk5tuJan 12, 2020 at 8:38
Better than using sudo
to unmount as root, just install the pmount package and do:
pumount /media/usb
As man pumount
says:
NAME
pumount - umount arbitrary hotpluggable devices as normal user
SYNOPSIS
pumount [ options ] device
DESCRIPTION
pumount is a wrapper around the standard umount program which permits
normal users to umount removable devices without a matching /etc/fstab
entry.
-
-
@michael_n Do you have Ubuntu 12.04 LTS 32-bit, as in the OP question?– beldazOct 13, 2016 at 8:47
-
ubuntu 16.04 -- at some point, pumount must either have been deprecated, did it come from a 3rd party repo?– michaelOct 13, 2016 at 8:53
-
2I see it -- one has to install
pmount
(which is whypumount
wasn't matched when searching in in the package manager). manpages.ubuntu.com/manpages/xenial/man1/pumount.1.html– michaelOct 13, 2016 at 8:54 -
@michael_n thanks, I've added mention of the package to help others in future.– beldazOct 13, 2016 at 9:55
man umount
?