此法不稳定

我们都知道xenserver安装后,不管你的盘有多大,只有4G的空间。

故操作是:新建LV卷,可自定义大小

若ISO仓库已经创建好了,只需执行步骤1、2、3、4、5、7、8、9,把新的逻辑卷硬盘挂载到/opt/iso文件下(原来的镜像会消失

1、vgdisplay #先查看剩余空间

[root@XenServer /]# vgdisplay

--- Volume group ---
VG Name VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 11.99 GB
PE Size 4.00 MB
Total PE 3069
Alloc PE / Size 1 / 4.00 MB
Free PE / Size 3068 / 11.98 GB
VG UUID gdk23O-Ugch-ygeb-wiZc-aoIr-QbTL-XoQqfx


2、lvdisplay VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2 #查看该区

[root@XenServer /]#  lvdisplay VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2

--- Logical volume ---
LV Name /dev/VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2/MGT
VG Name VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2
LV UUID qnsQew-gAqU-IEqr-rGsF-jO3j-crwE-eNHqx5
LV Write Access read/write
LV Status NOT available
LV Size 4.00 MB
Current LE 1
Segments 1
Allocation inherit
Read ahead sectors auto



3、lvcreate -L 20GB -n iso VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2 #新建20G的lv卷iso

[root@XenServer /]#  lvcreate -L 20GB -n iso VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2

Logical volume "lviso" created

顺带提一下如何添加空间:


[root@XenServer /]#  lvcreate -n lviso -L +6G VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2

Logical volume "lviso" created



4、lvdisplay VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2 #再次查看该区

[root@XenServer /]#  lvdisplay VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2

--- Logical volume ---
LV Name /dev/VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2/MGT
VG Name VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2
LV UUID qnsQew-gAqU-IEqr-rGsF-jO3j-crwE-eNHqx5
LV Write Access read/write
LV Status NOT available
LV Size 4.00 MB
Current LE 1
Segments 1
Allocation inherit
Read ahead sectors auto

--- Logical volume ---
LV Name /dev/VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2/iso
VG Name VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2
LV UUID lmJmYH-OiRW-gQle-nCJk-Y9M9-zVev-JGvrqK
LV Write Access read/write
LV Status available
# open 0
LV Size 20.00 GB
Current LE 1536
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 252:1



5、mkfs.ext3 /dev/VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2/iso #格式化为ext3格式

mkfs.ext3 /dev/VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2/iso


6、mkdir /opt/iso #在/opt下建立iso文件夹,用于ISO镜像文件的挂载


7、vgchange -a y #激活所有卷组


8、mount /dev/VG_XenStorage-205eecff-2466-84fe-56d5-81472e44f3c2/lviso /iso #挂载/ISO文件夹下的iso镜像文件


9、df -h #查看容量

[root@XenServer /]#  df -h

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 4.0G 1.7G 2.1G 46% /
none 380M 0 380M 0% /dev/shm
/opt/xensource/packages/iso/XenCenter.iso
44M 44M 0 100% /var/xen/xc-install
/dev/mapper/XSLocalEXT--5983fa21--42bd--0cd6--aafd--78534a7908f7-5983fa21--42bd--0cd6--aafd--78534a7908f7
9.9G 911M 8.5G 10% /var/run/sr-mount/5983fa21-42bd-0cd6-aafd-78534a7908f7
/dev/mapper/VG_XenStorage--205eecff--2466--84fe--56d5--81472e44f3c2-lviso
6.0G 141M 5.5G 3% /ISO


10、通过Xftp 软件将 下载好的iso镜像文件上传到/opt /iso 目录中 注意更改 文件权限755

在这就可以转到XenCenter客户端操作了