The default hard drive size for Centos 6.5 VMS created by Oracle VirtualBox is 8 g (not manually adjusted) and now uses 100%, which requires capacity expansion.
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_kaola-lv_root 6.5G 6.2G 32M 100%/
Tmpfs 939M 76K 939M 1%/DEV/SHM
/DEV/SDA1 477M 59M 393M 14%/boot
Cm_processes 939M 0 939M 0%/var/run/cloudera-scm-agent/process
Copy VMDK to VDI
Since the disk format chosen when creating the VM is VMDK, the disk is copied in VDI format first:
C:\Program files\oracle\virtualbox>
Vboxmanage Clonehd "KAOLA.VMDK" "New-kaola.vdi"--format VDI
Modify Disk to 20G:
Vboxmanage modifyhd "New-kaola.vdi"--resize 20480
To view disk information:
[[email protected] ~]# fdisk-l
disk/dev/sda:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2 610 cylinders
Units = cylinders of 16065 * = 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000490ac
Device boot ; start End blocks id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2611 20458496 8e Linux LVM
Download the gparted ISO file, boot the VM and adjust the sda2 partition after booting;
After adjustment:
[[email protected] ~]# fdisk-l
disk/dev/sda:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2 610 cylinders
Units = cylinders of 16065 * = 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000490ac
Device boot ; start End blocks id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2611 20458496 8e Linux LVM
View PV VG Information
[Email protected] mapper]# Pvdisplay
---physical volume---
PV Name/dev/sda2
VG Name Vg_kaola
PV Size 19.51 gib/not usable 2.00 MiB
Allocatable Yes
PE Size 4.00 MiB
Total PE 4994
Free PE 3072
Allocated PE 1922
PV UUID Tmcfp1-wtiv-efkn-dfj4-zhno-iga0-iulnou
[Email protected] mapper]# Vgdisplay
---Volume Group---
VG Name Vg_kaola
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access Read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
ACT PV 1
VG Size 19.51 GiB
PE Size 4.00 MiB
Total PE 4994
Alloc pe/size 1922/7.51 GiB
Free Pe/size 3072/12.00 GiB
VG UUID Jgyrf4-drng-n5gs-m3no-lcbc-mehz-ocewi1
Adjust the LV size
Free PE 3072
[Email protected] mapper]# lvextend-l +3072/dev/mapper/vg_kaola-lv_root
Extending logical Volume Lv_root to 18.71 GiB
Logical Volume Lv_root successfully resized
Resizing a file system
[Email protected] mapper]# Resize2fs/dev/mapper/vg_kaola-lv_root
RESIZE2FS 1.41.12 (17-may-2010)
Filesystem at/dev/mapper/vg_kaola-lv_root is mounted on/; On-line resizing required
Old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of/dev/mapper/vg_kaola-lv_root to 4904960 (4k) blocks.
The filesystem on/dev/mapper/vg_kaola-lv_root is now 4904960 blocks long.
After adjustment, it is now used as 36%:
[Email protected] mapper]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_kaola-lv_root 19G 6.2G 12G 36%/
Tmpfs 939M 224K 939M 1%/DEV/SHM
/DEV/SDA1 477M 59M 393M 14%/boot
Cm_processes 939M 0 939M 0%/var/run/cloudera-scm-agent/process
Record Centos 6.5 VM disk expansion under Oracle VirtualBox