[dm-crypt] Re-align Payload for Existing dm-crypt/luks Container

Arno Wagner arno at wagner.name
Fri Jan 3 21:26:37 CET 2014

On Fri, Jan 03, 2014 at 19:54:44 CET, Baxter Kylie wrote:
> Hi,
> I just inherited a large array of disks (hw raid + luks + lvm) and was
> noticing some suboptimal performance. From what I can tell, it appears the
> original admin must have added some spindles to the array since luks is no
> longer properly aligned to the raid stripe. It's our largest array so,
> while a few hours of downtime are understandable, the weeks it would take
> to restore from tape would be impossible.

That indicates you have a broken backup procedure. What are
you going to do when the RAID breaks? Remember that RAID is not
backup. You should fix this...
> Is there a way to safely update the payload offset for an existing

No. Or at least not without usable backup. Don't start messing with 
this before you have fixed the backup!! 

> container without effectively destroying the container with a luksFormat? I

No. The sector-numbers will change, and decryption will not work
anymore as it is tied to the sector-numbers. And of course
some old sectors will not be in the payload area anymore if you
shift its start. If you shift the payload offset, you also have to
shift all data in the paylod. That is a high-risk operation in any 
case and shoul never be attempted without working backup.

> considered backing up the headers, luksFormat'ing with a new payload
> alignment, and restoring the headers but I think that the payload offset is
> stored in the headers so a restoration wouldn't do me much good. 

Why would you want to keep the header anyways? 

> Is there any other way to adjust this?

I think you are trying to do the wrong thing here. The payload-offset
should not be your problem and should have no influence on performance.

I wonder what your problem actually is, what is misaligned to the RAID
stripes? LUKS does not have any blocks or the like, it just uses raw 
512B sectors, and they cannot be misaligned to RAID stripes. Do you 
have some striping on filesystem-level? Then you should probably fix 
it there. Or are the RAID stripes misaligned with some 4K sectors? 
(That would not be a LUKS issue.) Then you should re-partition or move 
the partition(s). 
Maybe give a bit more info about what you think is not right and about
the set-up in general? 

Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: arno at wagner.name
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
There are two ways of constructing a software design: One way is to make it
so simple that there are obviously no deficiencies, and the other way is to
make it so complicated that there are no obvious deficiencies. The first
method is far more difficult.  --Tony Hoare

More information about the dm-crypt mailing list