Linuxが不意のシャットダウンや強制終了をした際に、起動時に
file systemがおかしくなり起動できなくなった場合に対処する方法をメモ
例えば下記のerrorが発生したとき
----------------------------------------------------
Checking filesystems
/dev/VolGroup00/LogVol00 contains a file system with errors, check forced.
/dev/VolGroup00/LogVol00: Inodes that were part of a corrupted orphan linked list found.
/dev/VolGroup00/LogVol00: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
[FAILED]
*** An error occurred during the file system check.
*** Dropping you to a shell; the system will rebbot
*** when you leave the shell.
Give root password for maintenance
(or type Control-D to continue):【root passwordを入力】
----------------------------------------------------
ログイン後、下記が表示される
(Repair filesystem) 1 #
mountにてディスク情報を取得
(Repair filesystem) 1 # mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
mount: warning: /etc/mtab is not writable (e.g. read-only filesystem).
It's possible that information reported by mount(8) is not
up to date. For actual information about system mount points
check the /proc/mounts file.
(Repair filesystem) 2 #
ディスク修復作業(途中でtab押せば保管される)
パーティションやディスクブロックは、修復箇所により変更されます。
自分が修復した際は下記の内容が出てました。
(Repair filesystem) 2 # fsck -t ext3 /dev/mapper/VolGroup00-LogVol00
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
/dev/mapper/VolGroup00-LogVol00 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix? y
Inode 2555572 was part of the orphaned inode list. FIXED.
Inode 9059010 was part of the orphaned inode list. FIXED.
Deleted inode 9059012 has zero dtime. Fix? y
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(2603277--2603283) -(2603289--2603291) -(2603315--2603321)
-(2603323--2603329) -(2603331--2603333) -(2603336--2603344) -9077760 -(9082880--9082882)
Fix? yes
Free blocks count wrong for group #79 (8309, counted=8345).
Fix? y
Free blocks count wrong for group #277 (31735, counted=31739).
Fix? y
Free bolock count wrong (11323080, counted=11323120).
Fix? y
Inode bitmap differences: -2555572 -9059010 -9059012
Fix? y
Free inodes count wrong for group #78 (27706, counted=27707).
Fix? y
Free inodes count wrong for group #277 (32698, counted=32700).
Fix? y
Directories count wrong for group #277 (3, counted=2).
Fix? y
Free inodes count wrong (12444755, counted=12444758).
Fix? y
/dev/mapper/VolGroup00-LogVol00: ***** FILE SYSTEM WAS MODIFIED *****
/dev/mapper/VolGroup00-LogVol00: ***** REBOOT LINUX *****
/dev/mapper/VolGroup00-LogVol00: 113578/12558336 files (1.7% non-contiguous), 1235216/12558336 blocks
(Repair filesystem) 3 # reboot
再起動して完了