- How do I check where devices are mounted?
- 3 Answers 3
- 8 Examples of findmnt Command to Check Mounted File Systems on Linux
- Install findmnt
- Using findmnt — Command Examples
- 1. List the file systems
- 2. Output in list format
- 3. df style output
- 4. Read file systems from fstab
- 5. Filter filesystems by type
- 6. Raw output
- 7. Search by source device
- 8. Search by mount point
- Summary
- How do I see all mounts in Linux?
- See mount points using findmnt:
- As you can see in the output, there are 4 columns:
- Show mount points using cat:
- See mount points using the mount command:
- Show mount points using df (Disk Free):
- What happens when we mount or unmount a device in Linux?
- Conclusion:
- About the author
- David Adams
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% /
8 Examples of findmnt Command to Check Mounted File Systems on Linux
The more common command to check mounted file systems on linux is the mount command which is used to not only list mounted devices, but also mount and unmount them as and when needed.
Here is another nifty command called findmnt, that can be used to take a quick look at what is mounted where and with what options.
The findmnt command shows details like the device name, mount directory, mount options and the file system type.
Install findmnt
The findmnt command comes from the packages util-linux which is installed by default on most distros like Ubuntu, Fedora, Debian
$ aptitude search util-linux i util-linux - Miscellaneous system utilities
Using findmnt — Command Examples
1. List the file systems
Running findmnt without any options would simply list out all the mounted file systems in a tree style layout.
2. Output in list format
The output can be formatted as a plain list, instead of the default tree style, using the l option making it convenient to read.
$ findmnt -l TARGET SOURCE FSTYPE OPTIONS /sys sysfs sysfs rw,nosu /proc proc proc rw,nosu /dev udev devtmpf rw,rela /dev/pts devpts devpts rw,nosu /run tmpfs tmpfs rw,nosu / /dev/disk/by-uuid/6fa5a72a-ba26-4588-a103-74bb6b33a763 ext4 rw,rela /sys/fs/cgroup tmpfs rw,rela /sys/fs/fuse/connections fusectl rw,rela /sys/kernel/debug debugfs rw,rela /sys/kernel/security securit rw,rela /run/lock tmpfs rw,nosu /run/shm tmpfs rw,nosu /run/user tmpfs rw,nosu /sys/fs/pstore pstore rw,rela /media/13f35f59-f023-4d98-b06f-9dfaebefd6c1 /dev/sda8 ext4 rw,nosu /media/4668484A68483B47 /dev/sda5 fuseblk rw,nosu /proc/sys/fs/binfmt_misc binfmt_misc binfmt_ rw,nosu /sys/fs/cgroup/systemd systemd cgroup rw,nosu /run/user/1000/gvfs gvfsd-fuse fuse.gv rw,nosu
3. df style output
Findmnt can produce a df style output reporting free and used disk space with the «-D» or «—df» option.
$ findmnt -D SOURCE FSTYPE SIZE USED AVAIL USE% TARGET devtmpfs devtmpfs 994.2M 0 994.2M 0% /dev selinuxfs selinuxfs 0 0 0 - /sys/fs/selinux tmpfs tmpfs 1001.5M 68K 1001.4M 0% /dev/shm tmpfs tmpfs 1001.5M 724K 1000.8M 0% /run tmpfs tmpfs 1001.5M 0 1001.5M 0% /sys/fs/cgroup /dev/mapper/fedora-root ext4 6.5G 5.3G 811.6M 82% / tmpfs tmpfs 1001.5M 60K 1001.5M 0% /tmp /dev/sda1 ext4 476.2M 107.7M 339.6M 23% /boot
Note that the above option is not available till util-linux version 2.20, which happened to be the latest version on Ubuntu 13.10
4. Read file systems from fstab
With the ‘-s’ or ‘—fstab’ option, findmnt shall read file systems only from the /etc/fstab file and /etc/fstab.d directory.
$ findmnt -s TARGET SOURCE FSTYPE OPTIONS / /dev/mapper/fedora-root ext4 defaults /boot UUID=18cde604-1c65-4ec8-8a8d-385df50ada3b ext4 defaults swap /dev/mapper/fedora-swap swap defaults
5. Filter filesystems by type
Findmnt can print out only specific file systems based on the type, for example ext4.
Multiple system types can be specified separated by a comma.
$ findmnt -t ext4 TARGET SOURCE FSTYPE OPTIONS / /dev/mapper/fedora-root ext4 rw,relatime,seclabel,data=ordered └─/boot /dev/sda1 ext4 rw,relatime,seclabel,data=ordered
6. Raw output
If you prefer a raw style ugly looking output then use the ‘-r’ or ‘—raw’ option.
$ findmnt --raw TARGET SOURCE FSTYPE OPTIONS /sys sysfs sysfs rw,nosuid,nodev,noexec,relatime /proc proc proc rw,nosuid,nodev,noexec,relatime /dev udev devtmpfs rw,relatime,size=4069060k,nr_inodes=1017265,mode=755 /dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 /run tmpfs tmpfs rw,nosuid,noexec,relatime,size=816716k,mode=755 / /dev/disk/by-uuid/6fa5a72a-ba26-4588-a103-74bb6b33a763 ext4 rw,relatime,errors=remount-ro,data=ordered /sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755 /sys/fs/fuse/connections fusectl rw,relatime /sys/kernel/debug debugfs rw,relatime /sys/kernel/security securityfs rw,relatime /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k /run/shm tmpfs rw,nosuid,nodev,relatime /run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755 /sys/fs/pstore pstore rw,relatime /media/13f35f59-f023-4d98-b06f-9dfaebefd6c1 /dev/sda8 ext4 rw,nosuid,nodev,relatime,errors=remount-ro,data=ordered /media/4668484A68483B47 /dev/sda5 fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096 /proc/sys/fs/binfmt_misc binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime /sys/fs/cgroup/systemd systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd /run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
7. Search by source device
To find the file system by the source device, specify the device path with or without the ‘-S’ option
$ findmnt -S /dev/sda1 TARGET SOURCE FSTYPE OPTIONS /boot /dev/sda1 ext4 rw,relatime,seclabel,data=ordered
8. Search by mount point
To search file system by the mount directory , specify the directory with or without the ‘-T’/’—target’ option.
$ findmnt -T / TARGET SOURCE FSTYPE OPTIONS / /dev/mapper/fedora-root ext4 rw,relatime,seclabel,data=ordered $ findmnt -T /media/4668484A68483B47 TARGET SOURCE FSTYPE OPTIONS /media/4668484A68483B47 /dev/sda5 fuseblk rw,nosuid,nodev,relatime,user_id=0
Summary
That was a little introduction to the findmnt command. There are few more options supported by findmnt which can be found in the man page.
Besides findmnt there are many other commands that can be used to check disk drives and mounted partitions on a linux system. Check this post for more:
10 Commands to Check Disk Partitions and Disk Space on Linux
A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected] .
How do I see all mounts in Linux?
I was asked how to see all mount points in Linux. Even though I always did it for myself using the mount command, I was surprised when I found there was no more human-friendly way I could explain. Thus I decided to write a tutorial that includes different techniques to achieve it.
While running commands to get mount points information is pretty easy, dealing with the output may not be comfortable for some users. After reading this tutorial, you’ll know how to get different outputs through different available commands: cat, findmnt, mount and df. Yet no format is really human friendly.
See mount points using findmnt:
The command findmnt lists all mount points. To do this the findmnt reads files /etc/fstab, /etc/fstab.d, /etc/mtab or /proc/self/mountinfo.
To run it, simply just the command below.
As you can see in the output, there are 4 columns:
- TARGET: This column shows the mount point.
- SOURCE: In this column, you can see the mounted device.
- FSTYPE: Here is described the file system.
- OPTIONS: This column shows mount point options, such as Read-Only or Writable.
You can get additional information on findmnt at https://linux.die.net/man/8/findmnt.
Show mount points using cat:
The most accurate technique to see mount points in Linux is reading the /proc/mounts file using cat. This is also the less human-friendly way, with the worse visual output.
The advantage of this method is that the kernel directly provides the information to see mount points over more human-friendly ways as alternatives explained in this tutorial
To see all mount points using cat, run the command as shown below.
As you can see, the output isn’t user friendly, but it is considered the most accurate method to check mounted devices in Linux.
See mount points using the mount command:
The mount is probably the most known command explained in this tutorial. Once we needed to run it every time we wanted to mount a device, it wasn’t automatic like today. By running it, you’ll get an output with all mounted filesystems. If followed by the -l flag, it will also show the mount point name; the output is similar to the mount command without flags.
As you can see, in the last two lines, there is a mounted pen drive containing a Kali Linux distribution.
Show mount points using df (Disk Free):
The df (Disk Free) command is also useful to print all mount points. The df command is mainly used to show available and used space on all storage devices.
To get an output with all mount points using df, just run it without additional options, as shown below.
Again you can see in the last line the /dev/sdb1 storage device is mounted.
This output displays 4 columns:
- Filesystem: This column shows the filesystem.
- 1K-Blocks: Here, you can see the size.
- Used: This column shows used space (in 1K blocks).
- Available: Available used space (in 1K blocks).
- Use%: Percentage of used space
- Mounted on: Mount point.
You can get more information on df at Linux Commands for Disk Space.
What happens when we mount or unmount a device in Linux?
When you mount a filesystem, like a cd, or a hard disk or USB stick, you create a mount point within your system. This mount point means virtually storing the cd, hard disk or USB stick’s content within your system. The files are not really stored in your system’s storage, but the system makes them accessible from itself by importing them under its filesystem hierarchy.
When you unmount a device, do exactly the opposite and instruct the system to stop providing mount points for external files.
Today mounting devices isn’t a common task since more user-friendly Linux distributions took over the market. Once, users needed to mount every external device manually, specifying the external device path and filesystem.
Conclusion:
As you can see, seeing all mounts in Linux is pretty easy. Linux offers you a variety of techniques to achieve this task by just running a command. As highlighted in the tutorial, the cat method is the most accurate and less human-friendly.
Other tools like findmnt feature a little improvement in the format, making it more user-friendly. Mounting, unmounting, and checking mount points status is a basic knowledge any Linux user-level must hold. Some Unix-like Linux distributions like Slackware don’t include automount enabled by default.
Thank you for reading this tutorial explaining how to see all mounts in Linux. Keep following Linux Hint for more Linux tips and tutorials.
About the author
David Adams
David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.