Linux mount show all

How to get the complete and exact list of mounted filesystems in Linux?

I usually use mount to check which filesystems are mounted. I also know there is some connection between mount and /etc/mtab but I’m not sure about the details. After reading How to check if /proc/ is mounted I get more confused. My question is: How to get the most precise list of mounted filesystems? Should I just use mount , or read the contents of /etc/mtab , or contents of /proc/mounts ? What would give the most trustworthy result?

I can’t help linking to What is /etc/mtab in Linux? because it covers non-Linux details that none of the answers here give.

5 Answers 5

The definitive list of mounted filesystems is in /proc/mounts .

If you have any form of containers on your system, /proc/mounts only lists the filesystems that are in your present container. For example, in a chroot, /proc/mounts lists only the filesystems whose mount point is within the chroot. (There are ways to escape the chroot, mind.)

There’s also a list of mounted filesystems in /etc/mtab . This list is maintained by the mount and umount commands. That means that if you don’t use these commands (which is pretty rare), your action (mount or unmount) won’t be recorded. In practice, it’s mostly in a chroot that you’ll find /etc/mtab files that differ wildly from the state of the system. Also, mounts performed in the chroot will be reflected in the chroot’s /etc/mtab but not in the main /etc/mtab . Actions performed while /etc/mtab is on a read-only filesystem are also not recorded there.

The reason why you’d sometimes want to consult /etc/mtab in preference to or in addition to /proc/mounts is that because it has access to the mount command line, it’s sometimes able to present information in a way that’s easier to understand; for example you see mount options as requested (whereas /proc/mounts lists the mount and kernel defaults as well), and bind mounts appear as such in /etc/mtab .

Источник

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.

Читайте также:  No sound device linux

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% / 

Источник

How to List Mounted Drives on Linux

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 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 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.

Читайте также:  Kali linux две видеокарты

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.

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:

TARGET SOURCE FSTYPE OPTIONS / /dev/xvda1 ext4 rw,relatime,discard,data=ordered

Search and list fstab contents:

Читайте также:  Платформы windows macos linux

Display all /etc/fstab file and converts LABEL= and UUID= tags to the real device names:

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.

If this resource helped you, let us know your care by a Thanks Tweet. Tweet a thanks

Like

About The Author

Bobbin Zachariah

Bobbin Zachariah

Bobbin is a seasoned IT professional with over two decades of experience. He has excelled in roles such as a computer science instructor, Linux system engineer, and senior analyst. Currently, he thrives in DevOps environments, focusing on optimizing efficiency and delivery in AWS Cloud infrastructure. Bobbin holds certifications in RHEL, CCNA, and MCP, along with a Master’s degree in computer science. In his free time, he enjoys playing cricket, blogging, and immersing himself in the world of music.

Источник

Оцените статью
Adblock
detector