主机评测
突破XenServer的4G空间,建立ISO库
一、查看lvm分区情况
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
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 141.04 GB
PE Size 4.00 MB
Total PE 36106
Alloc PE / Size 1 / 4.00 MB
Free PE / Size 36105 / 141.04 GB
VG UUID VWGoCs-F44s-rtXU-hHv0-jCZ5-AQyS-GcPuLf
二、创建一个lv分区
[root@localhost ~]# lvcreate -L 40G -n iso VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea --config global{metadata_read_only=0}
Logical volume "iso" created [root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea/MGT
VG Name VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea
LV UUID VW5rW0-p6LA-eL16-TnxR-o3xL-n1i2-Qq8Qo8
LV Write Access read/write
LV Status available
#open 0
LV Size 4.00 MB
Current LE 1
Segments 1
Allocation inherit
Read ahead sectors auto
-currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea/iso
VG Name VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea
LV UUID 392U7I-cC13-LOvu-wnGT-8MVZ-iGME-cKrVL3
LV Write Access read/write
LV Status available
#open 0
LV Size 40.00 GB
Current LE 10240
Segments 1
Allocation inherit
Read ahead sectors auto
-currently set to 256
Block device 253:1
三、格式化该分区
[root@localhost ~]# mkfs.ext3 /dev/VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea/iso
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
5242880 inodes, 10485760 blocks
524288 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
320 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
四、创建一个挂载点目录
[root@localhost ~]# mkdir /iso
五、创建SR
[root@localhost ~]# xe sr-create name-label=iso type=iso device-config:location=/iso device-config:legacy_mode=true content-type=iso
六、挂载分区
[root@localhost ~]# mount /dev/VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea/iso /iso
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 4.0G 1.8G 2.0G 47% /
none 1.9G 80K 1.9G 1% /dev/shm
/opt/xensource/packages/iso/XenCenter.iso
56M 56M 0 100% /var/xen/xc-install
/dev/mapper/VG_XenStorage--036c62ff--d373--10ec--4349--ba3ff3b211ea-iso
40G 177M 38G 1% /iso
七、开机自动挂载
[root@localhost ~]# echo "lvchange -ay /dev/VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea/iso --config global{metadata_read_only=0}" >> /etc/rc.local
[root@localhost ~]# echo "mount /dev/VG_XenStorage-036c62ff-d373-10ec-4349-ba3ff3b211ea/iso /iso" >> /etc/rc.local
备注:文章中出现的 --config global{metadata_read_only=0}
是在xenserver7.0以上版本才要加入
或者编辑/etc/lvm/lvm.conf文件修改metadata_read_only=1为metadata_read_only=0
另外我写了一个自动化脚本在我另一篇博客上。