tune2fs: Couldn't find valid filesystem superblock

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-LogVol00
              ext3    41518344  29366024  10009296  75% /
/dev/sda1     ext3      101086     23532     72335  25% /boot
/dev/mapper/VolGroup02-LogVol00
              ext3    82537136  42421272  35923200  55% /u01
/dev/mapper/VolGroup01-LogVol00
              ext3   165107052 140918868  15801216  90% /u02
/dev/mapper/VolGroup03-LogVol00
              ext3   185749492 130321240  45992708  74% /u03
/dev/mapper/VolGroup04-LogVol00
              ext3   123822052  98380964  19151272  84% /u04
/dev/sdg1     ext4   104238720  74221532  24722168  76% /u05
tmpfs        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/sda
Couldn'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:   /boot
Last mounted on:          <not available>
Filesystem UUID:          2c1864be-127a-4cf5-98aa-a45affaaee72
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              26104
Block count:              104388
Reserved block count:     5219
Free blocks:              77538
Free inodes:              26064
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2008
Inode blocks per group:   251
Filesystem created:       Fri May  8 21:55:36 2015
Last mount time:          Sat Apr 25 14:03:18 2020
Last write time:          Sat Apr 25 14:03:18 2020
Mount count:              21
Maximum mount count:      -1
Last checked:             Sun Apr 30 12:55:19 2017
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      3505f19e-b37f-48d2-be11-0cdb80f8fb93
Journal 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-179a9ebcf6e8
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              32768000
Block count:              65534976
Reserved block count:     3275949
Free blocks:              48745374
Free inodes:              32767884
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1008
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   512
Filesystem created:       Fri Jun 29 20:31:12 2018
Last mount time:          Sat Apr 25 14:03:18 2020
Last write time:          Sat Apr 25 14:03:18 2020
Mount count:              1
Maximum mount count:      38
Last checked:             Sat Apr 25 13:56:09 2020
Check interval:           15552000 (6 months)
Next check after:         Thu Oct 22 13:56:09 2020
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      9ae513c5-c38c-4b3a-81f6-3746d2c8f23a
Journal 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% /dev
tmpfs                   tmpfs      1899164       0   1899164   0% /dev/shm
tmpfs                   tmpfs      1899164    8964   1890200   1% /run
tmpfs                   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% /home
tmpfs                   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/sda2
Couldn'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.

Keywords: Linux Fragment CentOS

Added by egroeg41 on Sun, 10 May 2020 17:14:41 +0300