Home  >  Article  >  Operation and Maintenance  >  How to expand disk space of xen virtual machine

How to expand disk space of xen virtual machine

WBOY
WBOYforward
2023-05-15 22:55:131729browse

With the extensive use of virtualization technology, there are more and more ideas about using virtualization, such as directly expanding the disk space. In this case, I recommend the method of adding a new disk, which is consistent with the normal use of physical machines. Way.

There is another way to increase disk space, which is to directly expand the space of the existing disk. This method is used in this article.

1. View the virtual machine configuration file

xm list
How to expand disk space of xen virtual machine

##2. The dd2 virtual machine uses /data /dd2.img

How to expand disk space of xen virtual machine

3. Directly expand the existing virtual disk space

Now check the virtual machine disk file size

ll -h

How to expand disk space of xen virtual machine

Directly extend the virtual machine disk file

dd if=/dev/sdb1 bs=1024M count=4 > ;>/data/dd2.img

How to expand disk space of xen virtual machine

has been expanded to 10G, let’s enter the virtual machine for configuration

How to expand disk space of xen virtual machine

4. Start and enter the virtual machine and partition

virt-manager &

How to expand disk space of xen virtual machine

(1) Enter the virtual machine Machine console

How to expand disk space of xen virtual machine

(2) Check the disk partition

It is found that the disk space has not changed and the disk space has not changed. The size has been expanded to 10G. If you directly add the expanded space, you can create another partition and use it directly. Merge the newly created partition directly into the current LVM logical volume.

How to expand disk space of xen virtual machine

How to expand disk space of xen virtual machine

(3) Partition

Add the new disk Add the unused disk space to create a new primary partition /dev/xvda3, and identify the disk as the lvm partition

fdisk /dev/xvda

n

p

##3

t

3

8e

w

How to expand disk space of xen virtual machine

5. Merge the new partition into the LVM logical volume

(1) Create a physical volume

pvcreate /dev/xvda3

pvs

How to expand disk space of xen virtual machine##(2) Create a logical volume group

vgs

vgextend VolGroup /dev/xvda3

##(3) Extend the existing logical volume How to expand disk space of xen virtual machine

lvs

##lvextend -l 100%FREE /dev/VolGroup/lv_root

(4) resize extended logical partition

How to expand disk space of xen virtual machine

resize2fs /dev/VolGroup/lv_root

At this time, add disk space and the expansion is completed.

The above is the detailed content of How to expand disk space of xen virtual machine. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete