extend your VirtualBox image size

  • 0

extend your VirtualBox image size

When you first time use your HDP sandbox in VirtualBox then by default it assign 20GB of your harddisk to your sandbox. But later as far as I know this would not be enough size and you want to extend size.Then this article will help you to extend your VBox size.

Step 1: Right click on that Virtual Machine where you would like to extend the size and click on settings and then go to storage.

Step 2: Now you need to click on + symbol near “Controller:Sata”  and click on “Create New Disk”. 

Step 3: Select “VDI(Virtual Disk Image)”  and continue :

Step 4: Select Dynamic Allocation and continue:

Step 5: Select Your size which you would like to extend (e.x 10 GB) and then click on create.

So here you will see following one more sata disk with the name you provided.

Now you have to start the server and login to the shell to perform following steps:

 

[root@m1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_m1-lv_root
                       18G  9.7G  6.7G  60% /
tmpfs                 939M     0  939M   0% /dev/shm
/dev/sda1             477M   25M  427M   6% /boot
[root@m1 ~]# sfdisk -s
/dev/sda:  20971520
/dev/sdb:  11104256
/dev/mapper/vg_m1-lv_root:  18358272
/dev/mapper/vg_m1-lv_swap:   2097152
total: 52531200 blocks
[root@m1 ~]# vgextend vg_m1 /dev/sdb
  Physical volume "/dev/sdb" successfully created
  Volume group "vg_m1" successfully extended
[root@m1 ~]# lvextend -L +10G -r /dev/mapper/vg_m1-lv_root
  Size of logical volume vg_m1/lv_root changed from 17.51 GiB (4482 extents) to 27.51 GiB (7042 extents).
  Logical volume lv_root successfully resized
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_m1-lv_root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 2
Performing an on-line resize of /dev/mapper/vg_m1-lv_root to 7211008 (4k) blocks.
The filesystem on /dev/mapper/vg_m1-lv_root is now 7211008 blocks long.

[root@m1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_m1-lv_root
                       27G  9.7G   16G  38% /
tmpfs                 939M     0  939M   0% /dev/shm
/dev/sda1             477M   25M  427M   6% /boot