[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to enlarge LUKS partition ?



On Tue, 21 Aug 2012 00:25:38 +0200
"tv.debian@googlemail.com" <tv.debian@googlemail.com> wrote:

> On 20/08/2012 19:14, J. B wrote:
> > On Mon, 20 Aug 2012 17:57:31 +0200
> > "tv.debian@googlemail.com"<tv.debian@googlemail.com>  wrote:
> >
> >> On 20/08/2012 16:53, J. B wrote:
> >>>
> >>> Dear list,
> >>>
> >>> Is there anyone who is successful increasing LUKS partition ?
> >>> I have 2 physical partitions /dev/sda1 and /dev/sda2.
> >>> There is 800 GB free disk space (un-partitioned) between sda1&   sda2
> >>> Whole /dev/sda2 is dedicated to a LUKS partition which holds a LVM.
> >>> I have tried with gparted to increase /dev/sda2 but there is no support to increase luks.
> >>> How can I increase sda2, so that I can later execute cryptsetup resize ?
> >>>
> >>> Thanks
> >>>
> >>>
> >> Hi, I resized LUKS containers on several occasions, without lvm on top
> >> but it shouldn't be much more difficult.
> >> I usually operate from a live-cd, any will do as long as there is
> >> cryptsetup/lvm/whatever-filesystem-you-use support, or that you can
> >> install it.
> >> Close LUKS container if open (unmount partition, close lvm first if
> >> needed), fire up fdisk to destroy the partition that support the LUKS
> >> container, and recreate it with the desired size. fdisk commands are "d"
> >> (destroy),
> >
> > But it also destroy the data in LVM, no ?
> >
> 
> It doesn't.
> 
> When you are done with fdisk, start your luks container as usual:
> 
> cryptsetup luksOpen /dev/sda2 $dev_name
> 
> (anything starting with "$" needs to be replace by the correct device name)
> 
> cryptsetup resize $dev_name
> 
> Resize VG:
> 
> pvresize /dev/mapper/$vg_name
> 
> Resize LV:
> 
> lvresize -L +800GB /dev/$vg_name/$lv_name
> 
> (If size isn't correct the command output will give you the max extents 
> available, use that number with "-l" option)
> 
> Start LV:
> 
> vgchange -ay
> 
> Check filesystem, resize it, check again:
> 
> e2fsck -fp /dev/$vg_name/$lv_name
> 
> resize2fs /dev/$vg_name/$lv_name
> 
> e2fsck -fp /dev/$vg_name/$lv_name
> 
> 
> Mount filesystem and verify that data are still there. Just tested live 
> during my tea-break to make sure lvm wasn't screwing things.
> 
> The only difference with my system is that free space comes before the 
> LUKS container in your case, I never had this scenario (free space 
> always after LUKS).
> 

and that difference makes me nervous. I have gone through some more online tutorial, 

http://www.tuxevara.de/2010/03/resizing-a-luks-encrypted-root-filesystem-on-lvm/
http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition

where it is suggested to create the new partition starting from that *exact block* as the deleted one.
And my free space is before the partition not after.... so confused.... :-( 


Reply to: