52

I want to know how to umount my USB drive via command line. I am using Ubuntu 12.04 LTS 32-bit.

  • 2
    Have you looked at man umount? – jasonwryan Aug 19 '12 at 8:14
  • Do you want to umount it via commandline or using a graphical interface? – student Aug 19 '12 at 8:20
  • via command-line – Pranit Bauva Aug 19 '12 at 8:27
65

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

  • The command sudo fdisk -l can be helpful if you don't know where a drive is mounted. – Brian Z Mar 13 '15 at 4:12
  • That's umount, not uNmount, in case anyone else is wondering why the command is not recognized. – Lazar Ljubenović May 28 at 19:03
6

You can also use

udisks --unmount /dev/sdb1

which does not require root.

  • 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 0:16
  • udisks command is changed to udisksctl in debian derivatives (available in 'udisks2' package). udisksctl unmount -b /dev/sdb1 – finn Feb 26 at 13:44
2

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.
  • no pumount on my system, none in my package repo to install, either. – michael Oct 13 '16 at 8:36
  • @michael_n Do you have Ubuntu 12.04 LTS 32-bit, as in the OP question? – beldaz Oct 13 '16 at 8:47
  • 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 8:53
  • 2
    I see it -- one has to install pmount (which is why pumount wasn't matched when searching in in the package manager). manpages.ubuntu.com/manpages/xenial/man1/pumount.1.html – michael Oct 13 '16 at 8:54
  • @michael_n thanks, I've added mention of the package to help others in future. – beldaz Oct 13 '16 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.