środa, 23 października 2013

Create local ISO repository

Create with lvcreate place for repository:
[root@xenserver1 ~]# lvcreate -L 30G -n ISO2 VG_XenStorage-f6375e1e-0ab7-b11c-e9dd-677da4436e15
Make proper file system:
[root@xenserver1 ~]# mkfs.ext3 /dev/VG_XenStorage-f6375e1e-0ab7-b11c-e9dd-677da4436e15/ISO2 
Add lines to /ec/rc.local
[root@xenserver1 ~]# vi /etc/rc.local 

ISO=/dev/VG_XenStorage-f6375e1e-0ab7-b11c-e9dd-677da4436e15/ISO2
lvchange -ay $ISO
mount $ISO /mnt/iso_import

It's very important not to change /etc/fstab !!!

Last thing is to mount everything without restart:
[root@xenserver1 ~]# ISO=/dev/VG_XenStorage-f6375e1e-0ab7-b11c-e9dd-677da4436e15/ISO2
[root@xenserver1 ~]# lvchange -ay $ISO
[root@xenserver1 ~]# mount $ISO /mnt/iso_import
[root@xenserver1 ~]# xe-mount-iso-sr /mnt/iso_import -o bind
Result:
[root@xenserver1 ~]# xe sr-list
uuid ( RO)                : 4e98e18e-1215-4fdb-baec-924bbef2a67e
          name-label ( RW): Remote ISO Library on: /mnt/iso_import
    name-description ( RW): 
                host ( RO): xenserver1
                type ( RO): iso
        content-type ( RO): iso


uuid ( RO)                : f30a1ead-37f2-0e3c-9583-073c176fc111
          name-label ( RW): Removable storage
    name-description ( RW): 
                host ( RO): xenserver1
                type ( RO): udev
        content-type ( RO): disk


uuid ( RO)                : 419c98d3-1d98-3049-c579-439c31b33fd4
          name-label ( RW): XenServer Tools
    name-description ( RW): XenServer Tools ISOs
                host ( RO): xenserver1
                type ( RO): iso
        content-type ( RO): iso


uuid ( RO)                : cb128245-3dcb-9de6-319d-681cede9553f
          name-label ( RW): DVD drives
    name-description ( RW): Physical DVD drives
                host ( RO): xenserver1
                type ( RO): udev
        content-type ( RO): iso


uuid ( RO)                : f6375e1e-0ab7-b11c-e9dd-677da4436e15
          name-label ( RW): Local storage
    name-description ( RW): 
                host ( RO): xenserver1
                type ( RO): lvm
        content-type ( RO): user