首页 > 代码库 > XenServer7.0创建本地ISO库

XenServer7.0创建本地ISO库

    在6.5版本上创建ISO仓库不会牵扯到创建lvm时权限错误,但是再7.0版本却会出现这种错误,如下:

[root@DS-Server04 ~]# lvcreate -L 20G -n local_iso `vgs|awk ‘NR==2{print $1}‘`
  lvcreate -L 20G -n local_iso VG_XenStorage-8e812398-6d55-b06a-2907-ac95c4c12533: Command not permitted while global/metadata_read_only is set.

    提示为全局只读,不给创建。查官方资料,需要添加一个全局配置选项“--config global{metadata_read_only=0}”


    在xenserver7上如下按如下步骤添加本地ISO仓库:

[root@DS-Server04 ~]# lvcreate -L 20G -n local_iso `vgs|awk ‘NR==2{print $1}‘`  --config global{metadata_read_only=0}
Logical volume "local_iso" created.

  
[root@DS-Server04 ~]# mkfs.ext4 /dev/`vgs|awk ‘NR==2{print $1}‘`/local_iso
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2153775104
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
 
[root@DS-Server04 ~]# blkid /dev/`vgs|awk ‘NR==2{print $1}‘`/local_iso
/dev/VG_XenStorage-8e812398-6d55-b06a-2907-ac95c4c12533/local_iso: UUID="70674e3f-2d08-4623-b348-2f8bb6482c4d" TYPE="ext4"
[root@DS-Server04 ~]# echo ‘UUID=70674e3f-2d08-4623-b348-2f8bb6482c4d  /iso_storage  ext4  defaults    0 0‘ >>/etc/fstab
[root@DS-Server04 ~]# mkdir /iso_storage
[root@DS-Server04 ~]# mount -a
[root@DS-Server04 ~]# df -hP
Filesystem                                                         Size  Used Avail Use% Mounted on
/dev/sda1                                                           18G  1.8G   16G  11% /
devtmpfs                                                           2.0G     0  2.0G   0% /dev
tmpfs                                                              2.0G   84K  2.0G   1% /dev/shm
tmpfs                                                              2.0G  1.6M  2.0G   1% /run
tmpfs                                                              2.0G     0  2.0G   0% /sys/fs/cgroup
xenstore                                                           2.0G     0  2.0G   0% /var/lib/xenstored
/dev/loop0                                                          55M   55M     0 100% /var/xen/xc-install
/dev/sda4                                                          512M  2.0M  510M   1% /boot/efi
/dev/sda5                                                          4.0G  140M  3.7G   4% /var/log
tmpfs                                                              393M     0  393M   0% /run/user/0
/dev/VG_XenStorage-8e812398-6d55-b06a-2907-ac95c4c12533/local_iso   20G   45M   19G   1% /iso_storage
[root@DS-Server04 ~]# xe sr-create name-label=iso_storage type=iso device-config:location=/iso_storage device-config:legacy_mode=true content-type=iso
xe-mount-iso-sr /iso_storage

    在管理界面查看ISO仓库:

技术分享


    至此,本地仓库创建成功。

XenServer7.0创建本地ISO库