Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to Determine the File System Type in Linux (Ext2, Ext3 or Ext4)?
Linux supports various file system types like Ext2, Ext3, and Ext4, each with different features such as journaling and file size limits. Determining the file system type of your storage devices is essential for system administration and troubleshooting.
Using lsblk Command
The lsblk command displays all attached devices along with their file system types and partitions ?
$ lsblk -f
Running the above command gives us the following result −
NAME FSTYPE LABEL UUID MOUNTPOINT sr0 sda ??sda2 ??sda5 swap 02a54ace-c5c2-41cf-a679-acd9b460ee79 [SWAP] ??sda1 ext4 ae7c051f-451b-45ad-80a3-347c70a9de5e /
Using file Command
The file command provides detailed information about the disk file system type ?
$ sudo file -sL /dev/sda1
Running the above command gives us the following result −
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=ae7c051f-451b-45ad-80a3-347c70a9de5e (needs journal recovery) (extents) (large files) (huge files)
Using fsck Command
Though fsck is primarily used to repair file systems, it also reveals file system types ?
$ fsck -N /dev/sda1
Running the above command gives us the following result −
fsck from util-linux 2.27.1 [/sbin/fsck.ext4 (1) -- /] fsck.ext4 /dev/sda1
Checking /etc/fstab File
The /etc/fstab file contains mount points and file system configuration details. Use the cat command to view its contents ?
$ cat /etc/fstab
Running the above command gives us the following result −
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation UUID=ae7c051f-451b-45ad-80a3-347c70a9de5e / ext4 errors=remount-ro 0 1 # swap was on /dev/sda5 during installation UUID=02a54ace-c5c2-41cf-a679-acd9b460ee79 none swap sw 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
Using df Command
The df command with -Th options provides detailed file system information including type, usage, and mount points ?
$ df -Th
Running the above command gives us the following result −
Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 1.9G 0 1.9G 0% /dev tmpfs tmpfs 393M 12M 382M 3% /run /dev/sda1 ext4 19G 4.8G 13G 28% / tmpfs tmpfs 2.0G 420K 2.0G 1% /dev/shm tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup tmpfs tmpfs 393M 80K 393M 1% /run/user/1000
Conclusion
These commands provide different levels of detail about file system types in Linux. Use lsblk -f for a quick overview, df -Th for usage statistics, and file command for detailed file system information.
