Linux view filesystem type

Linux how to determine the file system type

All files accessible in a Linux system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices and they can be remote or local file system. Linux supports numerous file system types. For example it supports Ext2,. Ext3, NFS, FA16, FAT32, NTFS,Sysfs, Procfs etc. To determine the file system type or to find out what type of file systems currently mounted you need to use command called mount or df. Type df command as follows:
$ df -T Output:

df command report filesystem disk space usage and if you pass -T option it will report filesystem type. As you see second command displays file system type (ext3). Type, mount command as follows at shell prompt:
$ mount Output:

As you can see, second last column displays the file system type. For example first line [/dev/hdb1 on / type ext3 (rw,errors=remount-ro)] can be interpreted as follows:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

  • /dev/hdb1 : Partition
  • / : File system
  • ext3 : File system type
  • (rw,errors=remount-ro) : Mount options

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

7 Ways to Determine the File System Type in Linux (Ext2, Ext3 or Ext4)

A file system is the way in which files are named, stored, retrieved as well as updated on a storage disk or partition; the way files are organized on the disk.

A file system is divided in two segments called: User Data and Metadata (file name, time it was created, modified time, it’s size and location in the directory hierarchy etc).

In this guide, we will explain seven ways to identify your Linux file system type such as Ext2, Ext3, Ext4, BtrFS, GlusterFS plus many more.

1. Using df Command

df command reports file system disk space usage, to include the file system type on a particular disk partition, use the -T flag as below:

df Command – Find Filesystem Type

For a comprehensive guide for df command usage go through our articles:

2. Using fsck Command

fsck is used to check and optionally repair Linux file systems, it can also print the file system type on specified disk partitions.

The flag -N disables checking of file system for errors, it just shows what would be done (but all we need is the file system type):

fsck – Print Linux Filesystem Type

3. Using lsblk Command

lsblk displays block devices, when used with the -f option, it prints file system type on partitions as well:

Читайте также:  Kdbsync exe не работает windows

lsblk – Shows Linux Filesystem Type

4. Using mount Command

mount command is used to mount a file system in Linux, it can also be used to mount an ISO image, mount remote Linux filesystem and so much more.

When run without any arguments, it prints info about disk partitions including the file system type as below:

Mount – Show Filesystem Type in Linux

5. Using blkid Command

blkid command is used to find or print block device properties, simply specify the disk partition as an argument like so:

blkid – Find Filesystem Type

6. Using file Command

file command identifies file type, the -s flag enables reading of block or character files and -L enables following of symlinks:

file – Identifies Filesystem Type

7. Using fstab File

The /etc/fstab is a static file system info (such as mount point, file system type, mount options etc) file:

Fstab – Shows Linux Filesystem Type

That’s it! In this guide, we explained seven ways to identify your Linux file system type. Do you know of any method not mentioned here? Share it with us in the comments.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

10 basic & powerful commands to check file system type in Linux/Unix

Table of Contents

Any operating system must be able to access and manage files on storage devices; however, the manner in which the files are organized on a storage device is actually set by the underlying filesystem.With Linux and Unix there are various filesystem types, so in this article I will share multiple commands and methods to check file system type in Linux and Unix.

Before we try to determine and check file system type, we must be familiar with the term «File System».

What is a FileSystem?

As you probably know, or at least can guess, hard drives are not monolithic entities with data simply spread haphazardly around the hard drive. Hard drives are organized into sectors and clusters. Data of any type is organized into files. Whether it is a document, image, spreadsheet, or even an executable program, it is a file. That file may be stored in one or more clusters.

Filesystems are responsible to organize, find, and work with those files that are on the hard drive. There are issues that any filesystem must address in order to handle files effectively.

The first issue occurs because many files are larger than a single sector or cluster. So, locating the entirety of a file on a hard drive is an issue that must be addressed. The operating system may need to check several clusters, not necessarily contiguous, to find a file.

Another problem is how to store the files in clusters and sectors. Also, a filesystem must address how to handle space left due to deleted or moved files.

Now since we know what is a File System, Let us start with the actual agenda of this article.

Commands to check file system type in Linux or Unix

1. blkid

blkid can determine the type of content (e.g. filesystem or swap) that a block device holds, and also the attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).

You must execute blkid as root user without any directives and check » TYPE » field to check file system type of respective partition or device in Linux or Unix.

With -t, —match-token NAME=value , you can search for block devices with tokens named NAME that have the value value, and display any devices which are found. Common values for NAME include TYPE , LABEL , and UUID

For example to list and check file system type for ext4 FS:

2. lsblk

lsblk lists information about all available or the specified block devices. lsblk command provides more information, better control on output formatting, easy to use in scripts and it does not require root permissions to get actual information.

Читайте также:  Linux copy files over ssh

df is another popular and most used command to display the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown.

Using -T directive with df command you can print file system type of all the mounted file systems.

Alternatively you can specify a device with df command to check file system type of the respective device

4. findmnt

findmnt will list all mounted filesystems or search for a filesystem. The findmnt command is able to search in /etc/fstab , /etc/mtab or /proc/self/mountinfo . If device or mountpoint is not given, all filesystems are shown.

Using —fstab directive, findmnt command will search in /etc/fstab and with -t it will limit the set of printed filesystems

If used without any directive, findmnt command will give you long list of output with all bind mounts

5. file

file command is normally only attempts to read and determine the type of argument files. Specifying the -s option causes file to also read argument files which are block or character special files. This is useful for determining and to check file system types of the data in raw disk partitions, which are block special files

6. udevadm

udevadm command queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device.

Using —query you can query the database for the specified type of device data. The below command gives a long output so we will grep the required data to check file system type for our device /dev/sda1

Some more commands and methods to determine filesystem type in Linux or Unix

Now above were some of the most used commands to check file system type but there are many other methods using which you can determine filesystem type

7. File /etc/fstab content

Normally all the devices we use are mounted via /etc/fstab file to make the mounting reboot persistent. So you can always refer /etc/fstab file to check file system type, for example:

Here the first column of the file specifies the partition device path while the third column shows the file system type of the respective device.

8. File /etc/mtab content

Similar to /etc/fstab you can also refer /etc/mtab to get the list of currently mounted file system along with the file system type.

Here also the first column of the file specifies the partition device path while the third column shows the file system type of the respective device.

9. File /proc/mounts

Now /proc/mounts file refers /etc/mtab so this is not a new method but just another file which you can look into to check file system type in Linux or Unix.

10. mount command

Again, mount command will also refer /etc/mtab file to get the list of mounted file systems and can also help you determine file system type of individual devices.

Lastly I hope the methods and commands from the article to determine and check file system type on Linux and Unix was helpful. So, let me know your suggestions and feedback using the comment section.

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Источник

How To Find The Mounted Filesystem Type In Linux

As you may already know, Linux supports numerous filesystems, such as Ext4, ext3, ext2, sysfs, securityfs, FAT16, FAT32, NTFS, and many. The most commonly used filesystem is Ext4. Ever wondered what type of filesystem are you currently using in your Linux system? No? No prolem! This guide explains how to find the mounted filesystem type in Linux and Unix-like operating systems.

Find The Mounted Filesystem Type In Linux

There can be many ways to find the filesystem type in Linux. Here, I have given 8 different methods. Let us get started, shall we?

Method 1 — Find The Mounted Filesystem Type In Linux Using Findmnt

This is the most commonly used method to find out the type of a filesystem. The findmnt command will list all mounted filesystems or search for a filesystem. The findmnt command can be able to search in /etc/fstab, /etc/mtab or /proc/self/mountinfo.

Читайте также:  Как отключить автозагрузку яндекса windows 10

findmnt command comes pre-installed in most Linux distributions, because it is part of the package named util-linux. Just in case if it is not available, simply install this package and you’re good to go. For instance, you can install util-linux package in Debian-based systems using command:

Let us go ahead and see how to use findmnt command to find out the mounted filesystems.

If you run it without any arguments/options, it will list all mounted filesystems in a tree-like format as shown below.

Sample output:

Find The Mounted Filesystem Type In Linux Using Findmnt

As you can see, the findmnt command displays the target mount point (TARGET), source device (SOURCE), file system type (FSTYPE), and relevant mount options, like whether the filesystem is read/write or read-only. (OPTIONS). In my case, my root(/) filesystem type is EXT4.

If you don’t like/want to display the output in tree-like format, use -l flag to display in simple, plain format.

findmnt command output in tree-like format

You can also list a particular type of filesystem, for example ext4, using -t option.

Findmnt can produce df style output as well.

Sample output:

You can also display filesystems for a specific device, or mountpoint too.

Search for a device:

Search for a mountpoint:

You can even find filesystems with specific label:

For more details, refer the man pages.

The findmnt command is just enough to find the type of a mounted filesystem in Linux. It is created for that specific purpose only. However, there are also few other ways available to find out the filesystem type. If you’re interested to know, read on.

Method 2 — Find The Mounted Filesystem Type Using blkid command

The blkid command is used locate and print block device attributes. It is also part of the util-linux package, so you don’t bother to install it.

To list all block devices, simply run it without any parameters:

Sample output:

To find out the type of a filesystem of specific device, for example /dev/sda1, run:

You can also display more detailed information using command:

For more details, refer man pages.

Method 3 — Find The Mounted Filesystem Type Using df command

The df command is used to report filesystem disk space usage in Unix-like operating systems. To find the type of all mounted filesystems, simply run:

Sample output:

Find The Mounted Filesystem Type In Linux Using df command

For details about df command, refer the following guide.

Also, check man pages.

Method 4 — Find The Mounted Filesystem Type Using file command

The file command determines the type of a specified file. It works just fine for files with no file extension.

Run the following command to find the filesystem type of a partition:

Check man pages for more details:

Method 5 — Find The Mounted Filesystem Type Using fsck command

The fsck command is used to check the integrity of a filesystem or repair it. You can find the type of a filesystem by passing the partition as an argument like below.

For more details, refer man pages.

Method 6 — Find The Mounted Filesystem Type Using fstab Command

fstab is a file that contains static information about the filesystems. This file usually contains the mount point, filesystem type and mount options.

To view the type of a filesystem, simply run:

Find The Mounted Filesystem Type In Linux Using fstab Command

For more details, refer man pages.

Method 7 — Find The Mounted Filesystem Type Using lsblk command

The lsblk command displays the information about devices.

To display info about mounted filesystems, simply run:

For more details, refer man pages.

Method 8 — Find The Mounted Filesystem Type Using mount command

The mount command is used to mount a local or remote filesystems in Unix-like systems.

To find out the type of a filesystem using mount command, do:

For more details, refer man pages.

And, that’s all for now folks. You now know 8 different Linux commands to find out the type of a mounted Linux filesystems. If you know any other methods, feel free to let me know in the comment section below. I will check and update this guide accordingly.

Источник

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