I'm trying to run e2fsck
on boot of a persistent live lubuntu to fix 'corrupt filesystem' error of a writable system partition (ext4) and I want to automate this somehow (so ideally I do not want to boot into another live usb to do it)
I want to automate because these errors have a tendency to accumulate with restarts/shutdowns of the system (I do follow instructions and remove the USB stick on which the system is and then press Enter on shutdown/restart). After several months of use (maybe 100 shutdowns) the errors did accumulate so much, that the system became unable to boot.
I did fix the errors by booting another live system and then running:
umount -l /dev/sdc5
e2fsck -y /dev/sdc5
the /dev/sdc5 being the writable partition of the system mounted at /media/lubuntu/writable
In order to automate this for the future I've tried fixing the error from the same storage medium by:
- booting into the Recovery mode, yet
e2fsck
returned 'Target is busy', so the lazy unmount wasn't succesful. - hitting
e
in the GRUB menu and editingfsck.mode=none
tofsck.mode=force
and then booting (Ctrl+x/f10) but it did not fix the errors. - forcing
fsck
on boot by changing the maximum number of mounts bysudo tune2fs -c -1 /dev/sdb5
but it did not fix the errors
I'm not sure if in the last two cases the fsck did run and I don't know how to find out, I've tried to read the contents of several logs in /var/log but did not find a mention about it
my live system was made using mkusb and lubuntu 22.04.3 iso any help welcome
fsck
. – waltinator Dec 11 '23 at 17:13nopersistent
, do add that boot option into the 'linux' line that you use. Then when booted, it should work to usesudo e2fsck -f /dev/sdx5
, where x is the drive letter of the USB drive with your persistent live system. See this link for more details, – sudodus Dec 12 '23 at 12:57sed 's/quiet splash/nopersistent/' standard.iso > nopersistent.iso
and then flash it to a new drive using mkusb? In an ideal scenario for me, I would like to create a 'nopersistent' GRUB entry on the same stick that contains my persistent and live systems. Would that work? It would be great for debugging! – andrej Dec 13 '23 at 20:09persistent
withnopersistent toram
) and boot into a pure 'live-only' system, that should let you runsudo e2fsck -f /dev/sdx5
to repair the ext4 file system in your 'writable' partition. – sudodus Dec 13 '23 at 20:18