Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How the Xen virtual machine expands the disk

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the Xen virtual machine how to expand the disk, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Amount of disk space before expansion

[root@localhost ~] # df-THPFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root ext4 8.9G 642m 7.8G 8% / tmpfs tmpfs 257M 0257m 0% / dev/shm/dev/xvda1 ext4 500M 27M 448M 6% / boot

Creating a disk without shutting down the virtual machine is a little fierce.

Dd if=/dev/zero bs=1024M count=4 > > / data/centos6.6.img # appends directly to disk

View

[root@localhost ~] # df-THFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root ext4 8.9G 642m 7.8G 8% / tmpfs tmpfs 257m 0257m 0% / dev/shm/dev/xvda1 ext4 500m 27m 448m 6% / boot looks as if it has not changed but has actually been added to the disk [ Root@localhost ~] # fdisk-lDisk / dev/xvda: 15.0 GB The total size of 15032390656 bytes # has changed to 255heads, 63 sectors/track 1827 cylindersUnits = cylinders of 16065 * 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000398a4 Device Boot Start End Blocks Id System/dev/xvda1 * 1 64 512000 83 LinuxPartition 1 does not end on cylinder boundary./dev/xvda2 64 1306 9972736 8e Linux LVMDisk / dev/mapper/VolGroup-lv_root: 9168 MB, 9168748544 bytes255 heads 63 sectors/track, 1114 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk / dev/mapper/VolGroup-lv_swap: 1040 MB, 1040187392 bytes255 heads, 63 sectors/track, 126 cylindersUnits = cylinders of 16065 * 512 = 8225 280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000

Expansion

The fdisk / dev/xvda partition is divided into lvm. Omit [root@localhost ~] # partprobe [root@localhost ~] # cat / proc/partitions major minor # blocks name 2020 14680069 xvda 202 1 512000 xvda1 202 2 9972736 xvda2 203 4189617 xvda3 253 08953856 dm-0 253 1 1015808 dm-1 [root@localhost] # pvcreate / dev/xvda3 Physical volume "/ dev/xvda3" successfully created [root@localhost ~] # pvs PV VG Fmt Attr PSize PFree / dev/xvda2 VolGroup lvm2 aMel-9.51g 0 / dev/xvda3 lvm2-4.00g [root@localhost] # vgextend VolGroup/ dev/xvda3 Volume group "VolGroup" successfully extended [root@localhost] # lvextend-l + 100%FREE / dev/VolGroup/lv_root Size of logical volume VolGroup/lv_root changed from 8.54GiB (2186 extents) to 12.53GiB (3208 extents). Logical volume lv_root successfully resized [root@localhost ~] # resize2fs-P / dev/VolGroup/lv_rootresize2fs 1.41.12 (17-May-2010) Filesystem at / dev/VolGroup/lv_root is mounted on / On-line resizing requiredold desc_blocks = 1 New_desc_blocks = 1Performing an on-line resize of / dev/VolGroup/lv_root to 3284992 (4k) blocks.The filesystem on/dev/ VolGroup/lv_root is now 3284992 blocks long. [root@localhost ~] # df-THFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root ext4 14G 722M 12G 6% / tmpfs tmpfs 257M 0257M 0% / dev / shm/dev/xvda1 ext4 500m 27m 448m 6% / boot on how the Xen virtual machine expands the disk, that's all. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report