On Thu, Mar 13, 2025 at 7:48 PM Dave Close dave@compata.com wrote:
I have been trying to create an SDcard to use with an Raspberry Pi. The card is created using the rpi-imager program on Fedora (41) and that program reports the creation as successful. Later, after mounting the ext4 partition on the card under Fedora and doing two or three minutes of exploration, I encounter a bad block. So I unmount the partition and use e2fsck to locate any bad blocks and mark them:
e2fsck -y -c /dev/sdb2
But after that when I try to remount the partition, it seems that e2fsck has destroyed the filesystem!
# mount /dev/sdb2 /mnt mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdb2, missing codepage or helper program, or other error. dmesg(1) may have more information after failed mount system call.
Checking dmesg, I see that the mount has tried several possible filesystem types without success, including several lines like, "EXT4-fs (sdb2): VFS: Can't find ext4 filesystem". Explicitly adding "-t ext4" to the mount does not help.
I've repeated this process, again getting success, including verification, from rpi-imager. This time I omitted the -c from the e2fsck command and was able to mount the partition after.
So it appears that asking e2fsck to check for and mark bad blocks causes it to destroy the superblock(s). Is there another explanation?
Throw the old SDcard away, and use a new one. The old SDcard is clapped out.
I used to do a lot of testing of C and C++ libraries on ARM SBCs, like BeagleBoards, BananaPi's, Raspberry Pi's and WandBoards. The low resources (like 512 MB or 1 GB or RAM) and C++ compiler ensured I needed a swap file to build the libraries. I used to go through SDcards like they were dirty underwear. Once I started seeing filesystem errors I threw away the old card and used a new card with the board.
Jeff