tune2fs命令允許系統管理員在Linux ext2、ext3或ext4文件系統上調整、設置、查看文件系統參數。tune2fs -l 只會顯示 superblock 上的內容。有時候使用tune2fs命令遇到類似“Couldn't find valid filesystem superblock”... ...
tune2fs命令允許系統管理員在Linux ext2、ext3或ext4文件系統上調整、設置、查看文件系統參數。tune2fs -l 只會顯示 superblock 上的內容。有時候使用tune2fs命令遇到類似“Couldn't find valid filesystem superblock”這樣的錯誤,這個可能是因為你對該命令的一些細節或參數沒有註意的緣故。
1:tune2fs -l /dev/xxx tune2fs -l要跟具體的分區,而不是整個硬碟。否則會出現下麵錯誤:
[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 #參數是磁碟分區,而不是對應的磁碟
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:如果對磁碟分區做了LVM,那麼此時將分區作為tune2fs命令的參數將出現下麵錯誤。
[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.
正確的姿勢應該如下:
[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只能用於ext2、ext3、ext4文件類型,不支持其它文件類型
文件類型為xfs時。報“Couldn't find valid filesystem superblock.