sck from util-linux 2.20.1 swapon: /dev/disk/by-uuid/22f27499-7be5-4b06-8a21-67b135c79fea: swapon failed: Invalid argument mountall: swapon /dev/disk/by-uuid/22f27499-7be5-4b06-8a21-67b135c79fea [2375] terminated with status 255 mountall: Problem activating swap: /dev/disk/by-uuid/22f27499-7be5-4b06-8a21-67b135c79fea /dev/sdb2: Superblock last mount time (Mon Dec 15 11:04:01 2014, now = Sun Feb 16 09:08:04 2014) is in the future.
/dev/sdb2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. (i.e., without -a or -p options) mountall: fsck /opt [2339] terminated with status 4 mountall: Filesystem has errors: /opt mountall: Skipping mounting /opt since Plymouth is not available
当时的解决方法是按提示的做。手动执行fsck。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
root@localhost:~# fsck /opt fsck from util-linux 2.20.1 e2fsck 1.42.9 (4-Feb-2014) Superblock last mount time (Mon Dec 15 11:04:01 2014, now = Sun Feb 16 09:10:26 2014) is in the future. Fix? yes /dev/sdb2 contains a file system with errors, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity /lost+found not found. Create? yes Pass 4: Checking reference counts Pass 5: Checking group summary information
/dev/sdb2: ***** FILE SYSTEM WAS MODIFIED ***** /dev/sdb2: 27/327680 files (0.0% non-contiguous), 56800/1310720 blocks
最关键的信息就是“Superblock last mount time is in the future”,直译过来,是超级块最后一次的挂载时间在未来。就是说,现在这个系统的时间,比上一次使用硬盘的时间,要早,在make编译时,也会遇到这种类似的问题。 网上有这方面的资料,无一例外都是修复磁盘。修复一次后,再也不出现这个问题了。 因此,上文提到的问题的解决,就是在出现只读时,用脚本去修复。因为系统上有2个分区,一个分区挂到根目录/,真正的程序在另一个分区,挂载到/app,当系统启动后,会运行/app/run.sh脚本。如果出现问题,这个分区是挂载不了的,但根分区还是可以挂载的。所以,在根分区中也创建同样的目录、同样的脚本中执行下面的脚本来修改。fsck -y表示直接修复,不用确认。
1 2 3 4 5 6
#!/bin/sh echo "run internal script and run fsck...." fsck / -y fsck /app -y sleep 1 reboot