Pivert's Blog

LVM pvresize: cannot resize to nnn extents as later ones are allocated


Reading Time: 2 minutes

Linux is very flexible with partitions, move, resizes and many other operations, especially if LVM is in action.

But sometimes, you might want to shrink a PV to get some free space on your disk, and get the following error :

/dev/nvme0n1p3: Requested size 1.46 TiB is less than real size <3.64 TiB. Proceed?  [y/n]: y
  WARNING: /dev/nvme0n1p3: Pretending size is 3145728000 not 7812986511 sectors.
  /dev/nvme0n1p3: cannot resize to 383999 extents as later ones are allocated.
  0 physical volume(s) resized or updated / 1 physical volume(s) not resized

The message is explicit, but you need some manual steps to get out of this situation and resize the partition.

It’s very easy to use pvmove to relocate used segments to a bigger free earlier area:

Then we have enough free space to pvresize. In my case, I need to resize a PV from 3.64TB to some 1.5TB before moving data to a new SSD. (Migrating from 4TB Crucial P3 to 4TB WD_BLACK SN850X). I might have been able to move bigger areas but since I moved most of the data to a mechanical drive, and since it will be faster to copy 1.5TB than 4TB over USB… (PS: the p3 from the above screenshot has nothing todo with the SSD model from Crucial (P3), p3 here is just the patition number 3.)

Now that the pv is smaller, we can resize the partition with gparted

Like it ?

Get notified on new posts (max 1 / month)
Soyez informés lors des prochains articles

One response to “LVM pvresize: cannot resize to nnn extents as later ones are allocated”

Leave a Reply

Your email address will not be published. Required fields are marked *