can't mount /data while installing LineageOS I've rooted my Nexus 7 using the SO instructions How do I root my Nexus 7?.  I'm trying to install LineageOS using its instructions https://wiki.lineageos.org/devices/flo/install#installing-lineageos-from-recovery.  But steps 4 and 6 fail (making a backup, and wipe / advanced wipe).  Both failures include the messages Failed to mount '/data' (Invalid argument) and Unable to mount storage.
So /data may be corrupt.

From adb shell, ls /data shows that it's an empty directory;  mount /data fails with the same error Invalid argument.

From adb shell, the Nexus 7's /etc/fstab mentions /dev/block/mmcblk0p30 /data ext4 rw 0 0.  But when I try to repair that device with e2fsck, it finds no superblock, even with -b 8193.

From adb reboot bootloader, the screen shows SECURE BOOT - enabled and LOCK STATE - unlocked.  From that fastboot screen, if I select recovery mode, I see the teamwin TWRP 3.1.1-0 splash screen for 30 seconds, then I "swipe to allow modifications," and then I see TWRP's 8 big buttons.

Well, the backup and wipe buttons fail, so just for giggles, I tapped the button Install (LineageOS steps 7-10), and chose the lineage and open_gapps .zip files that I'd adb pushed to /sdcard.  To prevent the install from working, checked the checkbox "verify zip signature" without copying over the md5 files containing the signatures.  Besides the expected failure to verify the signatures, I saw these errors:

Failed to mount '/data' (Invalid argument)

Unable to recreate /data/media folder

E:Could not create /cache/recovery/

Unable to mount storage.

Can't open destination log file: '/cache/recovery/log'

Unable to mount /data/media/TWRP/.twrps

E:DataManager::Output_Version -- Unable to make /cache/recovery

Again, /data seems to be the problem.  I probably shouldn't attempt a real install before taking care of that.

How should I recover from these errors, to install LineageOS or, failing that, to restore the device to factory defaults?  (If it helps, I have another Nexus 7, unrooted.)
These /data-related errors are likely because TWRP can't decrypt the current /data partition. This often happens with stock ROMs, since TWRP is only made to handle the encryption method of AOSP.

To work around it, in TWRP, choose Wipe - Format Data. This will wipe all data from the device, but at the same time remove encryption and allow you to start off fresh. You can then reboot to recovery again to check if there are still errors displayed, and if not (it shouldn't), proceed with any other flashing actions.