Jonah Havel
Jonah Havel

Reputation: 83

Linux command to list file systems available for mounting?

What terminal command will return data that includes the file systems that are currently available for mounting on my system?

Specifically, I am using Ubuntu 15.04, though I would prefer an answer that is valid for all *nix users.

NOTES: I don't want to know what IS mounted, I want to know what is available. I don't want to check the type of file system (ext2, ext4, ntsf, etc.), I want to know which file systems are available to be mounted (sda2, fd1, etc.).

Upvotes: 7

Views: 9958

Answers (3)

Jian Wang
Jian Wang

Reputation: 75

Regarding the question "command will return data that includes the file systems that are currently available for mounting on my system".

Granted from the powerful PROC file system, the available (or, static + dynamically installed) file systems in a running Linux could be found by:

cat /proc/filesystems

In my linux 3.10.0, the result is:

$cat /proc/filesystems  

nodev   sysfs  
nodev   rootfs  
nodev   ramfs  
nodev   bdev  
nodev   proc  
nodev   cgroup  
nodev   cpuset  
nodev   tmpfs  
nodev   devtmpfs  
nodev   debugfs  
nodev   securityfs  
nodev   sockfs  
nodev   dax  
nodev   bpf  
nodev   pipefs  
nodev   configfs  
nodev   devpts  
nodev   hugetlbfs  
nodev   autofs  
nodev   pstore  
....

This is the meta-data, the "mount" command will find and use.

Then, with below command, it lists all the mounted file systems.

$cat /proc/mounts

/dev/sda1 /boot xfs rw,relatime,attr2,inode64,noquota 0 0
...
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0

The third field of each line, like xfs or cgroup, is the "file system", which is just mentioned in previous command.

Upvotes: 3

Dan-Dev
Dan-Dev

Reputation: 9430

On Ubuntu you can use to show discs:

sudo lshw -class disk

or to check all partitions on your system

sudo blkid -o list | grep "not mounted"

or if you just want the device:

sudo blkid -o list | grep "not mounted" | awk '{print $1}'

Upvotes: 6

Juan Lago
Juan Lago

Reputation: 1048

You can list all the predefined filesystem in your /etc/fstab

The fstab file contain all the filesystem that are usually mounted on boot or can be ready for mount (Like the CDROM drive).

If you want to the current mounted filesystem you have just to type the command:

mount

or

cat /proc/mounts

and if you want to know which devices can you mount, you have take a look to kernel messages (specially when hotplug device like USB memories are used) using the following command:

dmesg

Upvotes: 0

Related Questions