VirtualBox:CentOSの破損したファイルシステムを修復する方法(fsck)

【中古車のガリバー】中古車購入

VirtualBoxで動かしてる CentOSの filesystem(ファイルシステム)に「UNEXPECTED INCONSISTENCY」エラーが発生することがあります。破損したファイルシステムを、fsckで修復する方法を記します。(2016/05/15作成)

stevepb / Pixabay

0. 環境情報

$ cat /etc/redhat-release 
CentOS release 6.7 (Final)

1. エラー状況

…
Checking filesystems
/dev/mapper/VolGroup-lv_root contains a file system with errors, check forced.
/dev/mapper/VolGroup-lv_root:
Deleted inode 524300 has zero dtime. FIXED.
/dev/mapper/VolGroup-lv_root: Inodes that were part of a corrupted orphan linked list found.

/dev/mapper/VolGroup-lv_root: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
	(i.e,, without -a or -p options)

*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** when you leave the shell.
Give root password for maintenance
(or type Control-D to continue):

2. エラー詳細

# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/VolGroup-lv_home on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (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.

3. 修復方法(fsck)

# fsck -t ext4 /dev/mapper/VolGroup-lv_root

修復作業が行われる、基本「エンターキー」押下してを進める。
…
Fix<y>? {enter}

(完了時メッセージ)
/dev/mapper/VolGroup-lv_root: ***** FILE SYSTEM WAS MODITIED *****
/dev/mapper/VolGroup-lv_root: ***** REBOOT LINUX *****
/dev/mapper/VolGroup-lv_root: 109867/3276800 files (0.1% non-contiguous), 906588/13107200 blocks

以上

About yoshimasa

埼玉県さいたま市在住、2男3女のパパです。Linux系の技術情報を中心にまとめています。1978年2月生まれ。