Fix the fsck script that does filesystem repair (#17424)
Fix the fsck check which is not working. Potentially fixes #16938 Modified fsck script to run on the ext4.fsck on the appropriate disk where SONiC resides Microsoft ADO: 26098631
This commit is contained in:
parent
2b21e64ffc
commit
6b8549c3bb
@ -11,15 +11,19 @@ root_val=""
|
|||||||
set -- $(cat /proc/cmdline)
|
set -- $(cat /proc/cmdline)
|
||||||
for x in "$@"; do
|
for x in "$@"; do
|
||||||
case "$x" in
|
case "$x" in
|
||||||
|
root=UUID=*)
|
||||||
|
root_val="${x#root=UUID=}"
|
||||||
|
blkdev=$(blkid --uuid $root_val)
|
||||||
|
;;
|
||||||
root=*)
|
root=*)
|
||||||
root_val="${x#root=}"
|
blkdev="${x#root=}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check the filesystem we are using
|
# Check the filesystem we are using
|
||||||
if [ ! -z $root_val ]; then
|
if [ ! -z $blkdev ]; then
|
||||||
fstype=$(blkid -o value -s TYPE $root_val)
|
fstype=$(blkid -o value -s TYPE $blkdev)
|
||||||
case "$fstype" in
|
case "$fstype" in
|
||||||
ext4)
|
ext4)
|
||||||
cmd="fsck.ext4 -v -p"
|
cmd="fsck.ext4 -v -p"
|
||||||
@ -29,6 +33,6 @@ if [ ! -z $root_val ]; then
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [ ! -z "$cmd" ]; then
|
if [ ! -z "$cmd" ]; then
|
||||||
$cmd $root_val 2>&1 | gzip -c > /tmp/fsck.log.gz
|
$cmd $blkdev 2>&1 | gzip -c > /tmp/fsck.log.gz
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user