一 . 进入XenServer控制台修改磁盘大小
# xe vm-disk-list vm=VM_Name
#xe vdi-resize uuid=97c7c9b0-f3e0-4b1d-b43d-bbc230e01aa4 disk-size=50GiB
二.启动VM,进入系统,进行调整。
Windows虚拟机
例如WIN7:"计算机"——〉"管理"——〉"磁盘管理"——〉”扩展卷“
Linux虚拟机
# fdisk –l ////查看分区状态
Disk /dev/xvda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 13 104391 83 Linux
/dev/xvda2 14 6527 52323705 8e Linux LVM
Disk /dev/xvdd: 66 MB, 66908160 bytes
# fdisk /dev/xvda
Command (m for help): p //查看已分区数量
Command (m for help): n //新增加一个分区
Command action
e extended
p primary partition (1-4)
p //分区类型选择主分区
Partition number (1-4): 3 //分区号选3
First cylinder (6528-13054, default 6528): //回车(起始扇区)
Using default value 6528
Last cylinder or +size or +sizeM or +sizeK (6528-13054, default 13054): //回车(结束扇区)
Using default value 13054
Command (m for help): t //修改分区类型
Partition number (1-4): 3 //分区号选3
Hex code (type L to list codes): 8e //修改为LVM(8e就是LVM)
Changed system type of partition 3 to 8e (Linux LVM)
Command (m for help): w //写分表,保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
//系统提示重启,但你可以不重启,执行以下命令:
# partprobe /dev/xvda //刷新分区表
[root@WXCRM-DB ~]# pvcreate /dev/xvda3 //将/dev/xvda3建立为pv
Physical volume "/dev/xvda3" successfully created
# vgextend VolGroup00 /dev/xvda3 //将新建的pv加入到系统VG:VolGroup00
Volume group "VolGroup00" successfully extended
[root@WXCRM-DB ~]# lvextend -L +49G /dev/VolGroup00/LogVol00 //给LogVol00增加49G空间
Extending logical volume LogVol00 to 94.91 GB
Logical volume LogVol00 successfully resized
[root@WXCRM-DB ~]# resize2fs /dev/VolGroup00/LogVol00 //激活修改的配置
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 24879104 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 24879104 blocks long.
[root@WXTrans-DB ~]# df –Th //查看分区己变化
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
ext3 92G 12G 76G 14% /
/dev/xvda1 ext3 99M 14M 81M 15% /boot
tmpfs tmpfs 1.1G 0 1.1G 0% /dev/shm