Skip to content

Instantly share code, notes, and snippets.

@zenxedo
Last active September 20, 2024 15:58
Show Gist options
  • Save zenxedo/1988227c41bd5136fba7b5d0acc78060 to your computer and use it in GitHub Desktop.
Save zenxedo/1988227c41bd5136fba7b5d0acc78060 to your computer and use it in GitHub Desktop.
Peroxmox Notes

Increase size of PBS Datastore Directory after increasing the size of Disk

Using sgdisk to Extend a Non-LVM Partition:

sgdisk -e /dev/sdb         # Extend the GPT partition to use the entire disk
sgdisk -d 1 /dev/sdb       # Delete the old partition
sgdisk -N 1 /dev/sdb       # Create a new partition to fill the available space
partprobe /dev/sdb         # Notify the system of partition changes
resize2fs /dev/sdb1        # Resize the filesystem to use the new partition size

Ubuntu Machine with LVM

Step 1: Increase/Resize the Disk from the GUI Console

  • Use the GUI to increase the disk size of the virtual machine or physical machine.

Step 2: Extend Physical Drive Partition

  • Check free space on the disk:

    sudo fdisk -l
  • Extend the physical partition:

    growpart /dev/sda 3   # Replace /dev/sda3 with the correct partition
  • View physical volumes:

    pvdisplay
  • Resize the physical volume to inform LVM that the disk size has changed:

    sudo pvresize /dev/sda3
  • Verify the physical volume changes:

    pvdisplay

Step 3: Extend Logical Volume

  • View the current logical volumes:

    lvdisplay
  • Extend the logical volume to use all available space:

    sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
  • Verify the logical volume has been extended:

    lvdisplay

Step 4: Resize the Filesystem

  • Resize the filesystem on the logical volume:

    sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
  • Verify the changes by listing the disk partitions:

    sudo fdisk -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment