I want to know how to umount my USB drive via command line. I am using Ubuntu 12.04 LTS 32-bit.
Asked
Active
Viewed 2.7e+01k times
73
student
- 17,875
- 31
- 103
- 169
Pranit Bauva
- 986
- 2
- 8
- 15
-
3Have you looked at `man umount`? – jasonwryan Aug 19 '12 at 08:14
-
Do you want to umount it via commandline or using a graphical interface? – student Aug 19 '12 at 08:20
-
via command-line – Pranit Bauva Aug 19 '12 at 08:27
3 Answers
93
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 Z Mar 13 '15 at 04:12
-
That's `umount`, not `uNmount`, in case anyone else is wondering why the command is not recognized. – Lazar Ljubenović May 28 '19 at 19:03
9
You can also use
udisks --unmount /dev/sdb1
which does not require root.
For macOS:
diskutil umount /dev/sdb1
Jim Paris
- 14,137
- 5
- 36
- 35
-
This is the what I was looking for. Do the same unprivileged action the desktop does for mounting the device. TIL. – jgomo3 Oct 24 '18 at 00:16
-
udisks command is changed to udisksctl in debian derivatives (available in 'udisks2' package). `udisksctl unmount -b /dev/sdb1` – finn Feb 26 '19 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` – vk5tu Jan 12 '20 at 08:38
3
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.
beldaz
- 131
- 4
-
no `pumount` on my system, none in my package repo to install, either. – michael Oct 13 '16 at 08:36
-
-
ubuntu 16.04 -- at some point, pumount must either have been deprecated, did it come from a 3rd party repo? – michael Oct 13 '16 at 08:53
-
2I see it -- one has to install `pmount` (which is why `pumount` wasn't matched when searching in in the package manager). http://manpages.ubuntu.com/manpages/xenial/man1/pumount.1.html – michael Oct 13 '16 at 08:54
-
@michael_n thanks, I've added mention of the package to help others in future. – beldaz Oct 13 '16 at 09:55