From: Arno Wagner <arno@wagner.name>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] cryptsetup-reencode: LUKS-${UUID}.new is too small
Date: Thu, 13 Mar 2014 02:31:54 +0100 [thread overview]
Message-ID: <20140313013154.GA5434@tansi.org> (raw)
In-Reply-To: <20140313002938.GA31353@citd.de>
On Thu, Mar 13, 2014 at 01:29:38 CET, Matthias Schniedermeyer wrote:
> On 12.03.2014 21:29, PePa wrote:
> > Arno Wagner <arno@...> writes:
> > >
> > > On Wed, Mar 12, 2014 at 00:16:19 CET, PePa wrote:
> > > > I'm a big fan of dm-crypt/luks.
> > > > I'm trying to reencode a crypto_LUKS partition from -c aes-cbc-plain -s 128
> > > > -h sha1
> > > > like this:
> > > > cryptsetup-reencrypt -c twofish-xts-plain64 -s 512 -h sha512 -i 2000 -B 32
> > > > /dev/sda4
> > > >
> > > > Output I'm getting:
> > > > Device LUKS-71a94fa6-9c84-45d7-80e8-ee61be3887e0.new is too small.
> > > > Creation of LUKS backup headers failed.
> > > >
> > > > On it is a Physical lvm2-volume that could be shrunken. Is it just a matter
> > > > of doing that? How much more space is needed??
> > >
> > > If you look at FAQ Item 6.2, you an see that you go from a herader
> > > size a little over 1MB to one thet is 2MB in size. The difference
> > > does not sound like much and is indeed not much, but it has to
> > > be available.
> >
> > I shrunk the PV twice by 1 4MB extend, each time, but .new is still too
> > small. Does that mean that the PV somehow needs to be shifted to the
> > beginning of the luks partition? I don't want to use --reduce-device-size
> > before I know that the PV is not occupying that area.
>
> Your problem is that you gain the space on the "wrong side".
>
> If you imagine disc sectors/blocks as a stack, growing/shrinking
> adds/removes(or frees) blocks at the top.
That was my first take also, but the manpage for cryptsetup-
reencrypt option --reduce-device-size says
"This means that last sectors on the original device will be
lost, ciphertext data will be effectively shifted by specified
number of sectors."
This operation seems to shift the payload data towards the end by
the specified amount. So having enough space at the end inside the
LUKS container should work.
> In your case you would need to add blocks to the underside of the
> current stack or inbetween the current-header and the LUKS-payload-area.
>
> That would be possible if there is free space before sda4 and you could
> extend sda4 downward by decreasing the start of the partition by the
> amount needed for the bigger header.
That should also work. Make sure there is 2MiB space for the
header, and shift the start of the data payload area in the
repective header field.
> Or you would need to extend the
> partition or shrink the filesystem and then move the whole payload-area
> by the needed amount of blocks upwards (IOW copy each block the needed
> offset upwards, beginning from the top and working downwards) to
> accomodate the bigger header.
>
> But as Arno has already said, all that is not for the faint of heart and
> rather high-risk. "Backup & Restore" is a MUCH safer procedure.
Indeed. Reencryption is already crtical. Enlarging the header
in the barkain is another cirical thing on top that is in
addition error prone as youneed to to it exactly right.
You could do trial-runs on a smaller mock-up using a loop-file,
see FAQ Item 2.5 and only do the reencryption when you are sure.
Arno
--
Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: arno@wagner.name
GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. - Plato
next prev parent reply other threads:[~2014-03-13 1:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 23:16 [dm-crypt] cryptsetup-reencode: LUKS-${UUID}.new is too small PePa
2014-03-12 0:54 ` Arno Wagner
2014-03-12 21:29 ` PePa
2014-03-12 22:36 ` Arno Wagner
2014-03-13 0:29 ` Matthias Schniedermeyer
2014-03-13 1:31 ` Arno Wagner [this message]
2014-03-13 6:34 ` Milan Broz
2014-03-13 7:43 ` PePa
2014-03-18 22:43 ` [dm-crypt] cryptsetup-reencode:LUKS-${UUID}.new " PePa
2014-03-14 7:59 ` [dm-crypt] cryptsetup-reencode: LUKS-${UUID}.new " PePa
2014-03-14 13:22 ` Arno Wagner
2014-03-14 16:39 ` PePa
2014-03-14 16:46 ` PePa
2014-03-14 17:20 ` Milan Broz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140313013154.GA5434@tansi.org \
--to=arno@wagner.name \
--cc=dm-crypt@saout.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox