Resize a VNF deployed in Openstack

Please make sure that your VNF files system was created through LVM (Logical Volume Manager). to identify this you use the following command $ cat /etc/fstab
This is an exmaple of fixed FS, which you can not resize
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
UUID=9d956232-4e00-4976-a6c6-207a757342bf /               ext4    errors=remount-ro 0       1
While this is an example of FS initiated through LVM, which you can resize
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/MasterDebain-root/ /               ext4    errors=remount-ro 0       1
you can use fdisk a command to resize a machine.
$ df -h
image
$ fdisk -l
image
$ fdisk /dev/vda/
image
Command (m for help): n
Command action
   e   extended
   p   primary (1 primary, 1 extended, 2 free)
Select (default p): p
Partition Number (3-4, default 3): {enter}
First Sector (XXXXXX -XXXXXX, default XXXXX): {Enter}
Last Sector (XXXXXX -XXXXXX, default XXXXX): {Enter}

Created a new partition 3 of type 'Linux' and of and size of 72 GiB

Command (m for help): w
The partition table has been altered.
Syncing Disks.
$
fdisk -l
image
$ pvdisplay
image
$ pvcreate /dev/vd4
  Physical volume "/dev/vda4" successfully created
$ pvdisplay
image
$ vgdisplay
image
$ vgextend MasterDebain-vg /dev/vda4
  Volume group "MasterDebain-vg" successfully extended
$ vgdisplay
image
$ lvdisplay | grep Path
   LV Path    /dev/MasterDebain-vg/root
   LV Path    /dev/MasterDebain-vg/swap_1
   LV Path    /dev/MasterDebain-vg/home
now extend
$ lvextend -l +100%FREE /dev/MasterDebain-vg/root
  Extending logical volume MasterDebain-vg/root changed to 74.53 GiB
  Logical volume MasterDebain-vg/root successfully resized
We are almost done
$ resize2fs /dev/MasterDebain-vg/root
now again check the size of root directory
$ df -h
image
Enjoy ;)

No comments:

Post a Comment

How to resize any VMs Hard disk size

Pre-Requiste First Confirm if your Linux machine was created using LVM or not, execute the following commands pvdisplay vgdisplay lvdisplay ...