Skip to content

Commit 1e94318

Browse files
prgeormssonicbld
authored andcommitted
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
1 parent 2b21e64 commit 1e94318

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

files/initramfs-tools/fsck-rootfs

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ root_val=""
1111
set -- $(cat /proc/cmdline)
1212
for x in "$@"; do
1313
case "$x" in
14+
root=UUID=*)
15+
root_val="${x#root=UUID=}"
16+
blkdev=$(blkid --uuid $root_val)
17+
;;
1418
root=*)
15-
root_val="${x#root=}"
19+
blkdev="${x#root=}"
1620
;;
1721
esac
1822
done
1923

2024
# Check the filesystem we are using
21-
if [ ! -z $root_val ]; then
22-
fstype=$(blkid -o value -s TYPE $root_val)
25+
if [ ! -z $blkdev ]; then
26+
fstype=$(blkid -o value -s TYPE $blkdev)
2327
case "$fstype" in
2428
ext4)
2529
cmd="fsck.ext4 -v -p"
@@ -29,6 +33,6 @@ if [ ! -z $root_val ]; then
2933
;;
3034
esac
3135
if [ ! -z "$cmd" ]; then
32-
$cmd $root_val 2>&1 | gzip -c > /tmp/fsck.log.gz
36+
$cmd $blkdev 2>&1 | gzip -c > /tmp/fsck.log.gz
3337
fi
3438
fi

0 commit comments

Comments
 (0)