Identify mounted filesystems
Transparency
Tools like mount and findmnt reveal which partitions and filesystems are mounted on your computer.
When creating a boot medium or expanding a system, you often need to create a new partition or add a filesystem to an existing partition. Selecting the wrong device can cost you valuable data.
Tools like partx
, fdisk
/cfdisk
, gdisk
/cgdisk
, mount
, lsblk
, and findmnt
help you discover which partitions and filesystems are present on the system and where they are currently mounted. We take you on a quick tour of some of these partition and filesystem tools, which are found on most of the standard Linux distributions.
Disk Tools
To make sure that you pass the correct parameters to the commands, you first need an overview of the volumes that exist on the system. The partx
program will help you here. The --show
switch tells it to list the individual partitions (Figure 1).
The output includes six columns with the partition number, start and end blocks, number of blocks, size, name, and UUID of the partition. The example shows six partitions /dev/sda1
, /dev/sda2
, and /dev/sda5
to /dev/sda8
.
This output already gives you a brief overview. However, it does not yet show you how the individual partitions are structured. fdisk
, which outputs the individual partitions if you pass in the -l
option (Figure 2), provides a little more information. However, the program only works for disks with a capacity of up to 2TBe, whereas the gfdisk
and Parted tools can analyze larger disks.
![](/var/linux_magazin/storage/images/issues/2019/222/filesystem-tools/figure-2/746635-1-eng-US/Figure-2_large.png)
Next up is cfdisk
. As you can see in Figure 3, cfdisk
provides even more information. This information includes the fact that /dev/sda1
is a primary partition, /dev/sda2
is an extended partition, and /dev/sda5
through /dev/sda8
contain logical partitions. In addition, it shows you the partition type – /dev/sda6
turns out to be a swap partition.
![](/var/linux_magazin/storage/images/issues/2019/222/filesystem-tools/figure-3/746638-1-eng-US/Figure-3_large.png)
cfdisk
has a counterpart named cgdisk
, which works the same way as fdisk
/gdisk
. When it comes to partition tables, fdisk
and cfdisk
only support Master Boot Record (MBR) format. MBR is a boot sector format that was popular with BIOS-based computers for many years. On the other hand, gdisk
and cgdisk
also support the GUID Partition Table (GPT) format. GPT is the successor to MBR for partition tables on hard disks and part of the UEFI standard. FigFigure 4 shows the cgdisk
menu after calling cgdisk -l /dev/sda
.
![](/var/linux_magazin/storage/images/issues/2019/222/filesystem-tools/figure-4/746641-1-eng-US/Figure-4_large.png)
However, all these programs do not help to detect whether the listed partitions are mounted in the filesystem or where they sit in the directory tree. If you want answers to these questions, the lsblk
program comes into play.
Mounted Disks
lsblk
(the abbreviation stands for "list block devices") shows all block devices. The default view in lsblk
includes only the devices or partitions currently in use (Figure 5). In the right-hand column, you will find the mount point (i.e., the position at which the device is mounted in the directory tree).
The output of lsblk
has six columns. Table 1 gives an overview of the information you get from this list.
Table 1
lsblk
NAME |
Device name |
MAJ:MIN |
Main and extension numbers of the device |
RM |
0 for fixed and 1 for removable devices (like CD/DVD drives) |
SIZE |
Storage capacity of the device in human readable form |
TYPE |
Type of device (see Table 2) |
MOUNTPOINT |
Directory in which the device is mounted |
Table 2
lsblk Types
disk |
Hard disk |
loop |
Loop device |
lvm |
Logic Volume Manager (LVM)1 partition |
part |
Partition on a storage medium |
rom |
CD/DVD drive |
1 LVM is the abstract partitioning schema across disks, partitions, and filesystems. LVM enables dynamically changeable partitions (logical volumes) across multiple hard disks. |
---|
Using the -a
switch helps lsblk
bring more devices to light by including devices that are not currently in use. For example, Figure 6 shows a series of loop devices (virtual block devices that do not map to a physical device, but use a file for underlying storage) from /dev/loop0
to /dev/loop7
.
Filesystems
The -a
switch tells you which partitions exist and under which mount points they are mounted in the filesystem. So far, however, you do not know which options were set when mounting the partition. The mount
command shows these kinds of details (Figure 7).
![](/var/linux_magazin/storage/images/issues/2019/222/filesystem-tools/figure-7/746650-1-eng-US/Figure-7_large.png)
The output from the command is quite extensive and often includes numerous virtual devices managed by the kernel and system programs. In many cases, however, only the physical mass storage devices and their mounted partitions are of interest.
Since Linux partitions mostly have the ext filesystem (today mostly ext4), you could filter the output of mount
with grep
accordingly. However, this detour is not actually necessary. Mount offers a -t
(short for --type
) switch that outputs filesystems of a certain type only. For example, the command in Figure 8 only returns partitions formatted with ext4.
![](/var/linux_magazin/storage/images/issues/2019/222/filesystem-tools/figure-8/746653-1-eng-US/Figure-8_large.png)
mount
provides so much information that clarity can suffer. The output of findmnt
from the same software package offers a better structure. When called without further options, findmnt
shows a tree view (Figure 9) from which you can see how the individual filesystems are mounted. The findmnt
command also identifies the origin and type of the filesystem and the options with which it was mounted.
![](/var/linux_magazin/storage/images/issues/2019/222/filesystem-tools/figure-9/746656-1-eng-US/Figure-9_large.png)
findmnt
also supports the -t
option, with which you can filter for ext4 filesystems, for example (Figure 10). Unlike mount
, findmnt
isn't limited to a single filesystem parameter but lets you enter several if required.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.