Testing ext4 and auto fix
Keith
keithw at caramail.com
Wed Dec 6 22:57:19 UTC 2023
On 12/6/23 1:13 PM, Jerry Geis wrote:
>
>
> On Wed, Dec 6, 2023 at 1:54 PM Jose Luis Alarcon Sanchez
> <jlalarcon at planetmail.net <mailto:jlalarcon at planetmail.net>> wrote:
>
> On dic. 6 2023, at 7:06 pm, Jerry Geis <jerry.geis at gmail.com
> <mailto:jerry.geis at gmail.com>> wrote:
>
> > How do I enable "auto fix" no matter what on ext4 ?
> > Then how do I simulate that ?
> >
> >
> > I just tried doing on 22.04:
> > touch /forcefsck
> > shutdown -r now
> >
> > I did not see any file system check,
> > when I log back in the file is still present.
> >
> > When power goes out on my remote computer - I want it to come back up
> > no matter what.
> >
> > Thanks,
> >
> > Jerry
> >
>
> Hi Jerry.
>
> Isn´t with a dot in the instruction?. something like:
> touch /.forcefsck
>
> Try it. Nothing to loose.
>
> Regards.
> Jose Luis.
>
> --
> https://lordofunix.org/ <https://lordofunix.org/>
>
> Not Registered GNU/Hurd User.
> Registered BSD User 51101.
> Registered Linux User #213309.
> Memories..... You are talking about memories.
> Rick Deckard. Blade Runner.
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com <mailto:ubuntu-users at lists.ubuntu.com>
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> <https://lists.ubuntu.com/mailman/listinfo/ubuntu-users>
>
>
> Seems I had a typo on such a simple command. :)
> I created /forcefsck (not /forcefsk)
> I rebooted and the file is gone. OK.
>
> How then to just go ahead "fix" any issue. This is on a remote computer
> - and just need it to "fix" and boot.
> I did find /fsckoptions and I could put a -y in there - but how do I
> "simulate" a file system issue - so the fix will happen ?
>
Well you could always create a real issue with relatively minimal damage
to the filesystem if you want a real world test.
Log out of graphical environment and switch to a virtual terminal
Take system to runlevel 1 aka rescue mode
$ sudo telinit 1
force reboot without unmounting drives and not going through any proper
shutdown basically as if a brief power loss occurred.
# echo b > /proc/sysrq-trigger
When system is rebooted, check as root /run/initramfs/fsck.log
to see what fsck fixed. On my system, this resulted:
Log of fsck -C -a -V -t ext4 /dev/sda3
Wed Dec 6 21:39:32 2023
fsck from util-linux 2.37.2
[/usr/sbin/fsck.ext4 (1) -- /dev/sda3] fsck.ext4 -a -C0 /dev/sda3
/dev/sda3: recovering journal
/dev/sda3: clean
Normally, you don't need to force a fs check since the systemd-fsck-root
service will automatically detect whether it needs to run fsck on the
root filesystem on every boot and will initiate a safe repair if it
needs to.
To manually force a check, put fsck.mode=force in the kernel
command-line. Use fsck.repair=yes (default is "preen") to initiate
repairs that could potentially worsen a damaged filesystem.
Using tune2fs, you could also change the max-mount-count to 1 (assuming
the actual mount count is +1) which will force a fs check on every boot
until the max count is set to another number (0 or -1 to disable)
--
Keith
More information about the ubuntu-users
mailing list