If possible, just add another physical disk into LVM configuration and enlarge logical volume using lvresize command. It's much better and lesser error pruning behavior. The following scratched steps can be used when there are no possibilities to have another physical disk or there is a decision to use existing disk.
0. Identify LV and underlying physical volume to extend (use pvdisplay command)
1. Shutdown VM
2. Increase size of hard disk (CLI or VirtualBox virtual media manager)
3. Start the VM (might be in single user mode)
4. Modify partition table using parted. In other words, remove and recreate new partition with desirable size.
Steps depend on what kind of partition (primary or extended you need to extend). It also depend on are there any partitions behind being resized one. You may drop this partition (which you need to resize) and all the other partitions behind or recreate expended partition and logical partitions completely.
5. Reread modified partition table - reboot or blockdev --rereadpt etc.
6. Extend underlying LVM physical volume (correspond to increased partition) using pvresize command, for example :
# pvresize /dev/sda2
7. Increase size of logical volume
# lvresize --verbose --extents +100%FREE /dev/vg_db01/lv_root
# lvdisplay
8. Increase filesystem size. In my case it was ext4 (possible to increase online) :
# resize2fs /dev/mapper/vg_db01-lv_root
That's it ! Good Luck !
No comments:
Post a Comment