The tune2fs command allows system administrators to adjust, set, and view file system parameters on a Linux ext2, ext3, or ext4 file system. tune2fs -l displays only the content on the superblock. Sometimes when using the tune2fs command, you encounter an error like "Couldn't find valid filesystem superblock". This may be because you didn't pay attention to some details or parameters of the command.
1: tune2fs -l /dev/xxx tune2fs -l should follow the specific partition, not the entire hard disk. Otherwise, the following error will occur:
[root@mylnx1 ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on/dev/mapper/VolGroup00-LogVol00ext3 41518344 29366024 10009296 75% //dev/sda1 ext3 101086 23532 72335 25% /boot/dev/mapper/VolGroup02-LogVol00ext3 82537136 42421272 35923200 55% /u01/dev/mapper/VolGroup01-LogVol00ext3 165107052 140918868 15801216 90% /u02/dev/mapper/VolGroup03-LogVol00ext3 185749492 130321240 45992708 74% /u03/dev/mapper/VolGroup04-LogVol00ext3 123822052 98380964 19151272 84% /u04/dev/sdg1 ext4 104238720 74221532 24722168 76% /u05tmpfs tmpfs 2026460 0 2026460 0% /dev/shm[root@mylnx1 ~]# tune2fs -l /dev/sda
tune2fs 1.39 (29-May-2006)tune2fs: Bad magic number in super-block while trying to open /dev/sdaCouldn't find valid filesystem superblock.[root@mylnx1 ~]# tune2fs -l /dev/sda1 #Parameter is the partition, not the corresponding disk
tune2fs 1.39 (29-May-2006)Filesystem volume name: /bootLast mounted on: <not available>Filesystem UUID: 2c1864be-127a-4cf5-98aa-a45affaaee72Filesystem magic number: 0xEF53Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_superDefault mount options: user_xattr aclFilesystem state: cleanErrors behavior: ContinueFilesystem OS type: LinuxInode count: 26104Block count: 104388Reserved block count: 5219Free blocks: 77538Free inodes: 26064First block: 1Block size: 1024Fragment size: 1024Reserved GDT blocks: 256Blocks per group: 8192Fragments per group: 8192Inodes per group: 2008Inode blocks per group: 251Filesystem created: Fri May 8 21:55:36 2015Last mount time: Sat Apr 25 14:03:18 2020Last write time: Sat Apr 25 14:03:18 2020Mount count: 21Maximum mount count: -1Last checked: Sun Apr 30 12:55:19 2017Check interval: 0 (<none>)Reserved blocks uid: 0 (user root)Reserved blocks gid: 0 (group root)First inode: 11Inode size: 128Journal inode: 8Default directory hash: teaDirectory Hash Seed: 3505f19e-b37f-48d2-be11-0cdb80f8fb93Journal backup: inode blocks
2: If LVM is applied to the partition, the following error will appear when the partition is used as a parameter of the tune2fs command.
[root@mylnx1 ~]# tune2fs -l /dev/sdg1
tune2fs 1.39 (29-May-2006)
tune2fs: Filesystem has unsupported feature(s) while trying to open /dev/sdg1
Couldn't find valid filesystem superblock.
The correct posture should be as follows:
[root@mylnx1 ~]# pvscan
PV /dev/sdg1 VG VolGroup06 lvm2 [250.00 GB / 0 free]PV /dev/sdh8 VG VolGroup06 lvm2 [39.12 GB / 0 free]PV /dev/sdf5 VG VolGroup05 lvm2 [199.97 GB / 0 free]..........................................................[root@mylnx1 ~]# tune2fs -l /dev/mapper/VolGroup06-LogVol00
tune2fs 1.39 (29-May-2006)Filesystem volume name: <none>Last mounted on: <not available>Filesystem UUID: a04472bb-c43e-45e8-8c6d-179a9ebcf6e8Filesystem magic number: 0xEF53Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal resize_inode dir_index filetype needs_recovery sparse_super large_fileDefault mount options: (none)Filesystem state: cleanErrors behavior: ContinueFilesystem OS type: LinuxInode count: 32768000Block count: 65534976Reserved block count: 3275949Free blocks: 48745374Free inodes: 32767884First block: 0Block size: 4096Fragment size: 4096Reserved GDT blocks: 1008Blocks per group: 32768Fragments per group: 32768Inodes per group: 16384Inode blocks per group: 512Filesystem created: Fri Jun 29 20:31:12 2018Last mount time: Sat Apr 25 14:03:18 2020Last write time: Sat Apr 25 14:03:18 2020Mount count: 1Maximum mount count: 38Last checked: Sat Apr 25 13:56:09 2020Check interval: 15552000 (6 months)Next check after: Thu Oct 22 13:56:09 2020Reserved blocks uid: 0 (user root)Reserved blocks gid: 0 (group root)First inode: 11Inode size: 128Journal inode: 8Default directory hash: teaDirectory Hash Seed: 9ae513c5-c38c-4b3a-81f6-3746d2c8f23aJournal backup: inode blocks
3: tune2fs can only be used for ext2, ext3 and ext4 file types, and other file types are not supported
When the file type is XFS. Report "Couldn't find valid filesystem superblock.". Note that tune2fs can only be used for ext2, ext3, and ext4 file types. For XFS types, tune2fs cannot be interpreted.
[root@KerryDB ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on/dev/mapper/centos-root xfs 52403200 4412324 47990876 9% /devtmpfs devtmpfs 1886508 0 1886508 0% /devtmpfs tmpfs 1899164 0 1899164 0% /dev/shmtmpfs tmpfs 1899164 8964 1890200 1% /runtmpfs tmpfs 1899164 0 1899164 0% /sys/fs/cgroup/dev/sda2 xfs 1038336 145936 892400 15% /boot/dev/mapper/centos-home xfs 430525040 1543444 428981596 1% /hometmpfs tmpfs 379836 0 379836 0% /run/user/0[root@KerryDB ~]# tune2fs -l /dev/sda2
tune2fs 1.42.9 (28-Dec-2013)tune2fs: Bad magic number in super-block while trying to open /dev/sda2Couldn't find valid filesystem superblock.
tune2fs applies only to ext[2-4] filesystems; not to XFS ones. The "Bad magic number in super-block" simply means that tune2fs doesn't understand the filesystem type. As you noted, the fact that your filesystem can be mounted confirms that it's viable.