Use "tune2fs" on XFS filesystem, get "Couldn't find valid filesystem superblock."

18,817

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.

The XFS equivalent of of tune2fs -l is xfs_info.

Share:
18,817

Related videos on Youtube

nonemaw
Author by

nonemaw

Updated on September 18, 2022

Comments

  • nonemaw
    nonemaw almost 2 years

    I ran into this message two days ago=:

    tune2fs: Bad magic number in super-block while trying to open /dev/vdc1
    Couldn't find valid filesystem superblock.
    

    The system is Ubuntu, a KVM virtual machine under CentOS (host). And I have to add a new XFS file system on a new virtual hard drive.

    The new virtual hard drive is displayed as /dev/vdc, I created a new partition:

    fdisk /dev/vdc
        n
        p
        default
        +20G
        w
    

    Then I use mkfs to change the partition into XFS:

    mkfs.xfs -i size=1024 /dev/vdc1
    

    And this is the result of fdisk -l:

    root@server1:/# fdisk -l
    
    ....
    
    Disk /dev/vdc: 21.5 GB, 21474836480 bytes
    3 heads, 34 sectors/track, 411206 cylinders, total 41943040 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xc6bdd34a
    
    Device Boot      Start         End      Blocks   Id  System
    /dev/vdc1            2048    41943039    20970496   83  Linux
    
    ....
    

    And this is the result of blkid (/dev/vdc1 is XFS):

    root@server1:/# blkid
    /dev/vda1: UUID="2a5dd605-7774-4977-8f6c-79f70f222a65" TYPE="ext2" 
    /dev/vda5: UUID="aBuqo9-bgg0-gRLK-g5aG-xC9c-tdRx-znG819" TYPE="LVM2_member" 
    /dev/vdb: UUID="8L5N3N-EDmg-716P-Kk0t-4DID-x686-Ytlh2y" TYPE="LVM2_member" 
    /dev/vdc1: UUID="468ec0df-089b-4225-8519-fd4022db24ed" TYPE="xfs" 
    /dev/mapper/ubuntu--vg-root: UUID="61e644ad-2975-4017-879d-bb7933c7d6e9" TYPE="ext4" 
    /dev/mapper/ubuntu--vg-swap_1: UUID="01ca2938-35aa-4c5c-8de4-ed37dc971cd3" TYPE="swap" 
    

    And /dev/vdc1 is mountable, which means there is no SuperBlock Errors:

    root@server1:/# mkdir /data_test
    root@server1:/# mount /dev/vdc1 /data_test
    (mounted)
    

    And this is the result of df -h after mount /dev/vdc1:

    root@server1:/# df -h
    Filesystem                   Size  Used Avail Use% Mounted on
    udev                         990M   12K  990M   1% /dev
    tmpfs                        201M  456K  200M   1% /run
    /dev/mapper/ubuntu--vg-root   47G  2.2G   43G   5% /
    none                         4.0K     0  4.0K   0% /sys/fs/cgroup
    none                         5.0M     0  5.0M   0% /run/lock
    none                        1001M     0 1001M   0% /run/shm
    none                         100M     0  100M   0% /run/user
    /dev/vda1                    236M   38M  186M  17% /boot
    /dev/vdc1                     20G   33M   20G   1% /data_test
    

    But when I use tune2fs, it told me that /dev/vdc1 has superblock error:

    root@server1:/# tune2fs -l /dev/vdc1 | grep -i inode
    tune2fs: Bad magic number in super-block while trying to open /dev/vdc1
    Couldn't find valid filesystem superblock.
    

    How can I fix this error? I tried other commands such as xfs_repair, xfs_check, but they all not work

  • nonemaw
    nonemaw over 8 years
    Thank you I checked man page and you are right! Could you please help me with another issue? That in the case above, /dev/vdc1 is primary partition, and "mkfs.xfs" works fine. But when I created other partitions which are extended, such as /dev/vdc2, then the "mkfs.xfs" will fail with a message: "appears to contain a partition table (dos)", and it cannot be formatted into xfs
  • Will
    Will over 8 years
    I can also add that the XFS equivalent of of tune2fs -l is xfs_info.
  • Edward Torvalds
    Edward Torvalds over 5 years
    @Will reading manual of xfs_info I can say it does not change parameters of any partition but just shows the info of given xfs filesystem
  • gloschtla
    gloschtla over 4 years
    I got this same error on an ext4 file system, when trying to apply this method: unix.stackexchange.com/a/422687/184608 ---- tune2fs -o acl /dev/sdb1 --- tune2fs: Filesystem has unsupported read-only feature(s) while trying to open /dev/sdb1 NEW LINE: Couldn't find valid filesystem superblock. ... my device contains a ext4 partition, created on a different Linux device