73

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

3
  • 3
    Have you looked at man umount?
    – jasonwryan
    Aug 19, 2012 at 8:14
  • Do you want to umount it via commandline or using a graphical interface?
    – student
    Aug 19, 2012 at 8:20
  • via command-line Aug 19, 2012 at 8:27

3 Answers 3

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

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

You can also use

udisks --unmount /dev/sdb1

which does not require root.


For macOS:

diskutil umount /dev/sdb1
3
  • This is the what I was looking for. Do the same unprivileged action the desktop does for mounting the device. TIL.
    – jgomo3
    Oct 24, 2018 at 0:16
  • udisks command is changed to udisksctl in debian derivatives (available in 'udisks2' package). udisksctl unmount -b /dev/sdb1
    – finn
    Feb 26, 2019 at 13:44
  • 2
    Don't forget to power down the USB stick as well: udisksctl unmount -b /dev/sdb1 && udisksctl power-off -b /dev/sdb
    – vk5tu
    Jan 12, 2020 at 8: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.
5
  • no pumount on my system, none in my package repo to install, either.
    – michael
    Oct 13, 2016 at 8:36
  • @michael_n Do you have Ubuntu 12.04 LTS 32-bit, as in the OP question?
    – beldaz
    Oct 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?
    – michael
    Oct 13, 2016 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, 2016 at 8:54
  • @michael_n thanks, I've added mention of the package to help others in future.
    – beldaz
    Oct 13, 2016 at 9:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .