您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这篇文章给大家介绍Xen虚拟机怎样扩展磁盘,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
扩展之前磁盘空间大小
[root@localhost ~]# df -THP Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root ext4 8.9G 642M 7.8G 8% / tmpfs tmpfs 257M 0 257M 0% /dev/shm /dev/xvda1 ext4 500M 27M 448M 6% /boot
创建磁盘不用关闭虚拟机有点生猛
dd if=/dev/zero bs=1024M count=4 >>/data/centos6.6.img #直接追加到磁盘
查看
[root@localhost ~]# df -TH Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root ext4 8.9G 642M 7.8G 8% / tmpfs tmpfs 257M 0 257M 0% /dev/shm /dev/xvda1 ext4 500M 27M 448M 6% /boot 上面查看好像没变其实添加到磁盘了没分 [root@localhost ~]# fdisk -l Disk /dev/xvda: 15.0 GB, 15032390656 bytes #总大小已经变了 255 heads, 63 sectors/track, 1827 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000398a4 Device Boot Start End Blocks Id System /dev/xvda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/xvda2 64 1306 9972736 8e Linux LVM Disk /dev/mapper/VolGroup-lv_root: 9168 MB, 9168748544 bytes 255 heads, 63 sectors/track, 1114 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/VolGroup-lv_swap: 1040 MB, 1040187392 bytes 255 heads, 63 sectors/track, 126 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
扩展
fdisk /dev/xvda 分区分成lvm 。。省略 [root@localhost ~]# partprobe [root@localhost ~]# cat /proc/partitions major minor #blocks name 202 0 14680069 xvda 202 1 512000 xvda1 202 2 9972736 xvda2 202 3 4189617 xvda3 253 0 8953856 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 a-- 9.51g 0 /dev/xvda3 lvm2 --- 4.00g 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.54 GiB (2186 extents) to 12.53 GiB (3208 extents). Logical volume lv_root successfully resized [root@localhost ~]# resize2fs -P /dev/VolGroup/lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing 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 -TH Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root ext4 14G 722M 12G 6% / tmpfs tmpfs 257M 0 257M 0% /dev/shm /dev/xvda1 ext4 500M 27M 448M 6% /boot
关于Xen虚拟机怎样扩展磁盘就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。