How To Mount and Unmount Drives on Linux (2024)

In a Linux GUI, we usually take it for granted that when we insert a USB flash drive, best hard drive, or even a DVD disk, they just appear ready for use. But under the hood there is a process where the device is mounted (made ready for use) and assigned a mountpoint. When using a server or a remote connection, it is not certain that a device will automatically be made available, so how can we mount our own devices?

In this how-to we’ll look at various ways of mounting and unmounting disks and disk images. We will use a variety of approaches and tools including both terminal emulator commands and GUI tools.

All the commands in this how-to will work on most Linux machines. We’ve used a Ubuntu 20.04 install but you could run this how-to on a Raspberry Pi. All of the how-to is performed via the Terminal. You can open a terminal window on most Linux machines by pressing ctrl, alt and t.

How To Mount and Unmount Drives on Linux (1)

Most of the time when you attach a drive, for example a pen drive, the system will recognize it and automatically mount the drive. Occasionally this may not happen and knowing how to manually mount and unmount a drive can be a useful skill.

1. Plug in a USB Flash drive and allow it to automatically mount. You should see an icon appear as a shortcut to the drive, or opening a file explorer you will find the pen drive mounted.

How To Mount and Unmount Drives on Linux (2)

2. Press the Windows / Super key and search for “disk.” Select the Disks utility.

3. Selecting the USB Flash drive correctly. Click the square stop button icon to unmount the disk. You will see your main system disk drive(s) and also the pen drive you just inserted, so double check before taking the action.

Stay on the Cutting Edge

Join the experts who read Tom's Hardware for the inside track on enthusiast PC tech news — and have for over 25 years. We'll send breaking news and in-depth reviews of CPUs, GPUs, AI, maker hardware and more straight to your inbox.

How To Mount and Unmount Drives on Linux (4)

4. Click the mount button to re-mount the drive. With the pen drive unmounted the mount button icon changes to a triangular “play” icon. Clicking this will remount the pen drive.

How To Mount and Unmount Drives on Linux (5)

5. Unmount the drive to get ready for the next part of the tutorial. It’s useful to have the pen drive attached but not mounted for the next part of the tutorial so unmount it by once again clicking the unmount button in the disk utility.

Identifying and Mounting a Drive using the Linux Terminal

Using the command line interface (CLI) in the terminal emulator allows us to have more control over when drives are mounted and the position in the filesystem that they are mounted to.

How To Mount and Unmount Drives on Linux (6)

1. Identify the USB drive using the lsblk command. In the results you may well see lots of entries labeled “loop.” However you are looking for results that are listed as sda or sdb to identify physical disks attached to your system. Comparing the listed capacity of the attached drives can often help you discover the name of your target drive. In our case we can identify our USB drive as sdb1.

lsblk

How To Mount and Unmount Drives on Linux (7)

2. Create a directory to mount the USB drive into. When an external drive is automatically mounted it is often mounted inside the media directory. However using the CLI we can create and specify a directory into which we will mount our pendrive. Note that we need to evoke root privileges using sudo to create a directory inside the media directory.

sudo mkdir /media/pendrive

3. Mount the USB drive to the /media/pendrive directory using the mount command. The mount command has the following syntax; sudo mount /path/to/drive /path/to/mountpoint.

sudo mount /dev/sdb1 /media/pendrive

4. Check the drive has been mounted by re-running lsblk. Notice that the final column in the lsblk output lists the mount point of the listed device, if there is a mount point listed then the device is confirmed as mounted.

How To Mount and Unmount Drives on Linux (8)

Unmounting a drive in Linux using the umount command

How To Mount and Unmount Drives on Linux (9)

Unmounting a drive is handled via the umount command and when invoked it safely removes the drive from the system, enabling us to pull the drive and use it in another machine.

1. Unmount the drive using umount command. Note the spelling of umount as a common error is people type “unmount”. Using the umount command we only need to specify the mount point location and name of the drive we wish to unmount.

sudo umount /media/pendrive

2. Check the drive is unmounted using lsblk. Notice that in the lsblk output the final column lists the mount point of detected devices, if there is no mount point listed then the device is unmounted.

lsblk

Mounting a Disk Image to view contents in Linux

How To Mount and Unmount Drives on Linux (10)

It is possible to mount a disk image to appear as a read only drive. This is a useful technique if you want to copy some content out of a disk image or if you simply want to inspect a disk image’s contents. In the following example, we have used a downloaded disk image of the Puppy Linux distribution but this technique would work with any disk image including images made of disks for backup purposes.

1. Create a directory called iso in the media directory to mount the disk image into. Again this could be anywhere in the file system but we have created a directory called iso within the media directory.

sudo mkdir /media/iso

2. Mount an ISO disk image using the mount command and the loop argument. We need to run this command with root privileges so therefore we use sudo. The usage of the mount command is similar to previous uses and includes the path to the image and the path to the mount point we created in the previous step. We also add the -o loop argument to create the loop device which tricks the operating system into believing this is a real disk and not an image.

sudo mount -o loop Downloads/fossapup64-9.5.iso /media/iso

How To Mount and Unmount Drives on Linux (11)

3. Unmount the ISO using umount. Once again when using the umount command we need only specify the mount point of the drive or disk image we wish to unmount.

sudo umount /media/iso

With these techniques you now have greater control over mounting and unmounting disks in Linux and have some skills that may help next time a connected drive doesn’t automatically mount correctly. Being able to mount a disk image using a loop device is very useful when exploring old backup images of previously used systems or when you want to have a look around a Linux distributions image contents for exploration or learning.

  • How To Check Disk Usage in Linux
  • How To Kill a Process in Linux
  • How To Find Files in Linux
  • How To Manage Users in Linux
How To Mount and Unmount Drives on Linux (2024)

FAQs

How to mount and unmount a disk in Linux? ›

Mounting and unmounting media using Linux
  1. Type cd and then press Enter.
  2. Type one of the following commands: If the medium to be unmounted is a CD, type umount /mnt/cdrom. and then press Enter. If the medium to be unmounted is a diskette, type umount /mnt/floppy. and then press Enter.

How do I mount all drives in Linux? ›

How to Mount a Hard Drive on Linux
  1. Step 1: Connect Hard Drive.
  2. Step 2: Open Terminal.
  3. Step 3: Check Hard Drive.
  4. sudo fdisk -l.
  5. Step 4: Get Device Name.
  6. Step 5: Create Directory.
  7. sudo mkdir /mnt/harddrive.
  8. Step 6: Mount Hard Drive.
Mar 11, 2023

How do I mount and unmount a USB drive in Linux? ›

Create a mount point using mkdir /mnt/usb and then mount the USB drive with sudo mount /dev/sdx1 /mnt/usb , replacing /dev/sdx1 with your USB device identifier. 3. How do I unmount a USB drive? Use the command sudo umount /mnt/usb , ensuring no files are being accessed from the USB drive.

How do I mount and unmount an SD card in Linux? ›

In the following steps, you will see how to utilize the “Disks” for mounting SD cards in Linux.
  1. Step 1: Launch “Disks” Open the “Disks” application to manage your disk drives: ...
  2. Step 2: Mount SD Card via “Disks” ...
  3. Step 3: Check SD Card Properties. ...
  4. Step 3: Unmount SD Card.
Feb 2, 2024

How do I manually mount a drive in Linux? ›

To mount a drive on Linux, you'll need to find the default name of the drive (e.g., /dev/sdc), create a directory for your mount point, and then use the "mount" command to mount that default drive name to the new directory. If you're using Ubuntu, you can also use the Disks utility to mount and unmount drives.

How to unmount a drive in Linux? ›

To unmount a file system in Linux, you use the 'umount' command followed by the directory where it has been mounted. The basic syntax would be, umount /path/to/file_system . In this example, we've used the 'umount' command to unmount the file system that was previously mounted at the directory '/mnt/my_usb'.

How do I unmount all network drives in Linux? ›

Unmounting a drive in Linux using the umount command

Unmount the drive using umount command. Note the spelling of umount as a common error is people type “unmount”. Using the umount command we only need to specify the mount point location and name of the drive we wish to unmount.

Where should I mount a drive in Linux? ›

The classic directory for permanent mount points is /mnt , for example sudo mkdir /mnt/exthdd and use that as a mountpoint. /mnt is for internal disks. /media for external. I myself use my own mountpoint /discworld for my internal disk.

How to use mount command in Linux? ›

Syntax of mount Command
  1. If you leave the dir part of syntax it looks for a mount point in /etc/fstab.
  2. You can use –source or –target to avoid ambivalent interpretation. ...
  3. /etc/fstab usually contains information about which device is need to be mounted where.
  4. Most of the devices are indicated by files like /dev/sda4, etc.
Jan 8, 2024

How to mount a drive? ›

Mount a drive as a folder with Disk Management
  1. In the search box on the taskbar, enter Computer Management, and select Disk Management.
  2. Choose the partition or volume that has the folder you want to mount the drive.
  3. Go to Action > All Tasks > Change Drive Letter and Paths, then choose Add.
Mar 27, 2023

What does unmount drive mean in Linux? ›

The unmounting of a file system removes it from the file system mount point, and deletes the entry from the /etc/mnttab file. Some file system administration tasks cannot be performed on mounted file systems.

How to mount a disk in Linux terminal? ›

Steps to mount a disk or partition in Linux:
  1. Open the terminal.
  2. Find the disk or partition you want to mount. ...
  3. Figure out the filesystem type for the disk or partition. ...
  4. Make a directory for the mount point if it's not already there. ...
  5. Use the mount command to mount the partition temporarily.

How do I unmount a drive? ›

If you're using Windows, right-click the drive in File Explorer and click "Eject" on the Manage tab. On a Mac, just select the drive in Finder and click the Eject button. To unmount in Linux, use "sudo umount" followed by the mount point.

How to mount a file in Linux? ›

Mounting a File System on Linux, Red Hat, or CentOS
  1. Log into the instance where you want to mount the file system. ...
  2. Install the NFS client using this command: sudo yum install nfs-utils.
  3. Create a directory that will be used as the mount point. ...
  4. Mount the file system. ...
  5. View the mounted file system.
Nov 21, 2023

What is the use of mount and unmount in Linux? ›

In short, using mount command we can mount a file system into a directory and using umount command we can umount the same file system from that directory. These can be done for hard disk and USB drive also. We have remember that all mount and umount commands works in “sudo” or “root” user only.

What does mount and unmount disk mean? ›

Mount now means make available for access. Unmount is simply remove from accessibility.

What is the unmount command in Linux? ›

This command enables you to remove a remote file system that is currently mounted. The umount command supports the -V option to allow for testing. You might also use the -a option to unmount several file systems at one time.

What is mount and remount in Linux? ›

Remounting a filesystem means changing the options that control operations on the filesystem while it is mounted. It does not mean unmounting and mounting again. For a mount, you must identify the type of the filesystem with fstype .

Top Articles
Latest Posts
Article information

Author: Edmund Hettinger DC

Last Updated:

Views: 6370

Rating: 4.8 / 5 (58 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Edmund Hettinger DC

Birthday: 1994-08-17

Address: 2033 Gerhold Pine, Port Jocelyn, VA 12101-5654

Phone: +8524399971620

Job: Central Manufacturing Supervisor

Hobby: Jogging, Metalworking, Tai chi, Shopping, Puzzles, Rock climbing, Crocheting

Introduction: My name is Edmund Hettinger DC, I am a adventurous, colorful, gifted, determined, precious, open, colorful person who loves writing and wants to share my knowledge and understanding with you.