Resize encryoted volume (LVM)
- Inicie sesión ou rexístrese para enviar comentarios
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?
Anexo | Tamaño |
---|---|
#1.jpg | 1.13 MB |
#2.jpg | 1.09 MB |
#3.jpg | 1.01 MB |
The first answer on https://askubuntu.com/questions/252204/how-to-shrink-ubuntu-lvm-logical-and-physical-volumes looks good.
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?

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.
I have given the image a new name.
Does it work now?
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'