Re: How to enlarge LUKS partition ?
En l'an 2012, le lundi 20 août, vers 20 h 23 mn, J. B écrivait: Is there anyone who is successful increasing LUKS partition ? Hi, here is how I have successfully increased my LUKS partition: http://lists.debian.org/20120611070906.ga4...@delanoe.org (Some text in French but commands can be easily understood) Cheers, -- Alexandre Delanoë -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120827081236.ga28...@delanoe.org
Re: How to enlarge LUKS partition ?
On Mon, 27 Aug 2012 10:12:36 +0200 Alexandre neonoe123...@gmail.com wrote: En l'an 2012, le lundi 20 août, vers 20 h 23 mn, J. B écrivait: Is there anyone who is successful increasing LUKS partition ? Hi, here is how I have successfully increased my LUKS partition: http://lists.debian.org/20120611070906.ga4...@delanoe.org (Some text in French but commands can be easily understood) Cheers, This is about how to resize logical volumes, but my issue is how to resize the luks container when free disk space available before the luks partition. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120827151020.76159...@shiva.selfip.org
Re: How to enlarge LUKS partition ?
[Subscribed to the list, I do not need cc, thanks] En l'an 2012, le lundi 27 août, vers 15 h 10 mn, J. B écrivait: On Mon, 27 Aug 2012 10:12:36 +0200 Alexandre neonoe123...@gmail.com wrote: En l'an 2012, le lundi 20 août, vers 20 h 23 mn, J. B écrivait: Is there anyone who is successful increasing LUKS partition ? Hi, here is how I have successfully increased my LUKS partition: http://lists.debian.org/20120611070906.ga4...@delanoe.org (Some text in French but commands can be easily understood) Cheers, This is about how to resize logical volumes, but my issue is how to resize the luks container when free disk space available before the luks partition. Sorry, I thought it was step 4 of the mail: 4) Resize dm-crypt volume sudo apt-get update sudo apt-get install lvm2 cryptsetup sudo modprobe dm-crypt sudo cryptsetup luksOpen /dev/hda3 crypt1 sudo vgscan --mknodes sudo vgchange -ay sudo cryptsetup resize crypt1 Cheers, -- Alexandre Delanoë -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120827135707.ga3...@delanoe.org
Re: How to enlarge LUKS partition ?
On 23/08/2012 06:31, Kushal Kumaran wrote: On Wed, Aug 22, 2012 at 1:49 AM, tv.deb...@googlemail.com tv.deb...@googlemail.com wrote: On 21/08/2012 19:22, J. B wrote: [trim] The free space is 10 GB, where the luks partition is 200 GB. I'm eagerly waiting to know the output of your experiment. Ok, I was under the impression from your first post that the free space was 800GB. I didn't have time to do extensive tests but with such a small space available compared to the size of the LUKS there is no sane way to do what you want. I didn't manage to make the fdisk method work backward, even with a LUKS header backup it doesn't seem to be possible. I wonder what would happen if you gave dd overlapping regions of the disk to read from and write to. Something like (CAUTION, do not run): dd if=/dev/sda skip=5000 of=/dev/sda seek=1000 In theory, if dd is instructed to sync every read and write, to read strictly sequentially the source it could work (not saying that dd will agree to do it). You'd end up with a wrong partition table on the device at the end of the process, because in this particular case the data will be copied beyond the limit of the free partition (too small) and over the second partition the LUKS container resides on. In the end you would have a filesystem stretching way after the partition boundary, a lot of difficult recovery work to do to fix that, if possible. Not a reliable normal admin solution. LUKS just isn't that flexible. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/5035d30a.7050...@googlemail.com
Re: How to enlarge LUKS partition ?
On Wed, Aug 22, 2012 at 1:49 AM, tv.deb...@googlemail.com tv.deb...@googlemail.com wrote: On 21/08/2012 19:22, J. B wrote: [trim] The free space is 10 GB, where the luks partition is 200 GB. I'm eagerly waiting to know the output of your experiment. Ok, I was under the impression from your first post that the free space was 800GB. I didn't have time to do extensive tests but with such a small space available compared to the size of the LUKS there is no sane way to do what you want. I didn't manage to make the fdisk method work backward, even with a LUKS header backup it doesn't seem to be possible. I wonder what would happen if you gave dd overlapping regions of the disk to read from and write to. Something like (CAUTION, do not run): dd if=/dev/sda skip=5000 of=/dev/sda seek=1000 At some point you will need to dd out your LUKS container, then dd it back to a newly created partition including the free space. This would imply a 200GB space available somewhere, and would take ages to complete. You are better off to backup the data, take good notes of partition UUID, LUKS container as well as vg and lv details. Then create a new partition including the free space and previous sda2 (force same UUID as the old one with tune2fs -U), create a fresh LUKS (again maintaining same UUID for convenience), do the same for the lvm layer and copy data back. If you write random data over the backup afterward or backup to a temporary LUKS container this will leave no trace of the data in clear. Of course you'll need enough space somewhere, but likely less than the 200GB of the LUKS container. Sorry, can't get LUKS to walk backward :-{ -- regards, kushal -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/cah8gtdmufurn1modiqcnhc2h5khst88wb0nygrdpym5o6ws...@mail.gmail.com
Re: How to enlarge LUKS partition ?
On Tue, 21 Aug 2012 00:25:38 +0200 tv.deb...@googlemail.com tv.deb...@googlemail.com wrote: On 20/08/2012 19:14, J. B wrote: On Mon, 20 Aug 2012 17:57:31 +0200 tv.deb...@googlemail.comtv.deb...@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 :-( -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120821151617.330c7...@shiva.selfip.org
Re: How to enlarge LUKS partition ?
On 21/08/2012 11:46, J. B wrote: On Tue, 21 Aug 2012 00:25:38 +0200 tv.deb...@googlemail.comtv.deb...@googlemail.com wrote: On 20/08/2012 19:14, J. B wrote: On Mon, 20 Aug 2012 17:57:31 +0200 tv.deb...@googlemail.comtv.deb...@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 sda1sda2 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-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/50336974.9090...@googlemail.com
Re: How to enlarge LUKS partition ?
On Tue, 21 Aug 2012 12:56:52 +0200 tv.deb...@googlemail.com tv.deb...@googlemail.com wrote: On 21/08/2012 11:46, J. B wrote: On Tue, 21 Aug 2012 00:25:38 +0200 tv.deb...@googlemail.comtv.deb...@googlemail.com wrote: On 20/08/2012 19:14, J. B wrote: On Mon, 20 Aug 2012 17:57:31 +0200 tv.deb...@googlemail.comtv.deb...@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 sda1sda2 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-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120821225237.21cd2...@shiva.selfip.org
Re: How to enlarge LUKS partition ?
On 21/08/2012 19:22, J. B wrote: [trim] The free space is 10 GB, where the luks partition is 200 GB. I'm eagerly waiting to know the output of your experiment. Ok, I was under the impression from your first post that the free space was 800GB. I didn't have time to do extensive tests but with such a small space available compared to the size of the LUKS there is no sane way to do what you want. I didn't manage to make the fdisk method work backward, even with a LUKS header backup it doesn't seem to be possible. At some point you will need to dd out your LUKS container, then dd it back to a newly created partition including the free space. This would imply a 200GB space available somewhere, and would take ages to complete. You are better off to backup the data, take good notes of partition UUID, LUKS container as well as vg and lv details. Then create a new partition including the free space and previous sda2 (force same UUID as the old one with tune2fs -U), create a fresh LUKS (again maintaining same UUID for convenience), do the same for the lvm layer and copy data back. If you write random data over the backup afterward or backup to a temporary LUKS container this will leave no trace of the data in clear. Of course you'll need enough space somewhere, but likely less than the 200GB of the LUKS container. Sorry, can't get LUKS to walk backward :-{ -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/5033ed59.8030...@googlemail.com
Re: How to enlarge LUKS partition ?
On Tue, 21 Aug 2012 22:19:37 +0200 tv.deb...@googlemail.com tv.deb...@googlemail.com wrote: On 21/08/2012 19:22, J. B wrote: [trim] The free space is 10 GB, where the luks partition is 200 GB. I'm eagerly waiting to know the output of your experiment. snip Sorry, can't get LUKS to walk backward :-{ /snip No problem... You have already given some best helpful clues. Thanks -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120822105925.4aae1...@shiva.selfip.org
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-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120820202341.15cb1...@shiva.selfip.org
Re: 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 signature.asc Description: Digital signature
Re: 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-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/50325e6b.2050...@googlemail.com
Re: How to enlarge LUKS partition ?
On Mon, 20 Aug 2012 17:20:41 +0200 Jochen Spieker m...@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-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120820224320.6614d...@shiva.selfip.org
Re: How to enlarge LUKS partition ?
On Mon, 20 Aug 2012 17:57:31 +0200 tv.deb...@googlemail.com tv.deb...@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-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120820224440.51d89...@shiva.selfip.org
Re: How to enlarge LUKS partition ?
J. B: Jochen Spieker m...@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 signature.asc Description: Digital signature
Re: How to enlarge LUKS partition ?
On 20/08/2012 19:14, J. B wrote: On Mon, 20 Aug 2012 17:57:31 +0200 tv.deb...@googlemail.comtv.deb...@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). -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/5032b962.90...@googlemail.com