Virtualbox modifies the Virtual Machine disk VDI size

Source: Internet
Author: User

During the use of virtual machines, sometimes the disk size is insufficient. If you set "Dynamic Storage Allocation", you can manually expand the disk space using the following method.

1. Start the CMD command line to enter the virtualbox installation directory. For example

Cd e: \ Program Files \ oracle \ virtualbox

2. view the virtual hard disk to be modified:

E: \ Program Files \ oracle \ virtualbox> vboxmanage.exe list hdds
UUID: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a
Parent UUID: Base
State: Locked write
Type: normal (base)
Location: F: \ VM \ CentOS-64.vdi
Storage Format: VDI
Capacity: 8000 Mbytes

UUID: 707d45b6-440d-4e51-96bd-8c9508bfd313
Parent UUID: Base
State: created
Type: normal (base)
Location: F: \ VM \ CentOS-64-ext.vdi
Storage Format: VDI
Capacity: 21273 Mbytes

UUID: aca81637-fbc0-4826-be66-847ecc96d83b
Parent UUID: Base
State: created
Type: normal (base)
Location: C: \ Users \ Edward. Wu \ virtualbox VMS \ WINXP. VDI
Storage Format: VDI
Capacity: 10240 Mbytes

----

We see there are three Virtual Disks, we want to modify the first in the figure, its space size is 8 GB, UUID: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a

2. Adjust the disk space to 15 GB:

E: \ Program Files \ oracle \ virtualbox> vboxmanage.exe modifyhd e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a -- resize 150000%... 10%... 20%... 30%... 40%... 50%... 60%... 70%... 80%... 90%... 100%

3. Check again:

E: \ Program Files \ oracle \ virtualbox> vboxmanage.exe list hddsuuid: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5aParent UUID: basestate: Locked writetype: normal (base) Location: F: \ VM \ CentOS-64.vdiStorage format: vdicapacity: 15000 Mbytes

UUID: 707d45b6-440d-4e51-96bd-8c9508bfd313parent UUID: basestate: createdtype: normal (base) Location: F: \ VM \ CentOS-64-ext.vdiStorage format: vdicapacity: 21273 Mbytes

UUID: aca81637-fbc0-4826-be66-847ecc96d83bParent UUID: basestate: createdtype: normal (base) Location: C: \ Users \ Edward. Wu \ virtualbox VMS \ WINXP. vdistorage format: vdicapacity: 10240 Mbytes

4. view new disk space

Restart the VM to view the disk status.

[[Email protected] ~] # Fdisk-L/dev/SDA

Disk/dev/SDA: 15.7 GB, 15728640000 bytes255 heads, 63 sectors/track, 1912 Cylinders

 

We can see that the disk space has been extended to 15 GB, but it cannot be used yet.

5. New enable space

Use fdisk to create the free space of the virtual disk as a new partition. Note that the partition code 8e representing Linux LVM should be used as the ID.

# Fdisk/dev/SDA

N {New partition}

P {primary partition}

3 {Partition Number}

T {change partition ID}

3 {Partition Number}

8e {Linux LVM partition}

W

------

If there is a prompt such as setting the size in the middle, press Enter.

6. Check whether the newly added sda3 is marked as LVM. If no reboot is required

# Fdisk-L/dev/SDA

7. Adjust LVM size

Let's take a look at volume group.

[[Email protected] ~] # Vgdisplay --- volume group --- VG name vg_aimin

....

8. Create a new physical volume for the newly allocated space

# Pvcreate/dev/sda3

 

9. Adjust the logical volume size

# Resize2fs/dev/vg_aimin/lv_root

Now the space is expanded.

 

10. view results

[[Email protected] ~] # DF-H file system capacity available in use % mount point/dev/mapper/vg_aimin-lv_root 12g 5.2g 6.2g 46%/tmpfs 499 m 80 K 499 M 1%/dev/SHM /dev/sda1 485 MB 33 m 427 m 8%/boot

Extended successfully !!!

 

Virtualbox modifies the Virtual Machine disk VDI size

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.