mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
Try to fsck harder
This will potentially leave stuff in lost+found but may be able to recover from more filesystem corruption. See #736 Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
76c20080d9
commit
64bcf1adce
@ -7,6 +7,7 @@ depend()
|
|||||||
|
|
||||||
do_fsck()
|
do_fsck()
|
||||||
{
|
{
|
||||||
|
# preen
|
||||||
/sbin/e2fsck -p $*
|
/sbin/e2fsck -p $*
|
||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
# exit code 1 is errors corrected
|
# exit code 1 is errors corrected
|
||||||
@ -14,7 +15,17 @@ do_fsck()
|
|||||||
# exit code 2 or 3 means need to reboot
|
# exit code 2 or 3 means need to reboot
|
||||||
[ "${EXIT_CODE}" -eq 2 -o "${EXIT_CODE}" -eq 3 ] && /sbin/reboot
|
[ "${EXIT_CODE}" -eq 2 -o "${EXIT_CODE}" -eq 3 ] && /sbin/reboot
|
||||||
# exit code 4 or over is fatal
|
# exit code 4 or over is fatal
|
||||||
|
[ "${EXIT_CODE}" -lt 4 ] && return "${EXIT_CODE}"
|
||||||
|
|
||||||
|
# try harder
|
||||||
|
/sbin/e2fsck -y $*
|
||||||
|
# exit code 1 is errors corrected
|
||||||
|
[ "${EXIT_CODE}" -eq 1 ] && EXIT_CODE=0
|
||||||
|
# exit code 2 or 3 means need to reboot
|
||||||
|
[ "${EXIT_CODE}" -eq 2 -o "${EXIT_CODE}" -eq 3 ] && /sbin/reboot
|
||||||
|
# exit code 4 or over is fatal
|
||||||
[ "${EXIT_CODE}" -ge 4 ] && printf "Filesystem unrecoverably corrupted, will reformat\n"
|
[ "${EXIT_CODE}" -ge 4 ] && printf "Filesystem unrecoverably corrupted, will reformat\n"
|
||||||
|
|
||||||
return "${EXIT_CODE}"
|
return "${EXIT_CODE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user