今天的我們早上我的服務器無法啟動,停在檢查
mail.wofman.com/var filesystem bad ,我的mail文件在此目錄下;
Bad magic number in super_block while trying to open /var
***An error occured during the file system check
*** Dropping you to a shell; the system will reboot
*** when you leave the shell.
Press enter for maintenance
(or type Control-D to continue):
輸入admai pass 后進入 (Repair filesystem)#
查看/etc/fstab 沒有錯誤,
運行fsck -p /var
運行完畢有下面提示:
/dev/sda3 contains a file system with errors, check forced.
/dev/sda3: Inodes that were part of a corrupted orphan linked list found.
/dev/sda3: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
運行fsck.ext3 -p /dev/sda3 ;未能修復
運行fsck.ext3 -y /dev/sda3 ; repair ok
;注意在修復其他filesystem時要umount掉運行該命令。
文件系統--fsck
指令:fsck
使用權限 : 終極使用者
使用方式 : fsck --help
fsck 1.35 (28-Feb-2004)
fsck.ext3: invalid option -- h
Usage: fsck.ext3 [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]
[-I inode_buffer_blocks] [-P process_inode_size]
[-l|-L bad_blocks_file] [-C fd] [-j ext-journal]
[-E extended-options] device
Emergency help:
-p Automatic repair (no questions) ;自動修復
-n Make no changes to the filesystem ;模擬修復
-y Assume "yes" to all questions ;所有的問題都回答yes
-c Check for bad blocks and add them to the badblock list
;檢查壞塊,并記錄下壞塊列表
-f Force checking even if filesystem is marked clean
;對標記為“干凈”的文件系統進行強制檢查 v Be verbose ;周詳信息
-b superblock Use alternative superblock
-B blocksize Force blocksize when looking for superblock
-j external-journal Set location of the external journal
-l bad_blocks_file Add to badblocks list
-L bad_blocks_file Set badblocks list
引用網上的一個例子 :
問題: SLES8 在mount盤陣的時候,出現
server1:/ # mount /dev/sde1 /foo
mount: wrong fs type, bad option, bad superblock on /dev/sde1,
or too many mounted file systems
的問題。請問這種問題怎么能解決呢?
回答:
這個錯誤信息標識 /dev/sde1 設備上的 ext3 文件系統的終極塊損壞了,ext3 文件系統的元數據保存在終極塊中。
ext3 文件系統更有一些備份的終極塊,能嘗試用備份的終極塊加載 ext3 文件系統和修復 ext3 文件系統。
備份的終極塊信息能通過以下命令獲得,這個命令模擬 ext3 文件系統創建時的動作并打印出備份終極塊的位置,給出的位置缺省是以4k為單位的,mount 在使用時需要為他提供以1k為單位的偏移,需要乘4:
注意!!!!!一定要使用’-n’作為參數模擬 ext3 文件系統的創建而不是真的創建 ext3 文件系統
# mkfs.ext3 -n /dev/hda7
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2198880 inodes, 4393738 blocks
219686 blocks (5.00%) reserved for the super user
First data block=0
135 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
使用備份的終極塊來加載 ext3 文件系統的命令:
語法: mount.ext3 -o sb=n
# mount.ext3 -o sb=131072 /dev/hda7 /media/hda7
使用備份的終極塊來修復 ext3 文件系統的命令
語法:fsck.ext3 -b superblock
# fsck.ext3 -b 32768 /dev/hda7