In this tutorial, I will show you the different ways to list mounted drives on Linux. We can use mount, findmnt, and df commands to list mounted device any Linux distribution like Ubuntu or Centos.
In Linux, mount command
mounts a storage device or filesystem, and let's go through commands that can display all those mounts.
1. Listing from /proc using cat command
To list mount points you can read contents of the file /proc/mounts.
In the following example, I have used cat command to read the /proc/mounts
file:
$ cat /proc/mounts
Output:
$ cat /proc/mounts
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=101468k,mode=755 0 0
/dev/xvda1 / ext4 rw,relatime,discard,data=ordered 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
lxcfs /var/lib/lxcfs fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
tracefs /sys/kernel/debug/tracing tracefs rw,relatime 0 0
tmpfs /run/user/76547979 tmpfs rw,nosuid,nodev,relatime,size=101468k,mode=700,uid=76547979,gid=76546561 0 0
~$ cat /proc/self/mounts
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=101468k,mode=755 0 0
/dev/xvda1 / ext4 rw,relatime,discard,data=ordered 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
lxcfs /var/lib/lxcfs fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
tracefs /sys/kernel/debug/tracing tracefs rw,relatime 0 0
tmpfs /run/user/76547979 tmpfs rw,nosuid,nodev,relatime,size=101468k,mode=700,uid=76547979,gid=76546561 0 0
2. Using Mount Command
You can use mount command to list mount points. When you run mount command without any options it will list mount points.
$ mount
Sample Outputs
~$ mount
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=101468k,mode=755)
/dev/xvda1 on / type ext4 (rw,relatime,discard,data=ordered)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
lxcfs on /var/lib/lxcfs type fuse.lxcfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
tmpfs on /run/user/76547979 type tmpfs (rw,nosuid,nodev,relatime,size=101468k,mode=700,uid=76547979,gid=76546561)
You may also use mount -l command which will list all mounted filesystem with labels.
$ mount -l
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=101468k,mode=755)
/dev/xvda1 on / type ext4 (rw,relatime,discard,data=ordered) [cloudimg-rootfs]
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=27,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
lxcfs on /var/lib/lxcfs type fuse.lxcfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
tmpfs on /run/user/76547979 type tmpfs (rw,nosuid,nodev,relatime,size=101468k,mode=700,uid=76547979,gid=76546561)
3. Using df command
You can use df command to list mount points.
The following command shows the output of df
with -aTh
option:
$ df -aTh
Filesystem Type Size Used Avail Use% Mounted on
sysfs sysfs 0 0 0 - /sys
proc proc 0 0 0 - /proc
udev devtmpfs 488M 0 488M 0% /dev
devpts devpts 0 0 0 - /dev/pts
tmpfs tmpfs 100M 11M 89M 11% /run
/dev/xvda1 ext4 7.7G 3.1G 4.7G 40% /
securityfs securityfs 0 0 0 - /sys/kernel/security
tmpfs tmpfs 496M 0 496M 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 496M 0 496M 0% /sys/fs/cgroup
cgroup cgroup 0 0 0 - /sys/fs/cgroup/systemd
pstore pstore 0 0 0 - /sys/fs/pstore
cgroup cgroup 0 0 0 - /sys/fs/cgroup/pids
cgroup cgroup 0 0 0 - /sys/fs/cgroup/net_cls,net_prio
cgroup cgroup 0 0 0 - /sys/fs/cgroup/cpu,cpuacct
cgroup cgroup 0 0 0 - /sys/fs/cgroup/cpuset
cgroup cgroup 0 0 0 - /sys/fs/cgroup/freezer
cgroup cgroup 0 0 0 - /sys/fs/cgroup/hugetlb
cgroup cgroup 0 0 0 - /sys/fs/cgroup/blkio
cgroup cgroup 0 0 0 - /sys/fs/cgroup/memory
cgroup cgroup 0 0 0 - /sys/fs/cgroup/perf_event
cgroup cgroup 0 0 0 - /sys/fs/cgroup/devices
systemd-1 - - - - - /proc/sys/fs/binfmt_misc
debugfs debugfs 0 0 0 - /sys/kernel/debug
mqueue mqueue 0 0 0 - /dev/mqueue
hugetlbfs hugetlbfs 0 0 0 - /dev/hugepages
fusectl fusectl 0 0 0 - /sys/fs/fuse/connections
lxcfs fuse.lxcfs 0 0 0 - /var/lib/lxcfs
binfmt_misc binfmt_misc 0 0 0 - /proc/sys/fs/binfmt_misc
tracefs - - - - - /sys/kernel/debug/tracing
tmpfs tmpfs 100M 0 100M 0% /run/user/76547979
You can use -t
followed by filesystem type (say ext3, ext4, nfs) to display respective mount points. For examples below df command display all NFS mount points.
# df -HP -t nfs
4. Using findmnt
Findmnt is a powerful tool to find mounted filesystems. This command comes with lots of options to list mount filesystems.
The following command print all mounted filesystems:
$ findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/xvda1 ext4 rw,relatime,discard,data=ordered
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup tmpfs tmpfs ro,nosuid,nodev,noexec,mode=755
│ │ ├─/sys/fs/cgroup/systemd cgroup cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd
│ │ ├─/sys/fs/cgroup/pids cgroup cgroup rw,nosuid,nodev,noexec,relatime,pids
│ │ ├─/sys/fs/cgroup/net_cls,net_prio cgroup cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio
│ │ ├─/sys/fs/cgroup/cpu,cpuacct cgroup cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct
│ │ ├─/sys/fs/cgroup/cpuset cgroup cgroup rw,nosuid,nodev,noexec,relatime,cpuset
│ │ ├─/sys/fs/cgroup/freezer cgroup cgroup rw,nosuid,nodev,noexec,relatime,freezer
│ │ ├─/sys/fs/cgroup/hugetlb cgroup cgroup rw,nosuid,nodev,noexec,relatime,hugetlb
│ │ ├─/sys/fs/cgroup/blkio cgroup cgroup rw,nosuid,nodev,noexec,relatime,blkio
│ │ ├─/sys/fs/cgroup/memory cgroup cgroup rw,nosuid,nodev,noexec,relatime,memory
│ │ ├─/sys/fs/cgroup/perf_event cgroup cgroup rw,nosuid,nodev,noexec,relatime,perf_event
│ │ └─/sys/fs/cgroup/devices cgroup cgroup rw,nosuid,nodev,noexec,relatime,devices
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/debug debugfs debugfs rw,relatime
│ │ └─/sys/kernel/debug/tracing tracefs tracefs rw,relatime
│ └─/sys/fs/fuse/connections fusectl fusectl rw,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=27,pgrp=1,timeout=0,minproto=5,maxproto=5,direct
│ └─/proc/sys/fs/binfmt_misc binfmt_misc binfmt_misc rw,relatime
├─/dev udev devtmpfs rw,nosuid,relatime,size=499356k,nr_inodes=124839,mode=755
│ ├─/dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev
│ ├─/dev/mqueue mqueue mqueue rw,relatime
│ └─/dev/hugepages hugetlbfs hugetlbfs rw,relatime
├─/run tmpfs tmpfs rw,nosuid,noexec,relatime,size=101468k,mode=755
│ ├─/run/lock tmpfs tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k
│ └─/run/user/76547979 tmpfs tmpfs rw,nosuid,nodev,relatime,size=101468k,mode=700,uid=76547979,gid=76546561
└─/var/lib/lxcfs lxcfs fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other
Print mount point by specific filesystem type:
$ findmnt -t ext4
TARGET SOURCE FSTYPE OPTIONS
/ /dev/xvda1 ext4 rw,relatime,discard,data=ordered
Search and list fstab contents:
$ findmnt -s
Display all /etc/fstab file and converts LABEL= and UUID= tags to the real device names:
$ findmnt --fstab --evaluate
Conclusion
In this tutorial, we learned commands to list mounted drives or filesystems on Linux. I hope you enjoyed reading and please leave your suggestion in the comment section.
Comments