In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail the example of viewing the mounted file system types in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
View mounted file system types in Linux
There are many ways to view mounted file system types in Linux, and I'll give you eight different ways below. Then let's get started now!
Method 1-use the findmnt command
This is the most commonly used method to find out the file system type. The findmnt command lists all mounted file systems or searches for a file system. The findmnt command can search in / etc/fstab, / etc/mtab, or / proc/self/mountinfo files.
Findmnt is pre-installed in most Linux distributions because it is part of the util-linux package. If the findmnt command is not available, you can install this package. For example, you can install the util-linux package on a Debian-based system using the following command:
$sudo apt install util-linux
Let's move on to see how to use findmnt to find mounted file systems.
If you just type the findmnt command without any arguments or options, it will list all mounted file systems in a tree as shown below.
$findmnt
Sample output:
As you can see, findmnt shows the target mount point (TARGET), source device (SOURCE), file system type (FSTYPE), and related mount options (OPTIONS), such as whether the file system is read, writeable or read-only. In my system, for example, the type of my root (/) file system is EXT4.
If you don't want to display the output in the form of a tree, you can use the-l option to show the output in a simple and mundane form:
$findmnt-l
You can also use the-t option to list specific types of file systems, such as the ext4 file system type shown below:
$findmnt-t ext4TARGET SOURCE FSTYPE OPTIONS/ / dev/sda2 ext4 rw,relatime,commit=360 └─ / boot / dev/sda1 ext4 rw,relatime,commit=360,data=ordered
Findmnt can also generate output of type df, using the command
$findmnt-df
Or
$findmnt-D
Sample output:
SOURCE FSTYPE SIZE USED AVAIL USE% TARGETdev devtmpfs 3.9G 0 3.9G 0% / devrun tmpfs 3.9G 1.1m 3.9G 0% / run/dev/sda2 ext4 456.3G 342.5G 90.6G 75% / tmpfs tmpfs 3.9G 32.2M 3.8G 1% / dev/shmtmpfs tmpfs 3.9G 03.9G 0% / sys/fs/cgroupbpf bpf 000-/ sys/fs/bpftmpfs tmpfs 3.9G 8.4M 3.9G 0% / tmp/dev/ Loop0 squashfs 82.1M 82.1M 0100% / var/lib/snapd/snap/core/4327/dev/sda1 ext4 92.8M 55.7M 30.1m 60% / boottmpfs tmpfs 788.8M 32K 788.8M 0% / run/user/1000gvfsd-fuse fuse.gvfsd-fuse 000-/ run/user/1000/gvfs
You can also show the file system type of a particular device or mount point.
View a specific device:
$findmnt / dev/sda1TARGET SOURCE FSTYPE OPTIONS/boot / dev/sda1 ext4 rw,relatime,commit=360,data=ordered
View a specific mount point:
$findmnt / TARGET SOURCE FSTYPE OPTIONS/ / dev/sda2 ext4 rw,relatime,commit=360
You can even look at the type of file system for a particular tag:
$findmnt LABEL=Storage
For more details, please refer to its man manual.
$man findmnt
The findmnt command is sufficient for the task of viewing mounted file system types in Linux, and this command is created for this particular task. However, there are other ways to look at the type of file system, and if you are interested, read on.
Method 2-use the blkid command
The blkid command is used to find and print the attributes of a block device. It's also part of the util-linux package, so you don't have to install it anymore.
To use the blkid command to view the type of a file system, run:
$blkid / dev/sda1
Method 3-use the df command
In Unix-like operating systems, the df command is used to report the disk space usage of the file system. To see all mounted file system types, simply run:
$df-T
Sample output:
For more details on the df command, you can refer to the guide below.
A tutorial on df commands for beginners
You can also refer to its man manual:
$man df
Method 4-use the file command
The file command can tell the type of a particular file, even if the file does not have a file suffix.
Run the following command to find out the file system type for a particular partition:
$sudo file-sL / dev/sda1 [sudo] password for sk:/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=83a1dbbf-1e15-4b45-94fe-134d3872af96 (needs journal recovery) (extents) (large files) (huge files)
Check out its man manual for more details:
$man file
Method 5-use the fsck command
The fsck command is used to check whether a file system is sound or to repair it. You can view the file system type of the partition by using the partition name as a parameter to fsck as follows:
$fsck-N / dev/sda1fsck from util-linux 2.32 [/ usr/bin/fsck.ext4 (1)-/ boot] fsck.ext4 / dev/sda1
If you want to know more, check its man manual:
$man fsck
Method 6-use the fstab command
Fstab is a file that contains static information about the file system. This file usually contains information such as mount point, file system type, and mount options.
To see the type of a file system, simply run:
$cat / etc/fstab
For more details, please refer to its man manual:
$man fstab
Method 7-use the lsblk command
The lsblk command displays information about the device.
To display information about a mounted file system, simply run:
$lsblk-fNAME FSTYPE LABEL UUID MOUNTPOINTloop0 squashfs / var/lib/snapd/snap/core/4327sda ├─ sda1 ext4 83a1dbbf-1e15-4b45-94fe-134d3872af96 / boot ├─ sda2 ext4 4d25ddb0-5b20-40b4-ae35-ef96376d6594 / └─ sda3 swap 1f8f5e2e-7c17-4f35-97e6-8bce7a4849cb [SWAP] sr0
For more details, refer to its man manual:
$man lsblk
Method 8-use the mount command
Mount is used to mount local or remote file systems in Unix-like systems.
To view the type of file system using the mount command, you can do something like this:
$mount | grep "^ / dev" / dev/sda2 on / type ext4 (rw,relatime,commit=360) / dev/sda1 on / boot type ext4 (rw,relatime,commit=360,data=ordered)
For more details, please refer to its man manual:
$man mount
Well, now you know eight different Linux commands to view the types of mounted Linux file systems. If you know other commands to accomplish the same task, please let us know in the comments section below, and I will confirm and upgrade this tutorial accordingly.
This is the end of this article on "viewing examples of mounted file system types in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.