[dm-crypt] Creating dm-crypt target from the second sector?

Ondrej Kozina okozina at redhat.com
Fri Jan 5 10:36:13 CET 2018


On 01/05/2018 10:09 AM, Lukáš Pohanka wrote:
> I was trying to create |dm-crypt| target from a partition using the 
> following command:
> 
> |dmsetup create target_name --table "1 $DEV_SZ crypt aes-xts-plain64 
> abababab...ab 0 /dev/sdb1 0"|
> 
> where |$DEV_SZ| is the total sector count of |/dev/sdb1| minus 1. In 
> other words, I want the DM to just skip the first sector on |/dev/sdb1| 
> (as I want to use that sector of sdb1 for a different purpose).
> 
> However, I got error:
> 
> |device-mapper: table: 253:0: crypt: Gap in table device-mapper: ioctl: 
> error adding target to table |
> 
> Is it possible for the device mapper to skip the first sector, or it 
> simply always has to start at 0?

It's possible. You've just slightly mixed offsets in your table.

Here's the correct one:

dmsetup create target_name --table "0 $DEV_SZ crypt aes-xts-plain64
 > abababab...ab 0 /dev/sdb1 1"

(the first offset is in fact offset in dm table, hence the error message 
about gap in table. the second offset after /dev/sdb1 device is offset 
in that device)

Regards
O.


More information about the dm-crypt mailing list