Friday, April 19, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1945  / 2 Years ago, sat, april 9, 2022, 7:42:19

I have been bashing my head against the wall, regretting ever having opted into using LVM.



Gparted screenshot]



I need to shrink the 75GB /dev/sda2/ to make room for a new OS installation. To do this, I need to shrink the /dev/sd5 partition which is contained in sd2.



I first attempted to use GParted, but my version says it does not support LVM. I downloaded the latest .iso for GParted Live into a CD, but the results were similar.



So I have already taken all the steps to shrink the filesystem, volume group, physical volume, and so on.



user@computer:~$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 ubuntu lvm2 a- 56.00g 1020.00m



user@computer:~$ sudo lvdisplay
--- Logical volume ---
LV Name /dev/ubuntu/root
VG Name ubuntu
LV UUID blahblahblah
LV Write Access read/write
LV Status available
# open 0
LV Size 55.00 GiB
Current LE 14080
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0


I have even removed the swap_1 volume.
When I run the latest GParted from the LiveCD, it does show the used 56GB volume group, then some 18GB unallocated space. However, it still does not let me resize /dev/sda5 or /dev/sda2. How can I resize /dev/sda2, given that the volume group and physical volumes are already 55GB, while is 18GB less than the size of the containing extended partition /dev/sd2?


More From » partitioning

 Answers
0

I fixed this by accidentally deleting the /dev/sd2 extended partition (via 'parted'--I thought, like fdisk, parted would not commit the changes immediately).



I then used testdisk to look for lost partitions. It found /dev/sd5, and considered it a primary partition. (It did not find the extended partition /dev/sd2).



After this, I was able to use gparted to resize and do operations onto the partitions.


[#31743] Sunday, April 10, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
calronze

Total Points: 0
Total Questions: 110
Total Answers: 112

Location: Belarus
Member since Thu, Aug 11, 2022
2 Years ago
;