Here's a note on how to resize LVM partition in VirtualBox
1. VBoxManage modifyhd vdi_path --resize new_size_in_mb
2. Resize the disk.
a. Run the VM
b. Open terminal/console and execute command below
+ df
Write down the logical mapping, in my case it is /dev/mapper/vg_iplus-lv_root
+ fdisk -l
Write down the Device name, in my case /dev/sda2
+ fdisk /dev/sda
The next steps will delete the partition to resize, recreate the partition and make it primary. Then resize the partition to the new size and write the changes.
+ Still in fdisk, delete the partition
input: d
+ Still in fdisk, select the device to partition number. In my case it is 2 (/dev/sda2)
input: 2
+ Still in fdisk, create new partition and select the same partition as in previous steps (e.g. 2)
Input: n
Input: 2
+ Set the size for the new partition, set it to occupy all available space (or as preferred)
Input: enter (twice to set default size)
+ Commit the changes
Input: w
+ Reboot server
Command: reboot
+ Resize the physical volume
Command: pvresize /dev/sda2
/dev/sda2 refers to the partition changed previously
+ Verify the new size, make sure the new size is applied
Command: pvscan
+ Extend the logical volume to take all free space
Command: lvextend -l +100%FREE /dev/mapper/fedora-root
+ Resize the file system
Command: resize2fs /dev/mapper/vg_iplus-lv_root
+ Verify the new changes
Command: df
And we're done! :)
Reference:
https://blog.jyore.com/2013/06/virtualbox-increase-size-of-rhelfedoracentosscientificos-guest-file-system/
No comments:
Post a Comment