Senin, 08 September 2014

Citrix XenServer - Seri 3 (Membuat SR bertipe ISO Dari Local Storage)

SR dengan tipe ISO berfungsi untuk menyimpan file-file CD Images yang berformat ISO. Biasanya disebut dengan ISO Library. Disini kita akan mengalokasikan kapasitas sebesar 50 GB sebagai partisi yang akan menampung file-file ISO. Space yang digunakan diambil dari SR lvm yang pada tutorial yang lalu telah kita buat dan difungsikan sebagai Backup Storage. Ikuti langkah-langkah berikut ini.

[root@xenserver-master ~]# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 500.1 GB, 500107862016 bytes
256 heads, 63 sectors/track, 60563 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       60564   488386583+  ee  EFI GPT

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/dm-0: 498.9 GB, 498999492608 bytes
255 heads, 63 sectors/track, 60666 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table
 
[root@xenserver-master ~]# pvs
  PV                                                                VG                                                 Fmt  Attr PSize   PFree  
  /dev/mapper/ddf1_4c5349202020202080862925000000004711471100001450 VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca lvm2 a-   464,72G 464,71G
  /dev/sda3                                                         VG_XenStorage-f2faf157-8ee8-7434-58ad-c01875eecff8 lvm2 a-   457,75G 457,75G
 
[root@xenserver-master ~]# lvs
  LV   VG                                                 Attr   LSize Origin Snap%  Move Log Copy%  Convert
  MGT  VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca -wi-a- 4,00M                                      
  MGT  VG_XenStorage-f2faf157-8ee8-7434-58ad-c01875eecff8 -wi-a- 4,00M                                      
 
[root@xenserver-master ~]# pvs
  PV                                                                VG                                                 Fmt  Attr PSize   PFree  
  /dev/mapper/ddf1_4c5349202020202080862925000000004711471100001450 VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca lvm2 a-   464,72G 464,71G
  /dev/sda3                                                         VG_XenStorage-f2faf157-8ee8-7434-58ad-c01875eecff8 lvm2 a-   457,75G 457,75G
 
[root@xenserver-master ~]# vgs
  VG                                                 #PV #LV #SN Attr   VSize   VFree  
  VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca   1   1   0 wz--n- 464,72G 464,71G
  VG_XenStorage-f2faf157-8ee8-7434-58ad-c01875eecff8   1   1   0 wz--n- 457,75G 457,75G
 
[root@xenserver-master ~]# lvs
  LV   VG                                                 Attr   LSize Origin Snap%  Move Log Copy%  Convert
  MGT  VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca -wi-a- 4,00M                                      
  MGT  VG_XenStorage-f2faf157-8ee8-7434-58ad-c01875eecff8 -wi-a- 4,00M                                      
 
[root@xenserver-master ~]# lvcreate VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca --size 50G --name ISO-Lib
  Logical volume "ISO-Lib" created
 
[root@xenserver-master ~]# lvs
  LV      VG                                                 Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  ISO-Lib VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca -wi-a- 50,00G                                      
  MGT     VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca -wi-a-  4,00M                                      
  MGT     VG_XenStorage-f2faf157-8ee8-7434-58ad-c01875eecff8 -wi-a-  4,00M                                      
 
[root@xenserver-master ~]# mkfs.ext3 /dev/VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca/ISO-Lib
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
6553600 inodes, 13107200 blocks
655360 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
400 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, 11239424

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Kemudian buat folder sebagai mount point Logical Volume yang telah dibuat, diikuti dengan konfigurasi file "/etc/rc.local".

[root@xenserver-master ~]# mkdir /mnt/ISO-Lib
[root@xenserver-master ~]# vi /etc/rc.local


#!/bin/bash

touch /etc/boottime.stamp

/sbin/update-issue
clear </dev/tty1 >/dev/tty1

if [ ! -e /etc/xensource/no_move_kernel_tty ]
then
    # Put the kernel messages on tty2
    /usr/bin/openvt -c 2 /bin/echo "System Messages:"
    /opt/xensource/libexec/set-printk-console 2
fi

# Store xen dmesg so that xen boot messages can be read after console ring
# wrap around
xl dmesg &> /var/log/xen-dmesg

#ISO Library
vgchange -ay
mount -t ext3 /dev/VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca/ISO-Lib /mnt/ISO-Lib


[root@xenserver-master ~]# reboot 

Reboot XenServer untuk memastikan konfigurasi telah benar. Kemudian cek apakah Logical Volume tersebut telah berhasil di-mount secara otomatis pada tempatnya ?.

[root@xenserver-master ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             4,0G  1,9G  2,0G  49% /
none                  373M   24K  373M   1% /dev/shm
/opt/xensource/packages/iso/XenCenter.iso
                       52M   52M     0 100% /var/xen/xc-install
/dev/mapper/VG_XenStorage--3c866da7--560e--d623--4d2f--df5b8beec3ca-ISO--Lib
                       50G  180M   47G   1% /mnt/ISO-Lib
 
[root@xenserver-master ~]# pvs
  PV                                                                VG                                                 Fmt  Attr PSize   PFree  
  /dev/mapper/ddf1_4c5349202020202080862925000000004711471100001450 VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca lvm2 a-   464,72G 414,71G
  /dev/sda3                                                         VG_XenStorage-f2faf157-8ee8-7434-58ad-c01875eecff8 lvm2 a-   457,75G 457,75G
 
[root@xenserver-master ~]# lvs
  LV      VG                                                 Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  ISO-Lib VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca -wi-ao 50,00G                                      
  MGT     VG_XenStorage-3c866da7-560e-d623-4d2f-df5b8beec3ca -wi-a-  4,00M                                      
  MGT     VG_XenStorage-f2faf157-8ee8-7434-58ad-c01875eecff8 -wi-a-  4,00M 

Kemudian selanjutnya buat SR dengan tipe ISO.

[root@xenserver-master ~]# xe sr-create host-uuid=7f24122f-4caf-42a2-bcf6-dbdf03e9760d content-type=iso type=iso name-label="ISO Lib" device-config:location=/mnt/ISO-Lib device-config:legacy_mode=true
8228cf6d-cdda-d321-9138-754289e8d9d2
[root@xenserver-master ~]# xe sr-list uuid=8228cf6d-cdda-d321-9138-754289e8d9d2 params=all
uuid ( RO)                    : 8228cf6d-cdda-d321-9138-754289e8d9d2
              name-label ( RW): ISO Lib
        name-description ( RW): 
                    host ( RO): xenserver-master
      allowed-operations (SRO): VDI.create; PBD.create; PBD.destroy; plug; VDI.destroy; scan; VDI.clone; unplug
      current-operations (SRO): 
                    VDIs (SRO): 
                    PBDs (SRO): e6889c64-0358-58ee-09ee-87f671223209
      virtual-allocation ( RO): 0
    physical-utilisation ( RO): -1
           physical-size ( RO): -1
                    type ( RO): iso
            content-type ( RO): iso
                  shared ( RW): false
           introduced-by ( RO): <not in database>
            other-config (MRW): 
               sm-config (MRO): 
                   blobs ( RO): 
     local-cache-enabled ( RO): false
                    tags (SRW):

Kemudian tambahkan file-file ISO kedalam folder tersebut dan periksa perubahan VDI-VDI yang terkait dengan SR ini.

[root@xenserver-master ~]# mkdir /mnt/temp
[root@xenserver-master ~]# mount -t cifs //192.168.100.16/nfs-it-samba/ISO/ /mnt/temp/ -o username=it,password=passwordsamba

[root@xenserver-master ~]# ls -l /mnt/temp/
total 11892736
-rw------- 1 1000 1000  358959104 Nov 13  2013 CentOS-6.4-x86_64-minimal.iso
-rw------- 1 1000 1000  103936000 Des  9  2013 ltsp-4.1-0.iso
-rw------- 1 1000 1000   12488704 Agu 12  2011 Mikrotik_2_9_6.iso
-rw------- 1 1000 1000   12488704 Sep 14  2012 Mikrotik-2.9.6.iso
-rw------- 1 1000 1000  585736192 Des 18  2013 MsOffice2007.iso
-rw------- 1 1000 1000  204851200 Nov 13  2013 turnkey-fileserver-13.0-wheezy-amd64(0)(0).iso
-rw------- 1 1000 1000  197036032 Jan 15  2014 turnkey-mysql-13.0-wheezy-amd64.iso
-rw------- 1 1000 1000  189384704 Jan 15  2014 turnkey-postgresql-13.0-wheezy-amd64.iso
-rw------- 1 1000 1000  704217088 Jan  3  2012 ubuntu-10.04.3-server-i386.iso
-rw------- 1 1000 1000  729858048 Apr  2  2012 ubuntu-10.04.4-alternate-i386.iso
-rw------- 1 1000 1000  736407552 Jan 11  2013 ubuntu-12.04-beta1-desktop-i386.iso
-rw------- 1 1000 1000 1010827264 Mei  2 12:48 ubuntu-14.04-desktop-amd64.iso
-rw------- 1 1000 1000  591396864 Mei  2 18:18 ubuntu-14.04-server-amd64.iso
-rw------- 1 1000 1000     154055 Agu 14  2011 ubuntu-8.04.4-server-i386.iso
-rw------- 1 1000 1000 2936983552 Jul 11  2012 Visual Studio 2005.iso
-rw------- 1 1000 1000  661839872 Okt 12  2012 Visual Studio 6.0 enterprise edition.iso
-rw------- 1 1000 1000 2539749376 Jan  9  2014 W7_DVD.iso
-rw------- 1 1000 1000  590448640 Des 16  2013 XenServer-6.2.0-install-cd.iso

[root@xenserver-master ~]# rsync -avzhP /mnt/temp/*.iso /mnt/ISO-Lib/
sending incremental file list
CentOS-6.4-x86_64-minimal.iso
     358.96M 100%    4.52MB/s    0:01:15 (xfer#1, to-check=17/18)
Mikrotik-2.9.6.iso
      12.49M 100%    3.32MB/s    0:00:03 (xfer#2, to-check=16/18)
Mikrotik_2_9_6.iso
      12.49M 100%    4.04MB/s    0:00:02 (xfer#3, to-check=15/18)
MsOffice2007.iso
     585.74M 100%    4.54MB/s    0:02:02 (xfer#4, to-check=14/18)
Visual Studio 2005.iso
       2.94G 100%    4.56MB/s    0:10:13 (xfer#5, to-check=13/18)
Visual Studio 6.0 enterprise edition.iso
     661.84M 100%    4.53MB/s    0:02:19 (xfer#6, to-check=12/18)
W7_DVD.iso
       2.54G 100%    4.56MB/s    0:08:50 (xfer#7, to-check=11/18)
XenServer-6.2.0-install-cd.iso
     590.45M 100%    4.56MB/s    0:02:03 (xfer#8, to-check=10/18)
ltsp-4.1-0.iso
     103.94M 100%    4.42MB/s    0:00:22 (xfer#9, to-check=9/18)
turnkey-fileserver-13.0-wheezy-amd64(0)(0).iso
     204.85M 100%    4.51MB/s    0:00:43 (xfer#10, to-check=8/18)
turnkey-mysql-13.0-wheezy-amd64.iso
     197.04M 100%    4.50MB/s    0:00:41 (xfer#11, to-check=7/18)
turnkey-postgresql-13.0-wheezy-amd64.iso
     189.38M 100%    4.55MB/s    0:00:39 (xfer#12, to-check=6/18)
ubuntu-10.04.3-server-i386.iso
     704.22M 100%    4.58MB/s    0:02:26 (xfer#13, to-check=5/18)
ubuntu-10.04.4-alternate-i386.iso
     729.86M 100%    4.53MB/s    0:02:33 (xfer#14, to-check=4/18)
ubuntu-12.04-beta1-desktop-i386.iso
     736.41M 100%    4.55MB/s    0:02:34 (xfer#15, to-check=3/18)
ubuntu-14.04-desktop-amd64.iso
       1.01G 100%    4.56MB/s    0:03:31 (xfer#16, to-check=2/18)
ubuntu-14.04-server-amd64.iso
     591.40M 100%    4.56MB/s    0:02:03 (xfer#17, to-check=1/18)
ubuntu-8.04.4-server-i386.iso
     154.06K 100%  214.31kB/s    0:00:00 (xfer#18, to-check=0/18)

sent 12.17G bytes  received 354 bytes  4.79M bytes/sec
total size is 12.17G  speedup is 1.00

[root@xenserver-master ~]# xe sr-scan uuid=8228cf6d-cdda-d321-9138-754289e8d9d2 

[root@xenserver-master ~]# xe sr-list uuid=8228cf6d-cdda-d321-9138-754289e8d9d2 params=all
uuid ( RO)                    : 8228cf6d-cdda-d321-9138-754289e8d9d2
              name-label ( RW): ISO Lib
        name-description ( RW): 
                    host ( RO): xenserver-master
      allowed-operations (SRO): VDI.create; PBD.create; PBD.destroy; plug; VDI.destroy; scan; VDI.clone; unplug
      current-operations (SRO): 
                    VDIs (SRO): d5ea948b-b6df-4d43-bd91-406648477bc0; 04d499de-6a4d-4f94-89fa-9d1b7d0431fd; 791cebc9-f086-4368-a727-69b269090af9; 8db36b44-63f6-4885-b5f7-ff47842a3aea; 0b210534-d2a4-4ed6-874b-52c08c4339be; 50582130-19e0-420d-86b7-47f103195232; efd183cc-6f92-471f-8803-be709aea6dc2; 57902947-e9ba-4cdf-a568-297359e6bcc4; 846156cc-df0a-4599-a286-2f1f1f9822dc; 2c9db00a-9dff-47ff-817d-782a695435c0; ac4caf81-f6b3-4f0f-93d6-1333ff8acd87; 7cf51bcd-66ac-4e9d-bb6f-3a40e2debefc; f7302352-ae44-4e27-979e-547dd7959e45; e170a5a2-d686-4fc4-a0c9-c66ab0f9372f; 4c8dbc93-fc79-4f41-b4f7-407da19b2840; 15dfcad8-119e-4ec8-805d-1128bbc06c8f; 8c1f15c3-d458-44ac-b8f0-f2b969a5655c; 3801bb23-3a1f-481b-85a2-147f7e28d4d8
                    PBDs (SRO): e6889c64-0358-58ee-09ee-87f671223209
      virtual-allocation ( RO): 0
    physical-utilisation ( RO): -1
           physical-size ( RO): -1
                    type ( RO): iso
            content-type ( RO): iso
                  shared ( RW): false
           introduced-by ( RO): <not in database>
            other-config (MRW): 
               sm-config (MRO): 
                   blobs ( RO): 
     local-cache-enabled ( RO): false
                    tags (SRW): 

Baiklah cukup sekian tutorial kali ini.

Tidak ada komentar:

Posting Komentar