我尝试使用 Luks2 加密带有现有 EXT4 分区的 HDD。首先,我为 LUKS2 标头腾出空间(我猜可能是这个问题……):
resize2fs / dev/sdc1 2929710000
然后我开始加密
cryptsetup reencrypt --encrypt --type luks2 --reduce-device.size 32m /dev/sdc1
现在我可以毫无问题地打开设备,但我无法安装它,并且 gdisk 的输出看起来很麻烦:
root@esprimo:~# gdisk -l /dev/mapper/sdc-crypt
GPT fdisk (gdisk) version 1.0.6
Warning: Partition table header claims that the size of partition table
entries is 3165299386 bytes, but this program supports only 128-byte entries.
Adjusting accordingly, but partition table may be garbage.
Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Disk /dev/mapper/sdc-crypt: 23437737983 sectors, 10.9 TiB
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): C8A0204A-192A-4437-A6C1-CD127AC8699A
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 23437770717
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 23437770717 10.9 TiB 8300
运行 wind gdisk 的结果是:
Caution! Secondary header was placed beyond the disk's limits! Moving the
header, but other problems may occur!
Warning! Secondary partition table overlaps the last partition by
32768 blocks!
You will need to delete this partition or resize it in another utility.
Problem: partition 1 is too big for the disk.
Aborting write operation!
Aborting write of new partition table.
我有希望恢复我的数据吗?非常感谢任何提示!