- How to List Mounted Drives on Linux?
- Method 1: Using the “df(disk free)” Command
- Method 2: Using the “mount” Command
- Method 3: Using the “findmnt” Command
- Method 4: Using the “/proc/mounts” File
- Conclusion
- List Mounted Drives in Linux
- List mounted drives in Linux using the cat command
- List mounted drives in Linux using the mount command
- List mounted drives in Linux using the df command
- Wrapping Up
- How do I check where devices are mounted?
- 3 Answers 3
- 4 Ways to Show all Drives (Mounted and Unmounted) on Linux
- Display all Drives on Linux
- Method # 1: Using the “fdisk” Command
- Method # 2: Using the “blkid” Command:
- Method # 3: Using the “lsblk” Command:
- Method # 4: Using the “parted” Command:
- Conclusion
- Search
- About This Site
- Latest Tutorials
How to List Mounted Drives on Linux?
The “Mounted Drives” allows the user to add volume into the defined disk partitions without creating extra drives into the Linux file system. They manage the disk usage space based on the Linux work environment The “mounted drives” are mounted/unmounted using the Linux mount/unmount command line tools. Once they are mounted, the user can also view them easily by using the various built-in utilities of Linux.
This post elaborates on all the possible methods of listing mounted drives on Linux.
- Method 1: Using the “df(disk free)” Command
- Method 2: Using the “mount” Command
- Method 3: Using the “findmnt” Command
- Method 4: Using the “/proc/mounts” File
Method 1: Using the “df(disk free)” Command
The “df” denotes the “disk free” command that helps to show the mounted drive information along its absolute path.
Execute the “df” command with the following options to get the mounted drives:
- “-h: Shows file size in human-readable format
- -a: Displays all file systems(including hidden files).
- -T: Specifies the file system type.
The output contains the mounted drives’ information in the last column, “Mounted on”, along their absolute path.
Method 2: Using the “mount” Command
The main objective of the “mount” tool is to mount the file system located in a device structured in a big tree rooted at “/(forward slash)”. It also prints all the mounted drives in the “/etc/mtab” file.
Run the “mount” command simply without any flag/argument to list down the mounted drives in this way:
The highlighted filesystem with “/(Forward Slash)” displays the “mounted drive” in the output.
Method 3: Using the “findmnt” Command
The “findmnt” command is another tool to view mounted drives in Linux. It is preinstalled in the Linux system that displays all the mounted file systems located in the “/etc/fstab”, “/etc/mtab”, or “/proc/self/mountinfo” configuration files.
To get the mounted drives of the current working Linux system, type the “findmnt” command simply in the terminal and press the “Enter” key:
The above output shows the mounted drives with their absolute path in the “TARGET” column.
Tip: To check the specific mount point of the file system type, execute the “findmnt” command by the “-t(type)” flag and the file system type:
The output of the “ext4” filesystem type is shown in the above image.
Method 4: Using the “/proc/mounts” File
The “/proc/mounts” file contains the details of all currently mounted file systems in a tree format (similar to the “fstab” file). It shows the “system’s name”, “filesystem type”, “mount point” and many others.
To list down the mounted drives of the file system, read this file using the cat command in the following way:
The output shows all the mounted drives of the existing file system.
Conclusion
On Linux, the user can easily and quickly list the mounted drives using “df(disk free)”, “mount”, and “findmnt” commands. In addition, this task can also be performed by accessing the “/proc/mount” file through the “cat” command. This guide has illustrated all possible methods to list the mounted drives on Linux.
List Mounted Drives in Linux
If you want to perform certain operations on a drive, you need to know its details. Learn how to list currently mounted drives in Linux.
If you have multiple drives mounted and want to perform any operations such as repartitioning them, it is crucial to have on-point information.
And listing mounted drives can reveal a lot about those mounted drives.
And the easiest way to list mounted drives is to use the findmnt command:
And if you are not a fan of the tree layout of the findmnt, you can follow the other approaches that I’m about to show in this guide.
List mounted drives in Linux using the cat command
The cat command is used to read the contents of the file.
And in this case, I will be using the cat command to read the contents of a /proc/mounts file:
The advantage of using this method is that the kernel directly provides information about the mounting points.
List mounted drives in Linux using the mount command
The mount command is used to mount the filesystem (pretty generic but that’s what the man page said).
And apart from mounting drives, you can also use it for getting information about mounted drives which also includes listing mounted drives.
The command is pretty straightforward. Just append the -l option with the mount command and that’s it:
Similarly, if you are looking for mounted drives with a specific filesystem, all you need to do is append the filesystem type with the -t option:
For example, here I went with the ext4 :
List mounted drives in Linux using the df command
The df command is used to check the free disk space and so for listing mounted drives.
To list mounted drives with the df command, you’d need to use 3 options with it:
- -a will available filesystems.
- -T will print the filesystem type.
- -h will get you output in human-readable form.
And if you want to list mounted drives specific to a filesystem type, all you need to do is add the -t option with the previous ones.
So let’s say I want to list mounted drives having ext4 filesystem so I will be using the following command:
Wrapping Up
In this guide, I went through multiple ways how you can list the mounted drives in Linux. I hope you will find the best match per your needs.
And if you have any queries, let me know in the comments.
How do I check where devices are mounted?
What is the command that lets me see what and where devices are mounted? I’m having trouble changing songs on my old iPod, and I have a feeling it’s because of the mount point.
3 Answers 3
There are at least three programs I know of that list device mount points:
- mount — mount a filesystem (used for general mount info too):
$ mount /dev/sda3 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) . /dev/mapper/lvmg-homelvm on /home type btrfs (rw,relatime,compress=lzo,space_cache) /dev/sda5 on /home/muru/arch type btrfs (rw,relatime,compress=lzo,space_cache) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 30832636 11993480 17249912 42% / none 4 0 4 0% /sys/fs/cgroup . /dev/sda5 31457280 3948600 25396496 14% /home/bro3886/arch
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 100M 0 part ├─sda2 8:2 0 58.5G 0 part ├─sda3 8:3 0 30G 0 part / ├─sda4 8:4 0 1K 0 part ├─sda5 8:5 0 30G 0 part ├─sda6 8:6 0 339.2G 0 part │ └─lvmg-homelvm (dm-0) 252:0 0 1.2T 0 lvm └─sda7 8:7 0 8G 0 part [SWAP] sdb 8:16 0 931.5G 0 disk └─sdb1 8:17 0 931.5G 0 part └─lvmg-homelvm (dm-0) 252:0 0 1.2T 0 lvm
Of these three, mount lists all the mountpoints, AFAICT. The others have their weaknesses.
- findmnt suggested by @webwurst is now my favourite tool for the job. It’s a Swiss Army knife when it comes to output control (newer versions can output in JSON too):
$ findmnt / TARGET SOURCE FSTYPE OPTIONS / /dev/sda1 ext4 rw,relatime,errors=remount-ro,data=ordered $ findmnt / -no source /dev/sda1 $ findmnt / --json < "filesystems": [ ] > $ findmnt / --df SOURCE FSTYPE SIZE USED AVAIL USE% TARGET /dev/sda1 ext4 40.2G 25.8G 12.5G 64% /
4 Ways to Show all Drives (Mounted and Unmounted) on Linux
The drives on any system can either be mounted or unmounted. The mounted drives are the ones that are ready to be accessed at any time whereas the data residing on the unmounted drives can only be accessed after these drives are mounted. In the proceeding section of this article, we want to share with you the different methods of displaying all available drives on Linux.
Display all Drives on Linux
To display all of your drives on a Linux system, you can perform any of the following four methods:
Method # 1: Using the “fdisk” Command
The “fdisk” command can be used to display the drives in Linux in the manner shown below:
The output produced by this command is shown in the following image:
Method # 2: Using the “blkid” Command:
The “blkid” command can be used to display available drives in Linux in the manner shown below:
The output produced by this command is shown in the following image:
Method # 3: Using the “lsblk” Command:
The “lsblk” command can be used to display the system drives in Linux in the manner shown below:
The output produced by this command is shown in the following image:
Method # 4: Using the “parted” Command:
The “parted” command can be used to display the disk partitions in Linux in the manner shown below:
The output produced by this command is shown in the following image:
Conclusion
By picking out any of the four methods shared in this article, you can conveniently find out all the mounted and unmounted drives on your Ubuntu system. Once you have this information, you can always mount a drive out of these whenever you wish to access its contents.
Search
About This Site
Vitux.com aims to become a Linux compendium with lots of unique and up to date tutorials.