Filesystems

如何轉儲文件系統超級塊的內容?

  • December 29, 2013

我知道我可以使用以下命令列出文件系統超級塊的位置。

例子

首先獲取目前目錄的設備句柄。

$ df -h .
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/fedora_greeneggs-home  402G  146G  236G  39% /home

然後使用此命令列出 handle 的超級塊/dev/mapper/fedora_greeneggs-home

$ sudo dumpe2fs /dev/mapper/fedora_greeneggs-home | grep -i superblock
dumpe2fs 1.42.7 (21-Jan-2013)
 Primary superblock at 0, Group descriptors at 1-26
 Backup superblock at 32768, Group descriptors at 32769-32794
 Backup superblock at 98304, Group descriptors at 98305-98330
 Backup superblock at 163840, Group descriptors at 163841-163866
 Backup superblock at 229376, Group descriptors at 229377-229402
 Backup superblock at 294912, Group descriptors at 294913-294938
 Backup superblock at 819200, Group descriptors at 819201-819226
 Backup superblock at 884736, Group descriptors at 884737-884762
 Backup superblock at 1605632, Group descriptors at 1605633-1605658
 Backup superblock at 2654208, Group descriptors at 2654209-2654234
 Backup superblock at 4096000, Group descriptors at 4096001-4096026
 Backup superblock at 7962624, Group descriptors at 7962625-7962650
 Backup superblock at 11239424, Group descriptors at 11239425-11239450
 Backup superblock at 20480000, Group descriptors at 20480001-20480026
 Backup superblock at 23887872, Group descriptors at 23887873-23887898
 Backup superblock at 71663616, Group descriptors at 71663617-71663642
 Backup superblock at 78675968, Group descriptors at 78675969-78675994
 Backup superblock at 102400000, Group descriptors at 102400001-102400026

但是如何實際檢查這些超級塊之一的內容呢?

我不確定如何檢查任何特定的超級塊,但您可以使用此命令檢查所有超級塊共享的一般內容,使用dumpe2fs.

$ sudo dumpe2fs /dev/mapper/fedora_greeneggs-home | less

例子

$ sudo dumpe2fs /dev/mapper/fedora_greeneggs-home | less
Filesystem volume name:   <none>
Last mounted on:          /home
Filesystem UUID:          xxxxxxx-xxxx-xxxx-xxxx-88c06ecdd872
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              26722304
Block count:              106857472
Reserved block count:     5342873
Free blocks:              67134450
Free inodes:              25815736
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      998
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Sat Dec  7 20:41:58 2013
Last mount time:          Sun Dec 22 21:31:01 2013
...

參考

引用自:https://unix.stackexchange.com/questions/106961