[dm-crypt] Cryptsetup-reencrypt failing with error with option --new reduce-device-size

Arno Wagner arno at wagner.name
Fri Jun 20 21:26:42 CEST 2014


Hi,

there is some relevant info in the FAQ at
   http://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions

1) There is an FAQ entry 
   "6.13 What is the smallest possible LUKS container?"
   It has some Examples as well.

2) The minimal size given by resize2fs is in blocks (of 1K).
   Yours wants ~45MB for some reason.
   For ext2, I managed to go down to 558k:

   > mke2fs /dev/loop0
   > resize2fs /dev/loop0 558k
   resize2fs 1.42.5 (29-Jul-2012)
   Resizing the filesystem on /dev/loop0 to 558 (1k) blocks.
   The filesystem on /dev/loop0 is now 558 blocks long.

   For ext3, resize2fs wants 4636k 
   For ext4, it wants 9048k.
   
   So for some reason, you have a filesystem where something 
   is larger. dumpe2fs gives you the fs data at the start,
   including the block size and other data. YOu can compare that
   to freshly generated filesystems, for example on loop-devices.
   Incidentally, FAQ item 2.6 tells you how to do loop-devices 
   with LUKS, you can use that to experiment.

Arno


On Fri, Jun 20, 2014 at 16:16:33 CEST, Abhrajyoti Kirtania wrote:
> Thank you for the reply.
> 
> How can i create unused space (shrink) at the end of original divide? As
> per the man page "fdisk -u /dev/sdb # move sdb1 partition end + 4096
> sectors" not giving expected result.
> 
> Even i tried with resize2fs but not helping
> 
> test at ubuntu:~/in-place$ sudo resize2fs /dev/sda8 4M
> 
> resize2fs 1.42.5 (29-Jul-2012)
> 
> resize2fs: New size smaller than minimum (45572)
> 
> 
> test at ubuntu:~/in-place$ sudo resize2fs /dev/sda8 8M
> 
> resize2fs 1.42.5 (29-Jul-2012)
> 
> resize2fs: New size smaller than minimum (45572)
> 
> 
> 
> 
> 
> 
> 
> 
> On Fri, Jun 20, 2014 at 6:59 PM, Ondrej Kozina <okozina at redhat.com> wrote:
> 
> > On 06/20/2014 02:36 PM, Abhrajyoti Kirtania wrote:
> >
> >> HI,
> >> I able to build the crypt setup-reencrypt binary and trying to enable
> >> encryption on a particular partition with this tool, build failing with
> >> error like:
> >>
> >> *Cannot wipe header on device /dev/loop0. if i pass
> >> *--reduce-device-size as 1024. But if i pass this size as 4096 then
> >>
> >> getting the error as "Device /dev/loop0 is too small."
> >>
> >> Not sure what might be the root cause of this error. Truly appreciate
> >> your kind support?
> >>
> >> cryptsetup-reencrypt /dev/sda8 --new --reduce-device-size 1024 --debug
> >>
> >>
> >> WARNING: this is experimental code, it can completely break your data.
> >>
> >> # cryptsetup 1.6.4 processing "./abhra_new/sbin/cryptsetup-reencrypt
> >> /dev/sda8 --new --reduce-device-size 1024 --debug"
> >>
> >
> > Hi Abhrajyoti,
> >
> > you have to create enough space to fit new LUKS header during reencryption
> > of not yet encrypted device. The LUKS header is approximately 1MiB in size
> > (it differs and depends also on other parameters). The default unit for
> > --reduce-device-size is a byte. Try to use --reduce-device-size 2048S
> > (where 'S' stands for sectors). If I recall correctly --reduce-device-size
> > must be aligned to 512B (dm-crypt sector size) or maybe even to page size
> > (4 KiB).
> >
> > Be extremely careful with the --new option! You have to create unused
> > space at the end of the original device which is equal in size to
> > --reduce-device-size option. By term unused  I mean there are no real
> > filesystem data or any data important to you. Otherwise you will you loose
> > this data. The best to achieve this would be to actually extend the partion
> > or LV at its end exactly by intended --redude-device-size parameter first.
> >
> > Kind regards
> > Ondrej
> >

> _______________________________________________
> dm-crypt mailing list
> dm-crypt at saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt


-- 
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
----
A good decision is based on knowledge and not on numbers. -  Plato


More information about the dm-crypt mailing list