Resize encryoted volume (LVM)

17 respuestas [Último envío]
GNUbahn
Desconectado/a
se unió: 02/19/2016

How can I shrink an encrypted volume (to make space for a dual boot installation)?

In another thread I was helped to resize the root (and home) partitions within an encrypted volume (since I ran out of sapce in the root partition and could not install more apps): https://trisquel.info/en/forum/root-partition-too-small-cant-install-software

Now I would like to shrink the whole encrypted volume to make space for a parallel installation. As can be seen on image #1, the encrypted volume, sda4, holds 892.08 GiB, but as can be seen on image #2, only 292.08 Gib are used for the encrypted partitions under sda4_crypt (home, swap and boot).

By means of the commands from resizing the root partition, I have shrinked the home partition to fit the 292.08 Gib used, which leaves 600 GiB ($ sudo lvresize -r -L -10G vgtrisquel/home). I would like to shrink sda4 to fit the used 292.08 Gib, so that the remaining 600 GiB can be used for a parallel installtion.

I have tried to shrink the encrypted volume through gparted, but as can be seen on image #2 it fails. Unfortunately I don't understand the error message.

Any idea on how to solve this?

AdjuntoTamaño
#1.jpg1.13 MB
#2.jpg1.09 MB
#3.jpg1.01 MB
Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010
GNUbahn
Desconectado/a
se unió: 02/19/2016

Thanks. That got me somewhat closer, but it does not really work. Plese see the attached image.

The guide in the link refers to sda5 and there is no sda3 and sda4. Also, there are references to swap and root but not to home. Since it is quite old I was wondering if something has changed in how these things are done during the years?

Resize_sda4_.jpg
Avron

I am a translator!

Desconectado/a
se unió: 08/18/2020

I don't know if it is only me, but when I try to look at any of the attached images, I just go to the Trisquel website home page. The links I see are https://trisquel.info/files/#1.jpg, and in my understanding, in URLs, # is followed by a reference to an HTML anchor, so if a file name starts with #, I have no clue how to fetch it.

GNUbahn
Desconectado/a
se unió: 02/19/2016

I have given the image a new name.
Does it work now?

prospero
Desconectado/a
se unió: 05/20/2022

> Does it work now?

Yes!

In an URI, the hash mark # introduces a fragment, and cannot be escaped.

GNUbahn
Desconectado/a
se unió: 02/19/2016

Thanks

GNUbahn
Desconectado/a
se unió: 02/19/2016

Different output for same volumes?

I would expect these two commands to give the same numerical values:

pvdisplay -v -m
and
sudo pvs -v --segments /dev/mapper/sda4_crypt

But the don't:

pvdisplay -v -m
--- Physical volume ---
PV Name /dev/mapper/sda4_crypt
VG Name vgtrisquel
PV Size <892,07 GiB / not usable 3,00 MiB
Allocatable yes
PE Size 4,00 MiB
Total PE 228368
Free PE 153600
Allocated PE 74768
PV UUID TUc66d-NjP2-QZZ7-Qb4Y-hUhQ-vNwb-GhqPBf

--- Physical Segments ---
Physical extent 0 to 3575:
Logical volume /dev/vgtrisquel/root
Logical extents 0 to 3575
Physical extent 3576 to 4307:
Logical volume /dev/vgtrisquel/swap_1
Logical extents 0 to 731
Physical extent 4308 to 68611:
Logical volume /dev/vgtrisquel/home
Logical extents 0 to 64303
Physical extent 68612 to 222211:
FREE
Physical extent 222212 to 223235:
Logical volume /dev/vgtrisquel/swap_1
Logical extents 732 to 1755
Physical extent 223236 to 228355:
Logical volume /dev/vgtrisquel/root
Logical extents 3576 to 8695
Physical extent 228356 to 228367:
Logical volume /dev/vgtrisquel/swap_1
Logical extents 1756 to 1767

and

sudo pvs -v --segments /dev/mapper/sda4_crypt
PV VG Fmt Attr PSize PFree Start SSize LV Start Type PE Ranges
/dev/mapper/sda4_crypt vgtrisquel lvm2 a-- 892,06g 600,00g 0 3576 root 0 linear /dev/mapper/sda4_crypt:0-3575
/dev/mapper/sda4_crypt vgtrisquel lvm2 a-- 892,06g 600,00g 3576 732 swap_1 0 linear /dev/mapper/sda4_crypt:3576-4307
/dev/mapper/sda4_crypt vgtrisquel lvm2 a-- 892,06g 600,00g 4308 64304 home 0 linear /dev/mapper/sda4_crypt:4308-68611
/dev/mapper/sda4_crypt vgtrisquel lvm2 a-- 892,06g 600,00g 68612 153600 0 free
/dev/mapper/sda4_crypt vgtrisquel lvm2 a-- 892,06g 600,00g 222212 1024 swap_1 732 linear /dev/mapper/sda4_crypt:222212-223235
/dev/mapper/sda4_crypt vgtrisquel lvm2 a-- 892,06g 600,00g 223236 5120 root 3576 linear /dev/mapper/sda4_crypt:223236-228355
/dev/mapper/sda4_crypt vgtrisquel lvm2 a-- 892,06g 600,00g 228356 12 swap_1 1756 linear /dev/mapper/sda4_crypt:228356-228367

E.g. the numbers for 'free' are

the first output declares 'Physical extent' to be "68612 to 222211"

while the second gives "68612" for 'Start' and "153600" for 'SSize'

Avron

I am a translator!

Desconectado/a
se unió: 08/18/2020

I am not familiar with those commands, but I just notice that "Start + SSize" gives the "Start" of the next segment, and the output of the two commands look actually well aligned.

I did not have time to look at the ubuntu page, but accidentally I came across https://wiki.archlinux.org/title/Resizing_LVM-on-LUKS which is exactly for what you were asking.

By the way, I tried to install Trisquel with the netinstaller and manual partitioning with lvm on luks (which is the default setup in Trisquel) but only using half of the disk, I made two attempts with some difference and in both cases, the installation failed at some step. In one case, it went almost until the end, the failure occured for installation of grub. It looks like my partitioning was not matching the installer's expectations, but I must say I was often deeply confused by the language used by the installer. This also made Trisquel 12 on another disk of the same computer not boot anymore, which I managed to fix thanks to https://wiki.debian.org/GrubEFIReinstall.

GNUbahn
Desconectado/a
se unió: 02/19/2016

My original goal was (is) to make a dual installation with trisquel running in both (one for private and one for work work).

I have tried so many guides and times with no ultimte success. I am beginning to wonder if it is even possible?

Most of the guides are not exactly on topic for me, and the only one I found seem to be a bit outdated (or the approaches from distro to distro vary a but too much for me).

At this point I am ready to give up for now - at least on my daily device. I will probably setup a test device.

In the wake of my defeat, I decided to make a slightly simpler setup: One encrypted installation (private) and a one un-encrypted (work, with encrypted /home). I installed T12 on a 250 GB disk (private) and cloned it to a 1TB disk, which leaves room for an ca. 650 GB installation (work). I have not yet made the second installation.

I fear an EFI issue: My computer starts with SEAbios which includes a EFI function (or whatever to call it). But when doing the second non-encrypted installation, it will probably install EFI, which may not work well with SEAbios.

On top of everything else: I like to use cinamon DE. But in T12 there seems to be an issue with the cinnomon-core package: https://trisquel.info/en/forum/install-error-under-ecne-cinnamon-more

Avron

I am a translator!

Desconectado/a
se unió: 08/18/2020

SeaBIOS does not use UEFI, but I noticed that, on my computers that boot with SeaBIOS, the Trisquel installer created an EFI partition, which in my understanding is useless.

I understand your goal and find it useful. I tried doing that with the netinstaller but failed. Usually, the instructions from archlinux wiki are really accurate, so I will try them to see if I can shrink the encrypted space used for Trisquel on one disk and install another Trisquel next to it. I will try this on my T400, that uses SeaBIOS.

Actually, I would have more interest in installing a Trisquel system and a Parabola system on the same disk, but I'll try two Trisquel systems first.

GNUbahn
Desconectado/a
se unió: 02/19/2016

I would be very interested to learn about this. If you succeed and can help me, perhaps we can make a guide for others: Dual boot of two encrypted linux installations on SEAbios (or whatever title is better).

Is there a big difference in how you install Trisquel and Parabola?

Avron

I am a translator!

Desconectado/a
se unió: 08/18/2020

> Is there a big difference in how you install Trisquel and Parabola?

Parabola does not have any automatic installer, the installation method is to boot a live Parabola USB as in "try without installing", but just console mode, and from there, read the installation guide (on another computer) that says the different things to do. Everything is by command in a terminal, the manual does not suggest any default, you need to make decisions by yourself for everything, and there are more than a dozen things to do. The first time, it was really overwhelming, I got a system that could not boot and I struggled to make it work. After I got it right once, installing another computer felt much easier, even with some changes.

Many commands you use are not specific to installing a system, and even not specific to Parabola, so they have extensive documentation and you can adjust everything according to your preferences. For instance, since you choose the size of each partition, and you have the full flexibility of command line, you can use only half a disk if that is what you want.

Another thing to remember is that Parabola is a rolling release, so it regularly has new bugs and sometimes the problem you face is not your mistake, it is a bug that should be reported. Like, any failure to update a working system deserves a bug report. The faster you report a bug, the faster it will be fixed.

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

For instance, since you choose the size of each partition, and you have the full flexibility of command line, you can use only half a disk if that is what you want.

You can do that in Trisquel's graphical installer too, choosing the "Something else" type of installation.

Avron

I am a translator!

Desconectado/a
se unió: 08/18/2020

I tried but with the normal installer, you can't use LVM in an encrypted volume. I tried with the netinstaller in which you can do this, but when I created an EFI partition, I could not specify a mounting point, and I suspect this may be why the installation failed at grub installation. When I install Parabola, I mount everything with terminal mount commands then no problem to install grub.

Is there any documentation on using the "something else" option of the netinstaller, especially how to setup the EFI partition, and whether a separate boot partition should be created when an EFI partition is used?

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

I tried but with the normal installer, you can't use LVM in an encrypted volume.

I have never tried that and, as a consequence, should not have replied to the previous post.

GNUbahn
Desconectado/a
se unió: 02/19/2016

Any idea on why the normal installer does not give the option to choose the amount of space used for an LVM installation?

GNUbahn
Desconectado/a
se unió: 02/19/2016

By the way; If successful, my next step would be to figure out if it is possible to create a "shortcut" or a "window" from my private to my work instance. That is, a WM in my private instance which mounts the /home folder of the work instance.