This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
sonic-buildimage/files
Olivier Singla 18bbbb3c02 [baseimage]: Run fsck filesystem check support prior mounting filesystem (#4431)
* Run fsck filesystem check support prior mounting filesystem

If the filesystem become non clean ("dirty"), SONiC does not run fsck to
repair and mark it as clean again.

This patch adds the functionality to run fsck on each boot, prior to the
filesystem being mounted. This allows the filesystem to be repaired if
needed.

Note that if the filesystem is maked as clean, fsck does nothing and simply
return so this is perfectly fine to call fsck every time prior to mount the
filesystem.

How to verify this patch (using bash):

Using an image without this patch:

Make the filesystem "dirty" (not clean)
[we are making the assumption that filesystem is stored in /dev/sda3 - Please adjust depending of the platform]
[do this only on a test platform!]

dd if=/dev/sda3 of=superblock bs=1 count=2048
printf "$(printf '\\x%02X' 2)" | dd of="superblock" bs=1 seek=1082 count=1 conv=notrunc &> /dev/null
dd of=/dev/sda3 if=superblock bs=1 count=2048

Verify that filesystem is not clean
tune2fs -l /dev/sda3 | grep "Filesystem state:"

reboot and verify that the filesystem is still not clean
Redo the same test with an image with this patch, and verify that at next reboot the filesystem is repaired and becomes clean.

fsck log is stored on syslog, using the string FSCK as markup.
2020-06-16 08:12:11 -07:00
..
Aboot [Arista] Update drivers submodules (#4353) 2020-04-01 23:26:42 -07:00
apt [apt] Instruct apt-get to NOT check the "Valid Until" date in Release files (#3973) 2020-01-21 10:43:51 -08:00
build_scripts [build_debian] Include checksum of ASIC config files in SONiC filesystem (#3384) 2019-09-05 19:41:35 -07:00
build_templates Changes for LLDP docker to support multi-npu platforms (#4530) 2020-05-20 07:51:49 -07:00
dhcp ZTP infrastructure changes to support DHCP discovery provisioning data (#3298) 2020-03-03 22:23:59 -08:00
docker [docker-engine]: upgrade docker engine to 18.09 (#2417) 2019-01-04 20:47:43 -08:00
image_config [baseimage]: Run fsck filesystem check support prior mounting filesystem (#4431) 2020-06-16 08:12:11 -07:00
initramfs-tools [baseimage]: Run fsck filesystem check support prior mounting filesystem (#4431) 2020-06-16 08:12:11 -07:00
scripts Multi DB with namespace support, Introducing the database_global.json… (#4477) 2020-05-09 21:33:07 -07:00
sshd [security] Do not generate ssh server keys for non RSA protocols (#2718) 2019-03-29 15:27:33 -07:00