[dm-crypt] LUKS is written to a device with no partition table. Is it possible to add a partition table?

Joe Hillenbrand joehillen at gmail.com
Tue Apr 19 21:08:37 CEST 2016


I posted this to https://gitlab.com/cryptsetup/cryptsetup/issues/292
but now I'm worried that might not be the appropriate place to ask
questions.

I have a 12TB hardware RAID5 external hard drive array.

I had initially planned to only ever encrypt data to the device, but now I
need about half encrypted and half not.

The device is `/dev/sdd`. It mounts as `fatty`.

There is no partition table.

    # dd if=/dev/sdd | hexdump -C | head -1
    00000000  4c 55 4b 53 ba be 00 01  61 65 73 00 00 00 00 00
|LUKS....aes.....|

    # parted /dev/sdd
    GNU Parted 3.2
    Using /dev/sdd
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print

    Error: /dev/sdd: unrecognised disk label
    Model: ORICO H/ W RAID5 (scsi)

    Disk /dev/sdd: 12.0TB
    Sector size (logical/physical): 512B/4096B
    Partition Table: unknown
    Disk Flags:

As you can see LUKS starts at the first byte of the device.

There is a btrfs filesystem on the LUKS device and I resized it down to 4TB.

    # cryptsetup status fatty
    /dev/mapper/fatty is active.
      type:    LUKS1
      cipher:  aes-xts-plain64
      keysize: 256 bits
      device:  /dev/sdd
      offset:  4096 sectors
      size:    23441764352 sectors
      mode:    read/write

    # btrfs filesystem show /dev/mapper/fatty
    Label: 'fatty'  uuid: XXX-XX-XX-XX-XXXXXXXXX
        Total devices 1 FS bytes used 2.75TiB
        devid    1 size 4.00TiB used 2.80TiB path /dev/mapper/fatty

I can't really move the data anywhere, because it's too big and would
require buying more hardware.
Is it possible to add a partition table without losing the data?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.saout.de/pipermail/dm-crypt/attachments/20160419/777a90b6/attachment.html>


More information about the dm-crypt mailing list