I have Ubuntu 16.04 installed on my SSD taking its full size and having LVM enabled. I want to install a second operating system on the same SSD and I am failing to shrink down the partitions that are used by Ubuntu. I resized the logical partition with the following command, followed by its output:

$ sudo lvreduce --resizefs -L 128G /dev/ubuntu-vg/root

fsck from util-linux 2.27.1
/dev/mapper/ubuntu--vg-root: 692451/15056896 files (0.4% non-contiguous), 11307331/60203008 blocks
resize2fs 1.42.13 (17-May-2015)
Resizing the filesystem on /dev/mapper/ubuntu--vg-root to 33554432 (4k) blocks.
The filesystem on /dev/mapper/ubuntu--vg-root is now 33554432 (4k) blocks long.

  Size of logical volume ubuntu-vg/root changed from 229.66 GiB (58792 extents) to 128.00 GiB (32768 extents).
  Logical volume root successfully resized.

Now, inside GParted, I see the following screen:

enter image description here

After I tried resizing the partition in GParted, I got the following output from GParted:

GParted 0.25.0 --enable-libparted-dmraid --enable-online-resize

Libparted 3.2
Shrink /dev/sda3 from 237.50 GiB to 135.83 GiB  00:00:00    ( ERROR )

calibrate /dev/sda3  00:00:00    ( SUCCESS )

path: /dev/sda3 (partition)
start: 2050048
end: 500117503
size: 498067456 (237.50 GiB)
shrink file system  00:00:00    ( ERROR )

lvm pvresize -v --setphysicalvolumesize 142427136K /dev/sda3  00:00:00    ( ERROR )

0 physical volume(s) resized / 1 physical volume(s) not resized
Using physical volume(s) on command line.
Archiving volume group "ubuntu-vg" metadata (seqno 4).
/dev/sda3: Pretending size is 284854272 not 498067456 sectors.
Resizing volume "/dev/sda3" to 284854272 sectors.
Resizing physical volume /dev/sda3 from 0 to 34772 extents.
/dev/sda3: cannot resize to 34772 extents as later ones are allocated.


Could you please help me resize this thing without losing data? Thanks!


You need to move LVM extents at the end of LVM PV partition with pvmove command before you can resize it.

KDE Partition Manager can actually do it for you. Unfortunately the version in Ubuntu 16.04 is too old, but you can boot Ubuntu 17.10 live CD, install partitionmanager there

sudo apt install partitionmanager

and then resize LVM PV from GUI.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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