使用Pi 3和Raspberry Jessie时如何在启动时运行fsck?我已经阅读了一些教程,但是它们有所不同。
我已经跑步了,sudo touch /forcefsck
但是我还要做些什么?我知道我应该设置FSCKFIX = yes,但是正确的文件是什么?有人说/lib/init/vars.sh
别人/etc/default/rcS
。
如何验证我的设置正常工作?我看不到屏幕。断电,因此文件系统损坏的风险很高。
编辑:
我尝试了下面提到的两种解决方案。
1)通过使用sudo shutdown -rF now
/var/log/boot.log说:
[^[[32m OK ^[[0m] Started Load/Save Random Seed.
[^[[32m OK ^[[0m] Started Show Plymouth Boot Screen.
[ 3.679250] systemd-fsck[219]: fsck.fat 3.0.27 (2014-11-12)
[ 3.681320] systemd-fsck[219]: /dev/mmcblk0p1: 124 files, 2666/8057 clusters
[^[[32m OK ^[[0m] Started File System Check on /dev/mmcblk0p1.
Mounting /boot...
[^[[32m OK ^[[0m] Reached target Paths.
[^[[32m OK ^[[0m] Created slice system-systemd\x2drfkill.slice.
Starting Load/Save RF Kill Switch Status of rfkill0...
[^[[32m OK ^[[0m] Started Load/Save RF Kill Switch Status of rfkill0.
[^[[32m OK ^[[0m] Created slice system-ifup.slice.
[^[[32m OK ^[[0m] Mounted /boot.
[^[[32m OK ^[[0m] Reached target Local File Systems.
Starting Tell Plymouth To Write Out Runtime Data...
Starting Create Volatile Files and Directories...
Starting LSB: Raise network interfaces....
[^[[32m OK ^[[0m] Reached target Remote File Systems.
Starting Trigger Flushing of Journal to Persistent Storage...
Starting LSB: Prepare console...
Starting LSB: Switch to ondemand cpu governor (unless shift key is pressed)...
[^[[32m OK ^[[0m] Started Tell Plymouth To Write Out Runtime Data.
2)通过使用fsck.mode=force
和fsck.repair=yes
在/boot/cmdline.txt
bootlog中说:
[^[[32m OK ^[[0m] Started Show Plymouth Boot Screen.
[^[[32m OK ^[[0m] Reached target Paths.
[^[[32m OK ^[[0m] Created slice system-systemd\x2drfkill.slice.
[^[[32m OK ^[[0m] Created slice system-ifup.slice.
[ 5.749367] systemd-fsck[112]: Pass 2: Checking directory structure
[ 8.673500] systemd-fsck[112]: Pass 3: Checking directory connectivity
[ 8.683831] systemd-fsck[112]: Pass 4: Checking reference counts
[ 9.318835] systemd-fsck[112]: Pass 5: Checking group summary information
[ 9.518754] systemd-fsck[112]: /dev/mmcblk0p2: 131321/956160 files (0.2% non-contiguous$
[^[[32m OK ^[[0m] Started File System Check on Root Device.
Starting File System Check on /dev/mmcblk0p1...
Starting Remount Root and Kernel File Systems...
[^[[32m OK ^[[0m] Started Remount Root and Kernel File Systems.
Starting Load/Save RF Kill Switch Status of rfkill0...
Starting Load/Save Random Seed...
[^[[32m OK ^[[0m] Reached target Local File Systems (Pre).
[ 9.639259] systemd-fsck[239]: fsck.fat 3.0.27 (2014-11-12)
[^[[32m OK ^[[0m] Started Load/Save RF Kill Switch Status of rfkill0.
[ 9.644216] systemd-fsck[239]: /dev/mmcblk0p1: 124 files, 2666/8057 clusters
[^[[32m OK ^[[0m] Started File System Check on /dev/mmcblk0p1.
[^[[32m OK ^[[0m] Started Load/Save Random Seed.
Mounting /boot...
[^[[32m OK ^[[0m] Mounted /boot.
为什么在这两种情况下日志文件完全不同?
sudo shutdown -rF now
有何不同?Boot.log看起来完全不同。