VirtualBox Linux (CentOS) extended disk space

Source: Internet
Author: User

Recently in Linux to do file merge, do participle, disk space is not enough, the extended disk space method to record.

1. Open Windows Small Black window under VirtualBox installation path (e.g. C:\Program files\oracle\virtualbox>)

Perform:

Vboxmanage Modifyhd E:\vbox\Ubuntu12.04\Ubuntu1204-201310-disk1.vdi--resize 30000 (30000 is the capacity you want to increase, in M, Can be determined according to their own situation)

If the virtual machine is in VMDK format, you can execute the following command to convert the virtual hard disk to store the file format before executing the command:

vboxmanage Clonehd e:\vbox\Ubuntu12.04\Ubuntu1204-201302-disk1.vmdk e:\vbox\Ubuntu12.04\ Ubuntu1204-201310-disk1.vdi--format VDI

2. Open the virtual machine settings, locate the storage, click on the virtual hard disk controller, click on the "Add virtual hard Disk", and select "Use Existing virtual disks", check the size of the VDI file, and then see the controller more than one hard disk icon to see the capacity of 29.30G. Delete the original VMDK virtual disk. Determine the save configuration.

3. Enter Linux

#查看挂载点:
Execution: Df-h
#显示:

File system capacity has been used with available percent mount points
/dev/mapper/centos-root
47G 12G 34G 25%/
Tmpfs 504M 88K 504M 1%/DEV/SHM
/DEV/SDA1 485M 31M 429M 7%/boot

Partition and format the newly added hard drive

Partition:

FDISK/DEV/SDA Operation/DEV/SDA Partition table

p View the number of partitions (I see two/dev/sda1/dev/sda2)

N Add a new partition

p Partition type we select Primary partition

3 Area code Select 3 (because it has already been used, see above)

Enter default (start sector)

Enter default (end sector)

T Modify the partition type

3 Select partition 3

8e modified to LVM (8e is LVM)

w Write partition table

q Complete, exit the FDISK command

The system prompts you to restart, restart

After booting, format:

Mkfs.ext3/dev/sda3

Add new LVM to an existing LVM group for capacity expansion (if there is an error in the process, it is possible that the existing remaining capacity of Linux is too small, delete a useless file and try again)

LVM into LVM Management

Lvm> Pvcreate/dev/sda3 Initialize the partition just now

lvm> vgextend Centos/dev/sda3     to join the initialized partition to the virtual volume group

Lvm>lvextend-l +29.9g/dev/centos/root    Extending the capacity of an existing volume

lvm>pvdisplay View Volume capacity

Lvm> quit quit

The above is only the volume expansion, the following is the real expansion of the file system, enter the following command:

Resize2fs/dev/centos/root (XFS will use this command: xfs_growfs/dev/centos/root)

run again under: Df-h look under our machine

VirtualBox Linux (CentOS) extended disk space

Related Article

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.