Meniu

Limbi
Înapoi la blog

Proxmox

Shrink Proxmox LVM root partition and extend data partition

Sorin PohonțuSorin Pohonțu
Shrink Proxmox LVM root partition and extend data partition

Reducing the size of /dev/pve/root (the root logical volume in a default Proxmox setup using LVM) and extend the space of /dev/pve/data can be done using SystemRescueCD (or any live Linux environment with LVM and filesystem tools).

This is risky and should only be done after a full backup of your Proxmox host and VMs.

Warnings

  • Shrinking a mounted filesystem is dangerous — always do it from a live system (eg: SystemRescueCD).

  • Back up everything before proceeding.

  • These steps assume you’re using ext4.

Boot into SystemRescueCD

Check current LVM layout

lvdisplay
  --- Logical volume ---
  LV Path                /dev/pve/root
  LV Name                root
  VG Name                pve
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                64.00 GiB
  Current LE             8192
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/pve/data
  LV Name                data
  VG Name                pve
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.88 TiB
  Current LE             2852702
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

Activate LVM volumes

lvscan
vgchange -ay

Check the filesystem

Assuming /dev/pve/root is ext4

e2fsck -f /dev/pve/root

Shrink the filesystem of /dev/pve/root

Decide how much you want to reduce it by.

Example: shrink /dev/pve/root to 32G.

lvreduce --resizefs --size 32G /dev/pve/root

Expand the filesystem of /dev/pve/data to use (now) available free space

lvresize --resizefs --extents +100%FREE /dev/pve/data
e2fsck -f /dev/pve/root
e2fsck -f /dev/pve/data

Reboot

Remove or unmount SystemRescueCD and (re)boot from internal drive.

Check syslog for any relevant errors.


Tip: If you need assistance or support for a similar issue, you can contact us ;)

proxmoxlvmshrink lvmshrink root