Booted from an USB Ubuntu 18.04 and I'm trying to shrink my current Ubuntu 16.04 partition.
For the sake of completion, this is what lsblk returns in the momento I'm writing this:
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 512M 0 part
├─sda2 8:2 0 488M 0 part
└─sda3 8:3 0 464.8G 0 part
├─ubuntu--vg-root 253:0 0 248.9G 0 lvm
└─ubuntu--vg-swap_1 253:1 0 15.9G 0 lvm
sdb 8:16 1 1.9G 0 disk /cdrom
├─sdb1 8:17 1 1.8G 0 part
└─sdb2 8:18 1 2.3M 0 part
As you can see, my /dev/sda3 has 464.8G but just 264.8G are in use by vg-root and vg-swap. What I want is to shrink sda3 so I can install Ubuntu 18.04 in another partition.
Following this article, after resizing my LV, I'm trying to run pvresize:
ubuntu@ubuntu:~$ sudo pvresize --setphysicalvolumesize 265G /dev/sda3
/dev/sda3: Requested size 265.00 GiB is less than real size 464.78 GiB. Proceed? [y/n]: y
WARNING: /dev/sda3: Pretending size is 555745280 not 974721024 sectors.
Physical volume "/dev/sda3" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
Given the message, I understand that everything worked successfully, but when running lsblock (or GParted), everything remains the same: sda3 was not shrinked.
Important to note that GParted is showing a key icon beside sda3 as if it was mounted, when it is not (as I booted from USB). Running umount confirms that:
ubuntu@ubuntu:~$ sudo umount /dev/sda3
umount: /dev/sda3: not mounted.
Also, if I try to resize sda3 using GParted it will run the same pvresize but will answer NO to the confirmation, so it results is an error.
What am I missing here? Do I have to do anything else? Why isn't GParted allowing me to shrink the partition?