Skip to content

Instantly share code, notes, and snippets.

@acosonic
Last active January 24, 2025 08:24
Show Gist options
  • Save acosonic/fc24051aa0f4994473f24037f15b7580 to your computer and use it in GitHub Desktop.
Save acosonic/fc24051aa0f4994473f24037f15b7580 to your computer and use it in GitHub Desktop.
Ubuntu resize VM disk
#!/bin/bash
echo 1 > /sys/block/sda/device/rescan
cfdisk /dev/sda
pvresize /dev/sda3
lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
@acosonic
Copy link
Author

pvresize /dev/sda3
pvdisplay
lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

@acosonic
Copy link
Author

Procedura za ne LVM diskove:
Use lsblk or fdisk -l to confirm there is unallocated space

parted /dev/sdX
select /dev/sdX
resizepart X YGB
resize2fs /dev/sdaX

xfs grow if sys is xfs...

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