I have a LVM primary partition at the end of my disk, Windows is at the beginning, there was an unused partition in between but I need some space for Linux so I removed it.

Now I'm trying to figure out if it is possible to resize my LVM from its add more space "on the left" of the partition.

fdisk -l

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048    718847    716800   350M  7 HPFS/NTFS/exFAT
/dev/sda2          718848 256718847 256000000 122.1G  7 HPFS/NTFS/exFAT
/dev/sda4       325298176 488397167 163098992  77.8G 83 Linux

gparted can't move the LVM to the left, maybe it's because I need to unmount the partition, I'm not sure.


LVM (Logical Volume Manager) is a subsystem. At the lowest level is a PV (Physical Volume). Within the PV is a VG (Volume Group) and within the VG are the LVs (Logical Volumes).

You seem to be asking how to move or resize the PV corresponding to /dev/sda4. In order to do this you first need to deactivate the VG. (gparted > deactivate partition.) Note that when you deactivate a VG all its LVs must first be unmounted and will become unavailable until the VG is reactivated. Consequently it's highly likely that you'll need to perform this move/resize from outside the running system. (I can particularly recommend SystemRescueCd but I see that GParted now has its own LiveCD.)

| improve this answer | |
  • It certainly is possible to resize a PV while it's in use. LVM is designed to do everything live. However, pvresize only moves the end; resizing at the beginning is trickier. But even so, doing it offline doesn't particularly help. – Gilles 'SO- stop being evil' Apr 26 '16 at 23:43
  • @Gilles I know that PVs can be resized while in use - I have done this on occasion myself. (This is implemented by extending the end of the PV torwards the end of the disk.) What isn't easy is to move the start of the PV backwards towards the start of the disk, which is what the OP appears to be asking. This can be done only when the VG inside the PV is offline. (The easiest solution would probably be to create a new PV for the unused partition and make it available to the existing VG (so that the VG spans two PVs), as suggested by Henrik.) – roaima Apr 27 '16 at 0:47

If you have LVM on it, the easy way out is to make a new partition of the free space, set it up as physical volume in LVM and add that physical volume to your volume group.

You're probably right that gparted won't touch the partition as it is in use.

| improve this answer | |
  • If possible I would prefer to effectively resize the LVM, can it be resized if the partition is unmounted? – Nicolas Scotto Di Perto Apr 26 '16 at 20:46
  • I've never tried to do that, but I technically it's possible. – Henrik supports the community Apr 26 '16 at 20:55

LVM is pretty flexible, but moving the beginning of a physical volume is one thing that it can't do, as far as I know. However, you don't need to move the beginning of a PV to add more space, only to reduce it. To add more storage space, just use the free space as a PV and add it to the volume group.

  1. Give a name to the free space: make a partition. You can use gparted for that, or fdisk. The new partition will be sda3. In fdisk, the command sequence is n to make a partition, p for primary, choose number 3 (the only free one), and enter the sizes to use all the free space. Make the partition type “Linux LVM” with the t command to make your life easier (Linux doesn't care but it's clearer to humans).

  2. Make the new partition an LVM physical volume: pvcreate /dev/sda3

  3. Add the physical volume to your volume group: vgextend name_of_your_vg /dev/sda3

You don't need to unmount anything, LVM is designed for online operation.

You can now use lvcreate to create new logical volumes for some new filesystems, or use lvresize to extend an existing logical volume. After you extend an existing logical volume, don't forget to enlarge the filesystem on it accordingly, e.g. with resize2fs for an ext4 filessytem.

| 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.