背景:
Linux系统(Ubuntu)在运行时,断电等非正常关机操作,会导致ext4文件系统数据损坏。严重时会导致系统崩溃。如下log就是系统数据损坏。
[ 7.878756] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:742: group 0, 14845 clusters in bitmap, 14822 in gd
[ 8.484660] init: samba-ad-dc main process (995) terminated with status 1
[ 14.248075] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:742: group 1, 1 clusters in bitmap, 2 in gd
检查方法:
1、开机log,如上log就是开机时,kernel监测到文件系统错误;
2、比如要检查的分区是/dev/mmcblk0p2,如下红色字体部分就是系统错误的信息。
~# tune2fs -l /dev/mmcblk0p2
tune2fs 1.42.9 (4-Feb-2014)
Filesystem volume name:
Last mounted on: /
Filesystem UUID: ab013911-6048-465f-8a1a-cf1420c7bb01
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags: unsigned_directory_hash
Default mount options: user_xattr acl
Filesystem state: not clean with errors
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 393216
Block count: 1572864
Reserved block count: 78643
Free blocks: 289870
Free inodes: 169990
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 383
Blocks per grou