Increase the disk capacity of VirtualBox virtual machines

Source: Internet
Author: User
Tags gparted


Increase the disk capacity of the VirtualBox Virtual Machine. By default, the size of the Virtual Disk allocated by CentOS installation in VirtualBox is 8 GB. After the CentOS system is installed, the size of the Virtual Disk reaches 4 GB. It is easy to use space. I read some posts on the Internet about how to scale up. The operations I have actually sorted out are not comprehensive. In this case, you may encounter this problem. I will record my actual operations for your reference. Www.2cto.com 1. Open the CMD command window and go to the VirtualBox installation directory. Run the following command: 1e: \ Program Files \ Oracle \ VirtualBox> VBoxManage.exe modifyhd "F: \ Frank4 \ Frank4.vdi2" -- resize 1536030%... 10%... 20%... 30%... 40%... 50%... 60%... 70%... 80%... 90%... 100% modifyhd is the command word, indicating resizing; -- resize is the parameter, and the parameter size after resizing (MB) is 15 GB; Frank4.vdi is the virtual file to be resized 2. now the VDI size has been increased, and the increased capacity must be known to the Virtual Machine CentOS. here we need to use a tool GParted (Gnome Partition Editor ). http://gparted.sourceforge.net/ Download 3. in VirtualBox, set CentOS, boot sequence first, and load the downloaded gparted-live ISO 4. start the VM CentOS and enter GParted. You will see the capacity of 7 GB unallocated, create Primary Partition, File system: ext4. www.2cto.com, and apply this operation:/dev/sda3 5 will appear after creation. disable GParted, detach the virtual optical drive from VirtualBox settings, and set the boot sequence to hard disk. 6. start CentOS and execute extended logical partition a on the command line terminal. run su-root and press "Enter" B. enter the root user password c. run lvm pvcreate/dev/sda3 to create the physical volume/dev/sda3 www.2cto.com 1 [root @ frank4 frankwu] # <span style = "color: #009900; "> lvm pvcreate/dev/sda3 </span> Writing physical volume data to disk"/dev/sda3 "2 Physical volume"/dev/sda3 "successfully created3 [root @ frank4 frankwu] # df-h-T4Filesystem Type Size Used Avail Use % Mounted on5/dev/mapper/vg_fmaster-lv_root6 ext4 5.5G 4.8G 462 M 92%/7 tmpfs 499 M 112 K 499 M 1% /dev/shm8/dev/sda1 ext4 485 M 76 M 384 M 17%/bootd. run lvm vgextend "vg_fmaster"/dev/sda3 and add/dev/sda3 to the volume group vg_fmaster www.2cto.com 1 [root @ frank4 frankwu] # <span style = "color: #009900; "> lvm vgextend" vg_fmaster "/dev/sda3 </span> Volume group" vg_fmaster "successfully extendede. run lvresize-l + 100% FREE/dev/mapper/vg_fmaster-lv_root to extend lv_root volume 1 [root @ frank4 frankwu] # <span style = "color: #009900; "> lvresize-l + 100% FREE/dev/mapper/vg_fmaster-lv_root </span> 2 Extending logical volume lv_root to 12.54 GiB3 Logical volume lv_root successfully resizedf. execute resize2fs/dev/mapper/vg_fmaster-lv_root and reset the file system www.2cto.com 1 [root @ frank4 frankwu] # <span style = "color: #009900; "> resize2fs/dev/mapper/vg_fmaster-lv_root </span> resize2fs 1.41.12 (17-May-2010) 2 Filesystem at/dev/mapper/vg_fmaster-lv_root is mounted on /; on-line resizing required3old desc_blocks = 1, new_desc_blocks = 14 specify Ming an on-line resize of/dev/mapper/vg_fmaster-lv_root to 3286016 (4 k) blocks.5The filesystem on/dev/mapper/vg_fmaster-lv_root is now 3286016 blocks long.7. verify df-h-T www.2cto.com 1 [root @ frank4 frankwu] # df-h-T2Filesystem Type Size Used Avail Use % mounted on3/dev/mapper/vg_fmaster-lv_root4 ext4 13G 4.8G 7.0G 41%/5 tmpfs 499 M 272 K 499 M 1%/dev/shm6/dev/sda1 ext4 485 M 76 M 384 M 17%/boot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.