Get the App
SLTechnology News&Howtos  ›  Network Security  › 

4. A method for expanding disk space of xen virtual machine

Shulou Source: shulou.com Published: 2022-06-01 05:52:26 10月04日 Update

Note: it is recommended to add a virtual disk file and then add lvm logical volumes to the virtual machine to increase disk space. The creation process is as follows.

1. Dd creates a disk file

# dd if=/dev/sdb1 bs=1024M count=6 > / data/dd3.img

two。 Shut down the dd virtual machine

Xm shutdown dd

3. Modify the new virtual machine profile

# vi / etc/xen/dd

# modify instructions:

(1) name

(2) uuid changes the last few data.

(3) change the disk to the actual path, and pay attention to the disk number when adding a new disk.

(4) vif modifies the MAC address of the network card to change the last few data

Name = "dd"

Uuid = "cc49eaea-fb0c-5239-c055-bdafcf209cab" 3a4 43a

Maxmem = 512

Memory = 512

Vcpus = 1

Bootloader = "/ usr/bin/pygrub"

On_poweroff = "destroy"

On_reboot = "restart"

On_crash = "restart"

Disk = ["tap:aio:/data/dd.img,xvda,w", "tap:aio:/data/dd3.img,xvdb,w"]

Vif = ["mac=00:16:3e:44:ee:07,bridge=xenbr1,script=vif-bridge"]

Note: if you use LVM logical volumes, use the following parameters, and use logical volumes in a large number of xen virtualized environments, which will maximize disk performance.

Disk = ["tap:aio:/data/test01.img,xvda,w", "phy:/dev/lvmdata/var01,xvdb,w"]

4. Start the virtual machine

5. Enter the virtual machine through the console

(1) View the newly added virtual disk

View logical volume size

Df-h

(2) start zoning

Fdisk / dev/xvdb

N

P

one

T

8e

W

# partprobe this statement failed

(3) create a physical volume

View volume groups, logical volumes

Vgs

Lvs

Create physical volumes and extend physical volume groups

Pvcreate / dev/xvdb1

Vgextend VolGroup / dev/xvdb1

Extended logical Volume

If the address of the logical volume is not found, press tab

Lvextend-l + 100%FREE / dev/VolGroup/lv_root

6. Extended disk partition

# resize2fs / dev/VolGroup/lv_root

Finally, the disk space has been expanded.

Tags: Disk logic file physical space address data maximum parameter size actual performance console mode environment network card statement path procedure limit Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia macOS vpn Xiaomi Docker