How to avoid reformatting external sd card when "Issue with SD card" pops up again? The comments in Does “How will you use this SD card?” wipe data?
 indicate that the second option in the dialog &quot;Issue with SD card - Tap to fix&quot;, which is &quot;Use for portable storage&quot;, will also format the external SD card.
My external SD card works without issue from the recovery and I can also mount it after boot from the terminal, but the system does not make it visible e.g. to the file manager app.
I have reinstalled lineageOS recently and until the fourth or so reboot the SD card was working flawlessly and I already used it with the apps that now no longer see it. At the moment, the phone takes long to start with the external SD inserted, and often crashes after unlocking.
How can I avoid reformatting it but still get a behaviour where it works normally and there is no such &quot;issue with SD card&quot; notification?
I have had this issue in the past as well, on different devices, running a different version of (stock) android, with a different SD card. Oftentimes, a reboot or a reinsert of the card would fix it temporarily. But what is going on and how do I actually fix, or at least circumvent, it?
fsck works surprisingly well. At least if you have root. Not sure if that's required but I'd guess so.
I have outlined my process in this answer and mostly wrote this question so that future visitors have it easier to find this solution with the phrasing as I used here. The relevant parts again:

Figure out what your filesystem type is.
I did that from the recovery terminal using mount and blkid because then there aren't so many other block devices around (e.g. all the magisk devices). My device was called /dev/block/mmcblk0p1 and of type exfat.
Make sure the partition is not mounted. umount /dev/block/mmcblk0p1 should do the trick. Or boot to the system and since android detects an issue it does not mount it automatically. It looks to me like the available fsck is actually slightly different, at least in my case.
Run the relevant command for your filesystem type. Use tab completion to see your options. My command was fsck.exfat /dev/block/mmcblk0p1. Depending on your fsck you can also provide it with the -y flag to auto-fix everything without asking you every time.