I have a USB flash drive with one partition:
~ ↪ sudo sfdisk -l /dev/sdg
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sdg: 1.93 TiB, 2097152000000 bytes, 4096000000 sectors
Disk model: UDisk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: CD694404-4918-41D3-BD41-983C41DA28BB
Device Start End Sectors Size Type
/dev/sdg1 2048 4095997951 4095995904 1.9T Linux filesystem
I've created an encrypted container on sdg1 and can map that:
~ ↪ sudo cryptsetup luksOpen /dev/sdg1 encrypted
Enter passphrase for /dev/sdg1:
I've created an ext4 FS in the encrypted container
~ ↪ sudo mkfs.ext4 /dev/mapper/encrypted
mke2fs 1.45.5 (07-Jan-2020)
/dev/mapper/encrypted contains a ext4 file system
created on Sun Nov 21 18:31:32 2021
Proceed anyway? (y,N) y
Creating filesystem with 511995392 4k blocks and 128000000 inodes
Filesystem UUID: abb49b66-9e6a-4ee4-9ad5-45c86c7e5988
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
I cannot mount the file system, even after closing the container, removing the drive, and reinserting the drive:
~ ↪ sudo cryptsetup luksClose encrypted
~ ↪ ls /dev/mapper
control
<remove and reinsert USB flash drive>
~ ↪ lsblk /dev/sdg
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdg 8:96 1 1.9T 0 disk
└─sdg1 8:97 1 1.9T 0 part
~ ↪ sudo cryptsetup luksOpen /dev/sdg1 encrypted
Enter passphrase for /dev/sdg1:
~ ↪ ls /dev/mapper
control encrypted
~ ↪ ls -a /mnt/m
. ..
~ ↪ sudo file -Ls /dev/mapper/encrypted
/dev/mapper/encrypted: Linux rev 1.0 ext4 filesystem data, UUID=abb49b66-9e6a-4ee4-9ad5-45c86c7e5988 (errors) (extents) (64bit) (large files) (huge files)
~ ↪ sudo mount /dev/mapper/encrypted /mnt/m
mount: /mnt/m: wrong fs type, bad option, bad superblock on /dev/mapper/encrypted, missing codepage or helper program, or other error.
Any ideas?
Thanks