Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

Perhaps not the smartest solution:

use the tool system-config-lvm to migrate your data to another (temporal, external hard drive) device, delete the partition / do your resizing and migrate the data back.

hope that helps

share|improve this answer
    
I fixed this by accidentally deleting the /dev/sd2 extended partition (via 'parted –  user84207 Apr 19 '13 at 8:22

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.