Installing Xen Server Tools on Scientific Linux

Scientific Linux is clone of CentOS but Xen fails to recognise it. 

First Step is to mount the Cdrom

mount -t iso9660 /dev/cdrom /mnt

Then change to directory

cd /mnt/Linux

Then fire the command by giving distro name and manjor vesion in command line

./install.sh -d centos -m 6

Select y and reboot.

You are done

Advertisement

XenServer – Creating a local ISO

 

Step 1 – Creating the ISO Library Folder

Connect to the XenServer using SSH and then issue the following command:

mkdir -p /var/opt/xen/ISO_Store

Step 2 – Create a ISO Storage Repository

Issue the following command within an SSH session:

xe sr-create name-label=LocalISO type=iso device-config:location=/var/opt/xen/ISO_Store device-config:legacy_mode=true content-type=iso

XenCenter will then update and show the new SR:

Now that we have an SR we just need to place the ISO files in the directory and installation can then begin, however trying to find direct links to media download is not always as straight forward as you may think. I needed a copy of 2008 R2 evaluation edition, so I followed Microsoft’s many steps in order to get the media, only to be advised that it was going to force me to use the download manager. Once the download manager started the download I could see the source location, but the link was far too long to copy and then re-write. So instead I paused the download and noticed that when I clicked the resume shortcut that was now on my desktop I was taken to the following URL:

http://care.dlservice.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso?lcid=1033&cprod=WinSvr2

This link is the actual path that the 2008 R2 Eval ISO is available from! So all we had to was now download the ISO using the command line on the XenServer:

Step 3 – Change directory

Change to the ISO storage directory:

cd /var/opt/xen/ISO_Store

Step 4 – Use wget to download the file

wget http://care.dlservice.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso?lcid=1033&cprod=WinSvr2

You will see output similar to the below:

Unfortunately Domain 0 only has 4GB of storage allocated by default, this ISO as demonstrated above is 2.9G and will fail during the download process due to lack of space. A smaller ISO (XP etc) would be fine, but not Win7 or 2008 R2 eval editions.

Using the command “df -h” we can see the current disk usage:

Part 2 – Creating a larger ISO library

When running the df -h command you will see the GPT partition that is listed as my local storage in XenCenter (/var/run/sr-mount etc). This has plenty of capactiy and will be perfect for my ISO requirement.

So we now create a new ISO directory (note that the GUID after /sr-mount will be different for each installation):

cd /var/run/sr-mount/1b042bc0-16b3-fa45-f94d-7a6e4e3dafbe/

then:

mkdir -p ISO_Storage

We now have an ISO_Storage folder that can be used to store ISO files and not have to worry about consuming all of Domain 0′s space. Now that the directory is there we can change directory to it:

cd /var/run/sr-mount/1b042bc0-16b3-fa45-f94d-7a6e4e3dafbe/ISO_Storage

Then re-issue the wget command from earlier –

wget http://care.dlservice.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso?lcid=1033&cprod=WinSvr2

One thing to note is that this particular ISO will not have a .ISO extension once downloaded it will be .ISO?lcid=1033, thankfully this is easily rectified by renaming the file:

mv 7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso\?lcid\=1033 7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso

Finally we add the new ISO_Storage folder as an ISO library:

xe sr-create name-label=ISO_Storage type=iso device-config:location=/var/run/sr-mount/1b042bc0-16b3-fa45-f94d-7a6e4e3dafbe/ISO_Storage device-config:legacy_mode=true content-type=iso

XenCenter will then display our newly created ISO library with any available .ISO files:

 

Resize a Linux VM LVM Disk in XenServer

Resizing a disk in existing VM without loosing data is daunting task. I spent hours finding the correct way to  resize the disk without loosing data. This might save some on lot of time.

A. Allotting additional disk to the VM:

a) Shut down the VM

b) Increase the physical disk size using the Xen Center. I recommend using Xen Center

Once the physical disk is increased it does not appear in VM once booted.

B. Boot into Rescue mode by inserting a Linux OS Dvd or the ISO image from your Xen ISO Library which i recommed.

a) Boot into Resuce mode by Selecting VM -> Start / Shutdown -> Start in Recovery Mode

b) Enter linux resuce in command prompt at boot time

c). Resize the physical disk. Please note this is most important follow exactly or you will loose data

fdisk /dev/sda then press p

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1188     9438187+  8e  Linux LVM

2. Press d then 2 to remove the partition
3. Press n then primary p  then 2 start cylinder 14 last cylinder 4865 to add the newly re-sized partition. WARNING: Make sure the old and new partition start at the same cylinder position, not doing so will destroy your data.
4. Press t partition 2 Hex code 8e
5. Press p

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4865    38973690   8e  Linux LVM

6. Finally press w write table to disk. 

d) Take a break you crossed the mine field now its easy.

We will use the lvm commands to resize the disk. Please note vgscan, vgchange etc will not work as these are sym link to lvm to run these command use lvm vgscanlvm pvscanlvm vgchange -ay

e) Lets run these LVM command

1) Resize the LVM physical volume, e.g.: lvm pvresize /dev/hda2

2) Run lvm vgscan, lvm vgchange -ay

3) Resize the LVM logical volume, e.g.: lvm lvresize /dev/VolGroup00/LogVol00 -l+100%FREE

4) Run e2fsck -f /dev/VolGroup00/LogVol00

5) Resize the filesystem, e.g.: resize2fs /dev/VolGroup00/LogVol00

6) Reboot. And pat your back, you are done.