昨日、私たちのコンピューターの1つがgrub
にドロップしました シェルまたは正直なところ、マシンの電源を入れたときのシェルが何であったかはわかりません。
不整合のため、この意味でルートファイルシステムなどをマウントできないことが示されました。
私は走った、と私は信じている:
fsck -fy /dev/sda2
再起動すると問題は解決しました。
ここに質問の部分があります:
私はすでに彼女のルートのcrontabにあります:
@reboot /home/ruzena/Development/bash/fs-check.sh
スクリプトに含まれている間:
#!/bin/bash
touch /forcefsck
考えてみると、なぜこんなに短いコマンドのスクリプトファイルを作成したのかわかりませんが、とにかく…
さらに、ファイル内:
/etc/default/rcS
私が定義したもの:
FSCKFIX=yes
わかりません。どうして状況が発生するのでしょうか?
起動時にルートファイルシステムのチェック(およびオプションで修正)を強制するにはどうすればよいですか?
それとも、これら2つのことは、私ができる最大のことですか?
OS: Linux Mint 18.xCinnamon64ビット。
fstab
:
cat /etc/fstab | grep ext4
ショー:
UUID=a121371e-eb12-43a0-a5ae-11af58ad09f4 / ext4 errors=remount-ro 0 1
grub
:
fsck.mode=force
すでにgrub
に追加されています 構成。
承認された回答:
ext4
起動中のファイルシステムチェック
OSでテスト済み:仮想マシンでのLinux Mint 18.x
基本情報
/etc/fstab
fsck
があります 最後(6番目)の列として注文します。例:
<file system> <mount point> <type> <options> <dump> <fsck>
UUID=2fbcf5e7-1234-abcd-88e8-a72d15580c99 / ext4 errors=remount-ro 0 1
FSCKFIX=yes
/etc/default/rcS
の変数
これにより、fsckが自動修正に変更されますが、は変更されません。 fsckチェックを強制します。
man rcS
から :
FSCKFIX When the root and all other file systems are checked, fsck is invoked with the -a option which means "autorepair". If there are major inconsistencies then the fsck process will bail out. The system will print a message asking the administrator to repair the file system manually and will present a root shell prompt (actually a sulogin prompt) on the console. Setting this option to yes causes the fsck commands to be run with the -y option instead of the -a option. This will tell fsck always to repair the file systems without asking for permission.
man tune2fs
から
If you are using journaling on your filesystem, your filesystem will never be marked dirty, so it will not normally be checked.
から始める
以下の設定
FSCKFIX=yes
ファイル内
/etc/default/rcS
前回fsがチェックされた時間を確認してメモします:
sudo tune2fs -l /dev/sda1 | grep "Last checked"
これら2つのオプションは機能しませんでした
-
-F
を渡す (fsck
を強制します 再起動時)shutdown
への引数 :shutdown -rF now
いいえ;参照:
man shutdown
。 -
/forcefsck
を追加する 空のファイル:touch /forcefsck
これらのスクリプトはこれを使用しているようです:
/etc/init.d/checkfs.sh /etc/init.d/checkroot.sh
しなかった 再起動で動作しますが、ファイルが削除されました。
確認者:
sudo tune2fs -l /dev/sda1 | grep "Last checked" sudo less /var/log/fsck/checkfs sudo less /var/log/fsck/checkroot
これらは
init
のログのようです スクリプト。
繰り返しますが、これら2つのオプションは機能しませんでした!
関連:MacbookはSnow LeopardとLionをデュアルブートできますか?これらの方法は両方とも機能しました
-
systemd-fsckカーネルブートスイッチ
メインの
grub
を編集する 構成ファイル:sudoedit /etc/default/grub
GRUB_CMDLINE_LINUX="fsck.mode=force"
sudo update-grub sudo reboot
これにより、次のように検証されたファイルシステムチェックが実行されました:
sudo tune2fs -l /dev/sda1 | grep "Last checked"
注:この DID チェックしますが、修正を強制するには、
fsck.repair="preen"
を指定する必要があります 、またはfsck.repair="yes"
。 -
tune2fs
の使用fsck
を実行する前にファイルシステムのマウント数を設定します 、man tune2fs
tune2fs' info is kept in the file system superblock
-c
スイッチは、fsをチェックする前にfsをマウントする回数を設定します。sudo tune2fs -c 1 /dev/sda1
確認方法:
sudo tune2fs -l /dev/sda1
このDID 検証済みの動作:
sudo tune2fs -l /dev/sda1 | grep "Last checked"
概要
fsck
を強制するには Linux Mint 18.xで起動するたびに、tune2fs
のいずれかを使用します 、またはfsck.mode=force
、オプションのfsck.repair=preen
/ fsck.repair=yes
、カーネルコマンドラインスイッチ。