admin

XenServer -添加本地ISO镜像库

admin 虚拟化 2019-05-23 3562浏览 0

使用xenserver安装虚拟机的时候,需要共享一个网络位置作为iso文件的存储,本文在xenserver主机上本地存储开辟空间作为iso文件存储。

在xenserver主机上

 

1.创建共享文件夹

Shell代码  
  1. mkdir -p /var/opt/xen/ISO_Share  

 2.新建本地存储

Shell代码  
  1. xe sr-create name-label=Local_ISO_Share type=iso device-config:location=/var/opt/xen/ISO_Share device-config:legacy_mode=true content-type=iso  

 

3.上传iso到上面目录(通过sftp),然后如图

11111.jpg



到这里还没有结束,因为默认xenserver根目录只有4G,根本不够上传较大的系统镜像,此处有很多方法,默认xenserver采用lvm(逻辑卷)管理的,所有只需要从VG拿出一部分创建LV,然后挂载只iso目录增加容量就可以了。
 


创建逻辑卷(LV)使用lvcreate命令,这个例子为:在已有卷组中创建了一个逻辑卷名称为iso_storage大小为20GB (vg的名字用vgdisplay查看)

# lvcreate -L 20GB -n iso_storage VG_XenStorage-f3037445-be87-3041-5489-21451037a388

  Logical volume "iso_storage" created

  

  #加载使用lvm所需的相应模块

# modprobe dm-mod


  #扫描并显示LVM卷组列表

# vgscan

  Reading all physical volumes.  This may take a while...

  Found volume group "VG_XenStorage-f3037445-be87-3041-5489-21451037a388" using metadata type lvm2

  

  #将卷组状态改为活动的

# vgchange -ay

  2 logical volume(s) in volume group "VG_XenStorage-f3037445-be87-3041-5489-21451037a388" now active



#格式化刚刚创建的逻辑卷(LV) 

# mkfs.ext3 /dev/VG_XenStorage-f3037445-be87-3041-5489-21451037a388/iso_storage

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

2621440 inodes, 5242880 blocks

262144 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=0

160 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


Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 37 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@xenserver01 ISO_Share]# vgdisplay

  --- Volume group ---

  VG Name               VG_XenStorage-f3037445-be87-3041-5489-21451037a388

  System ID             

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  11

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               0

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size          


#挂载到iso目录

#mount /dev/VG_XenStorage-f3037445-be87-3041-5489-21451037a388/iso_storage /var/opt/xen/ISO_Share


加入开机启动

#vi /etc/fstab

/dev/VG_XenStorage-f3037445-be87-3041-5489-21451037a388/iso_storage /var/opt/xen/ISO_Share ext3     defaults   0  0


版权声明

本站《作品展示》类文章均为原创,转载必须注明出处,技术分享类文章部分来源于网络,版权归原作者所有,若侵权请留言。

发表评论