修复super block
root@test-server:~# dumpe2fs /dev/sde1
dumpe2fs 1.39 (29-May-2006)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sde1
Couldn't find valid filesystem superblock.
root@test-server:~# mke2fs -n /dev/sde1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1251712 inodes, 2500107 blocks
125005 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2562719744
77 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
root@test-server:~# mke2fs -b 32768 /dev/sde1
Warning: blocksize 32768 not usable on most systems.
mke2fs 1.39 (29-May-2006)
mke2fs: 32768-byte blocks too big for system (max 4096)
Proceed anyway? (y,n) y
Warning: 32768-byte blocks too big for system (max 4096), forced to continue
Filesystem label=
OS type: Linux
Block size=32768 (log=5)
Fragment size=32768 (log=5)
313600 inodes, 312513 blocks
15625 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=335503360
5 block groups
65528 blocks per group, 65528 fragments per group
62720 inodes per group
Superblock backups stored on blocks:
65528, 196584
root@test-server:/# dumpe2fs /dev/sde1
dumpe2fs 1.39 (29-May-2006)
Filesystem volume name:
Last mounted on:
Filesystem UUID: 5a41f602-e9f9-4e93-a7f0-c43c2fe12223
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: resize_inode dir_index filetype sparse_super large_file
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 313600
Block count: 312513
Reserved block count: 15625
Free blocks: 311257
Free inodes: 313589
First block: 0
Block size: 32768
Fragment size: 32768
Reserved GDT blocks: 4
Blocks per group: 65528
Fragments per group: 65528
Inodes per group: 62720
Inode blocks per group: 245
Filesystem created: Sat Dec 12 11:46:19 2015
Last mount time: n/a
Last write time: Sat Dec 12 11:46:19 2015
Mount count: 0
Maximum mount count: 34
Last checked: Sat Dec 12 11:46:19 2015
Check interval: 15552000 (6 months)
Next check after: Thu Jun 9 11:46:19 2016
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size:
128
Default directory hash: tea
Directory Hash Seed: ac3e3fad-b1e3-4af1-9da0-30d968cbfd44
Group 0: (Blocks 0-65527)
Primary superblock at 0, Group descriptors at 1-1
Reserved GDT blocks at 2-5
Block bitmap at 6 (+6), Inode bitmap at 7 (+7)
Inode table at 8-252 (+8)
65272 free blocks, 62709 free inodes, 2 directories
Free blocks: 256-65527
Free inodes: 12-62720
Group 1: (Blocks 65528-131055)
Backup superblock at 65528, Group descriptors at 65529-65529
Reserved GDT blocks at 65530-65533
Block bitmap at 65534 (+6), Inode bitmap at 65535 (+7)
Inode table at 65536-65780 (+8)
65275 free blocks, 62720 free inodes, 0 directories
Free blocks: 65781-131055
Free inodes: 62721-125440
Group 2: (Blocks 131056-196583)
Block bitmap at 131056 (+0), Inode bitmap at 131057 (+1)
Inode table at 131058-131302 (+2)
65281 free blocks, 62720 free inodes, 0 directories
Free blocks: 131303-196583
Free inodes: 125441-188160
Group 3: (Blocks 196584-262111)
Backup superblock at 196584, Group descriptors at 196585-196585
Reserved GDT blocks at 196586-196589
Block bitmap at 196590 (+6), Inode bitmap at 196591 (+7)
Inode table at 196592-196836 (+8)
65275 free blocks, 62720 free inodes, 0 directories
Free blocks: 196837-262111
Free inodes: 188161-250880
Group 4: (Blocks 262112-312512)
Block bitmap at 262112 (+0), Inode bitmap at 262113 (+1)
Inode table at 262114-262358 (+2)
50154 free blocks, 62720 free inodes, 0 directories
Free blocks: 262359-312512
Free inodes: 250881-313600
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Inode和Block相关知识
硬盘格式化的时候,操作系统自动将硬盘分成两个区域。一个是数据区,存放文件数据;另一个是inode区(inode table),存放inode所包含的信息。每个inode节点的大小,一般是128字节或256字节。inode节点的总数,在格式化时就给定,一般是每1KB或每2KB就设置一个inode。假定在一块1GB的硬盘中,每个inode节点的大小为128字节,每1KB就设置一个inode,那么inode table的大小就会达到128MB,占整块硬盘的12.8%。
每个inode都有一个号码,操作系统用inode号码来识别不同的文件。Unix/Linux系统内部不使用文件名,而使用inode号码来识别文件。对于系统来说,文件名只是inode号码便于识别的别称或者绰号。表面上,用户通过文件名,打开文件。实际上,系统内部这个过程分成三步:首先,系统找到这个文件名对应的inode号码;其次,通过inode号码,获取inode信息;最后,根据inode信息,找到文件数据所在的block,读出数据。文件储存在硬盘上,硬盘的最小存储单位叫做"扇区"(Sector)。每个扇区储存512字节(相当于0.5KB)。操作系统读取硬盘的时候,不会一个个扇区地读取,这样效率太低,而是一次性连续读取多个扇区,即一次性读取一个"块"(block)。这种由多个扇区组成的"块",是文件存取的最小单位。"块"的大小,最常见的是4KB,即连续八个 sector组成一个 block。文件数据都储存在"块"中,必须找到一个地方储存文件的元信息,比如文件的创建者、文件的创建日期、文件的大小等等。这种储存文件元信息的区域就叫做inode,中文译名为"索引节点"。