Expanding the virtual disk and assigning the extra space to a certain partition

Follow

This example gives the extra disk space to /var/log, you can ofcourse choose a different logical volume.

Steps to take:

  • create a snapshot of your machine, just in case...
  • increase the disk size in for example VMware
$> sudo su
#> fdisk /dev/sda
press 'd' (delete partition; no your data won't be gone)
which partition? 2
press 'n' (new partition)
partition type? p
partition number? 2
first sector? press Enter to accept proposed value
last sector? press Enter to accept proposed value
press 'w' (save changes)

now reboot the machine and login again

$> sudo su
#> pvresize /dev/sda2
#> vgextend tb /dev/sda2
#> lvextend -l +100%FREE /dev/tb/var_log
#> xfs_growfs /var/log

done!

Have more questions? Submit a request

Comments