FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 08-20-2012, 02:53 PM
"J. B"
 
Default How to enlarge LUKS partition ?

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


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120820202341.15cb1fbd@shiva.selfip.org">http://lists.debian.org/20120820202341.15cb1fbd@shiva.selfip.org
 
Old 08-20-2012, 03:20 PM
Jochen Spieker
 
Default How to enlarge LUKS partition ?

J. B:
>
> 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.

You should be able to use any partitioning tool. AFAIK, gparted tries
not only to resize the partition, but containers and filesystems as
well. Without support for LVM, it apparently doesn't even try to resize
at least the partition.

> How can I increase sda2, so that I can later execute cryptsetup resize ?

I'd use parted (without being a big friend of its interface).

J.
--
I think the environment will be okay.
[Agree] [Disagree]
<http://www.slowlydownward.com/NODATA/data_enter2.html>
 
Old 08-20-2012, 03:57 PM
"tv.debian@googlemail.com"
 
Default How to enlarge LUKS partition ?

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), choose partition number, then "n" (new), type of partition,
beginning and ending of new partition, and finally "w" to write changes
to disk.


Open the LUKS container, resize it to fill the new partition
("cryptsetup resize $container-name")


Now you'll need to resize the lvm layer. Someone more familiar with lvm
may fill in this stage for you, Google or "man lvm" can do that too.


When done activate the lv and resize filesystem ("resize2fs"), and
finally "fsck" the filesystem and eventually mount it to check that
everything is in good order.


The only mildly tricky part is to get your numbers right (partition
number and size) in fdisk.


Cautious penguin says: Write down exact commands for each step before
you proceed for the first time, and refresh your backup.



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 50325E6B.2050708@googlemail.com">http://lists.debian.org/50325E6B.2050708@googlemail.com
 
Old 08-20-2012, 05:13 PM
"J. B"
 
Default How to enlarge LUKS partition ?

On Mon, 20 Aug 2012 17:20:41 +0200
Jochen Spieker <ml@well-adjusted.de> wrote:

> J. B:
> >
> > 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.
>
> You should be able to use any partitioning tool. AFAIK, gparted tries
> not only to resize the partition, but containers and filesystems as
> well. Without support for LVM, it apparently doesn't even try to resize
> at least the partition.
>
> > How can I increase sda2, so that I can later execute cryptsetup resize ?
>
> I'd use parted (without being a big friend of its interface).
>
> J.

Hi J,

no luck with parted. It throws error "couldn't detect filesystem"


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120820224320.6614d8d5@shiva.selfip.org">http://lists.debian.org/20120820224320.6614d8d5@shiva.selfip.org
 
Old 08-20-2012, 05:14 PM
"J. B"
 
Default How to enlarge LUKS partition ?

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 ?


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120820224440.51d89a7b@shiva.selfip.org">http://lists.debian.org/20120820224440.51d89a7b@shiva.selfip.org
 
Old 08-20-2012, 08:35 PM
Jochen Spieker
 
Default How to enlarge LUKS partition ?

J. B:
> Jochen Spieker <ml@well-adjusted.de> wrote:
>
>> I'd use parted (without being a big friend of its interface).
>
> no luck with parted. It throws error "couldn't detect filesystem"

If you don't tell me what exactly you are doing, I cannot tell you what
you are doing wrong.

Anyway, a minute of googling suggests that parted cannot be used to do
what you want, I was wrong about that. But the Ubuntu formums have a
fairly extensive howto about topic:

http://ubuntuforums.org/showthread.php?p=4530641

If your filesystem is not system-essential you do not need to boot off a
live CD/DVD. And I would skip the step that involves creating a dummy
partition that gets overwritten with random data.

J.
--
My medicine shelf is my altar.
[Agree] [Disagree]
<http://www.slowlydownward.com/NODATA/data_enter2.html>
 
Old 08-20-2012, 10:25 PM
"tv.debian@googlemail.com"
 
Default How to enlarge LUKS partition ?

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.co m> 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).





--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 5032B962.90506@googlemail.com">http://lists.debian.org/5032B962.90506@googlemail.com
 
Old 08-21-2012, 09:46 AM
"J. B"
 
Default 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.co m> 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.... :-(


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120821151617.330c7de8@shiva.selfip.org">http://lists.debian.org/20120821151617.330c7de8@shiva.selfip.org
 
Old 08-21-2012, 10:56 AM
"tv.debian@googlemail.com"
 
Default How to enlarge LUKS partition ?

On 21/08/2012 11:46, J. B wrote:

On Tue, 21 Aug 2012 00:25:38 +0200
"tv.debian@googlemail.com"<tv.debian@googlemail.co m> 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.co m> 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),



[...cut...]

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.... :-(



You could go a safer way by creating a new LUKS + lvm on your free
space, migrate your system/data, adjust system to the new UUIDs/lvm
names, and then destroy sda2 and grow the new container. It will take
longer and you'll need to tinker a bit with your system configuration to
adjust it to the new partition/LUKS container/lvm.


(If) I have some spare time later today I'll test your use-case (free
space before LUKS) and report here, I am curious too.



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 50336974.9090606@googlemail.com">http://lists.debian.org/50336974.9090606@googlemail.com
 
Old 08-21-2012, 05:22 PM
"J. B"
 
Default How to enlarge LUKS partition ?

On Tue, 21 Aug 2012 12:56:52 +0200
"tv.debian@googlemail.com" <tv.debian@googlemail.com> wrote:

> On 21/08/2012 11:46, J. B wrote:
> > On Tue, 21 Aug 2012 00:25:38 +0200
> > "tv.debian@googlemail.com"<tv.debian@googlemail.co m> 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.co m> 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),
> >>>
> [...cut...]
> >> 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.... :-(
> >
>
> You could go a safer way by creating a new LUKS + lvm on your free
> space, migrate your system/data, adjust system to the new UUIDs/lvm
> names, and then destroy sda2 and grow the new container. It will take
> longer and you'll need to tinker a bit with your system configuration to
> adjust it to the new partition/LUKS container/lvm.
>
> (If) I have some spare time later today I'll test your use-case (free
> space before LUKS) and report here, I am curious too.
>
>

The free space is 10 GB, where the luks partition is 200 GB.
I'm eagerly waiting to know the output of your experiment.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120821225237.21cd2104@shiva.selfip.org">http://lists.debian.org/20120821225237.21cd2104@shiva.selfip.org
 

Thread Tools




All times are GMT. The time now is 03:04 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org