Hi
My instance has been running low on diskspace for a few weeks now and having frightened myself googling how to increase it i have been using filezilla to go into /var/log/asterisk and deleting the older logs. This usually got me down to just below 70% and it might be a week before i got the warning emails at 75% - then filezilla again… However, today, Sunday, i took the bull by the horns and using a variety of sources but mainly using " How to extend a partition with unallocated space CentOS 7" on Webcore cloud, i managed it without even shutting down the server - so i thought i would share this with you, most is copied and pasted but some of the partitions are slightly different (if you know what you are doing, unlike me, then you maybe don’t need my full step by step by step) Here goes:
- Take an image or a backup - you have been warned - if this fails you can go back.
- Upgrade vultr instance to a bigger disk using their control panel.
- Extend partition
Copy
fdisk /dev/vda
Enter p to print your initial partition table.
Enter d (delete) followed by 2 to delete the existing partition definition (partition 1 is usually /boot and partition 2 is usually the root partition).
Enter n (new) followed by p (primary) followed by 2 to re-create partition number 2 and enter to accept the start block and enter again to accept the end block which is defaulted to the end of the disk.
Enter t (type) then 2 then 8e to change the new partition type to " Linux LVM ".
Enter p to print your new partition table and make sure the start block matches what was in the initial partition table printed above.
Enter w to write the partition table to disk. You will see an error about device or resource busy which you can ignore.
Update kernel in-memory partition table
After changing your partition table, run the following command to update the kernel in-memory partition table:
Copy
partx -u /dev/vda
Resize physical volume
Use this command to resize the PV to recognize the extra space
Copy
pvresize /dev/vda2
Resize LV and filesystem
lvextend -l +100%FREE /dev/mapper/SangomaVG-root
Then you need to use xfs_growfs command to to resize your partition, so use:
xfs_growfs /dev/mapper/SangomaVG-root
That should be it - hope i helped somebody.