[dm-crypt] LUKS is written to a device with no partition table. Is it possible to add a partition table?
joehillen at gmail.com
Tue Apr 19 23:02:18 CEST 2016
Based on Milan's suggestion in the gitlab issue
(which was to dd 4TiB to another part of the device).
It looks like the first step is to figure out the exact number of blocks that
the btrfs filesystem lives on and where they are.
It turns out that 'cryptsetup resize' doesn't do what I though it did.
# blockdev --getsize /dev/sdd
# blockdev --getsize /dev/mapper/fatty
Is it safe to assume that the filesystem lives from blocks 4096 to
8589934592 (4TiB / 512 Bytes) + 4096?
8589934592 + 4096 = 8589938688
I'll add an extra 1GiB between the existing filesystem to the new filesystem.
(((4 TiB) + (1 GiB)) / (512 bytes)) + 4096 = 8592035840
Thus, this is what I think the dd command should be:
dd if=/dev/sdd of=/dev/sdd count=8589938688 seek=8592035840 bs=512
I will then be able to add a GPT and create an entry pointing to 8592035840.
Then if something goes wrong, I should be able to recover using:
dd if=/dev/sdd of=/dev/sdd count=8589938688 skip=8592035840 bs=512
Does this seem correct?
More information about the dm-crypt