I want to enable the fsck function, but the following operations do not work. How can I do this?

Hi All:
I want to enable the fsck function, but the following operations do not work. How can I do this?
add fsck.repair=yes fsck.mode=force

root@tegra:/# more /boot/extlinux/extlinux.conf
TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      FDT /boot/dtb/kernel_tegra234-p3767-0000-p3768-0000-a0.dtb
      INITRD /boot/initrd
      APPEND ${cbootargs} root=PARTUUID=1bcd3315-ffb1-4ec9-82f4-227acb3f6b21 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 cons
ole=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb fsck.repair=yes fsck.mode=force

root@tegra:/# cat /etc/nv_tegra_release
# R35 (release), REVISION: 4.1, GCID: 33958178, BOARD: t186ref, EABI: aarch64, DATE: Tue Aug  1 19:57:35 UTC 2023

device:
Orin NX

log:

root@tegra:/# journalctl | grep fsck
Mar 15 23:04:15 tegra kernel: Kernel command line: root=PARTUUID=1bcd3315-ffb1-4ec9-82f4-227acb3f6b21 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb fsck.repair=yes fsck.mode=force
Mar 15 23:04:15 tegra systemd[1]: Listening on fsck to fsckd communication Socket.
Mar 15 23:04:22 tegra /usr/lib/gdm3/gdm-x-session[1530]: Kernel command line: root=PARTUUID=1bcd3315-ffb1-4ec9-82f4-227acb3f6b21 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb fsck.repair=yes fsck.mode=force
root@tegra:/#

hello wxsrite,

just double confirm I’m understand you correctly,
is the fsck you’re mentioned as file system consistency check?

Hi JerryChang:
The situation is like this, we mounted nvme, which had a problem. It was fixed by executing fsck operation in win 10. Therefore, I want to execute fsck before mounting the system to perform a disk check and repair.

robot@tegra:~$ lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0          7:0    0    16M  1 loop
zram0        251:0    0   970M  0 disk [SWAP]
zram1        251:1    0   970M  0 disk [SWAP]
zram2        251:2    0   970M  0 disk [SWAP]
zram3        251:3    0   970M  0 disk [SWAP]
zram4        251:4    0   970M  0 disk [SWAP]
zram5        251:5    0   970M  0 disk [SWAP]
zram6        251:6    0   970M  0 disk [SWAP]
zram7        251:7    0   970M  0 disk [SWAP]
nvme0n1      259:0    0 953.9G  0 disk
├─nvme0n1p1  259:1    0 952.4G  0 part /
├─nvme0n1p2  259:2    0   128M  0 part
├─nvme0n1p3  259:3    0   768K  0 part
├─nvme0n1p4  259:4    0  31.6M  0 part
├─nvme0n1p5  259:5    0   128M  0 part
├─nvme0n1p6  259:6    0   768K  0 part
├─nvme0n1p7  259:7    0  31.6M  0 part
├─nvme0n1p8  259:8    0    80M  0 part
├─nvme0n1p9  259:9    0   512K  0 part
├─nvme0n1p10 259:10   0    64M  0 part
├─nvme0n1p11 259:11   0    80M  0 part
├─nvme0n1p12 259:12   0   512K  0 part
├─nvme0n1p13 259:13   0    64M  0 part
├─nvme0n1p14 259:14   0   400M  0 part
└─nvme0n1p15 259:15   0 479.5M  0 part
robot@tegra:~$

Hi JerryChang:
Can I do fsck in boot? Is there a way?

hello wxsrite,

please try e2fsck or fsck, you should umount partition first, for instance, $ e2fsck -a -y <partition>

Hi JeerryChang:
I want to do this before mounting the SSD. Is there a way to do it?

hello wxsrite,

I don’t have experience with that, however, you may google it around for solutions as it’s not NV specific issues.

Hi JerryChang:
I want to do this in initrd(fsck), but need to debug, is there a way to get into the initrd’s system, without exiting?

hello wxsrite,

it’s initrd ($OUT/Linux_for_Tegra/bootloader/l4t_initrd.img) to do system initialization, and root file system mounting.

as you can see, it uses rootwait within kernel command-line.
for instance, Kernel command line: root=PARTUUID=965a1544-2f9c-4ae7-a7bd-4c2bf110ad2a rw rootwait rootfstype=ext4
according to documentation, canonical/linux-jammy/kernel-source/Documentation/admin-guide/kernel-parameters.txt
I’m not sure whether it helps with retain_initrd or keepinitrd. I don’t have experience with that. I’ve never test them before.

or…
you may build your customized initrd image for your use-case.

Hi JerryChang,
Can I support fsck in initrd?
I moved the fsck of the device directly to initrd, but when executing
fsck -y /dev/nvme0n1p1, the debugger does not have a device;
How can I generate /dev/nvme0n1p1?

We don’t know whether that is workable as we do not use fsck, and no experience with it.
Suggest to google it around for solutions. sorry for that.

Hi kayccc:
Is there a way for me to enter initrd when the device boots up? And stay in initrd?