<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>LinuxQuestions.org - Blogs - iamswift</title>
		<link>http://www.linuxquestions.org/questions/blog/iamswift-664867/</link>
		<description>LinuxQuestions.org offers a free Linux forum where Linux newbies can ask questions and Linux experts can offer advice. Topics include security, installation, networking and much more.</description>
		<language>en</language>
		<lastBuildDate>Mon, 20 May 2013 04:52:33 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>https://lqo-thequestionsnetw.netdna-ssl.com/questions/images/misc/rss.jpg</url>
			<title>LinuxQuestions.org - Blogs - iamswift</title>
			<link>http://www.linuxquestions.org/questions/blog/iamswift-664867/</link>
		</image>
		<item>
			<title>RHEL – Installing multiple OS versions using Logical Volume Manager</title>
			<link>http://www.linuxquestions.org/questions/blog/iamswift-664867/rhel-%96-installing-multiple-os-versions-using-logical-volume-manager-35078/</link>
			<pubDate>Wed, 10 Oct 2012 12:56:48 GMT</pubDate>
			<description>*Introduction: * 
Logical Volume Manager is a very good tool available in Linux to play around with disks and its sizes. This tool is very powerful...</description>
			<content:encoded><![CDATA[<div><b><font size="2">Introduction: </font></b><br />
Logical Volume Manager is a very good tool available in Linux to play around with disks and its sizes. This tool is very powerful that it virtually eliminates the requirement for fdisk based partition after the initial setup. Nowadays only two main partitions are created. One for &#8220;boot&#8221; and another for &#8220;LVM&#8221;. LVM internally has volume groups and logical volumes which act as independent partitions.<br />
<br />
This article talks about how a free / available logical volume can be used to install a new version of OS unlike old ways where partition is necessary to accommodate multiple OS installation. For example, I might have RHEL 5.1 already installed and I want RHEL 5.8 to be installed in new logical volume instead of upgrading the RHEL5.1, I could do so with help of LVM.<br />
<br />
In case the Volume group and logical volume is not properly planned and just has a single logical volume, we still can carve out a new logical volume from the root partition of the existing OS. <br />
Refer link: <a href="http://www.linuxquestions.org/questions/blog/iamswift-664867/rhel-%96-create-new-logical-volume-from-root-volume-35077/">http://www.linuxquestions.org/questi...-volume-35077/</a><br />
<br />
<b><font size="2">Installing additional OS:</font></b><br />
Assuming there is already a free logical volume available for new OS installation, the below steps are to be followed to install additional OS in a logical volume.<br />
<br />
The &#8220;lvs&#8221; command gives us the list of logical volumes. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto"># lvs
  LV           VG                 Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  Lv_root    VolGroup01  -wi-ao  64G
  Lv_root2  VolGroup01  -wi-ao  64G					
  Lv_swap  VolGroup01  -wi-ao  17.62G</pre>
</div><br />
Here we have Lv_root and Lv_root2 logical volumes available. Lets say, we already have RHEL 5.1 installed in Lv_root and we are about to install RHEL 5.8 in Lv_root2.<br />
<br />
First step is to check whether Lv_root2 logical volume is formatted in correct format (ext2 or ext3). Otherwise, we have to format the file system.<br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># mkfs &#8211;t ext3 /dev/VolGroup01/Lv_root2</pre>
</div><br />
Next is to mount the logical volume in a temporary dir so that new OS can be installed.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto"># mkdir &#8211;p /tmp/root2
# mount  /dev/VolGroup01/Lv_root2  /tmp/root2/</pre>
</div>Installing additional OS in the Lv_root2 logical volume can be done in several ways. A yum local repository can be setup where the additional OS rpms can be placed. Another method is to use the &#8220;rpm&#8221; command and install additional OS in Lv_root2. The advantage of &#8220;yum&#8221; is that the package dependency is resolved internally and the order of installing the package is taken care by &#8220;yum&#8221;.<br />
<br />
To set local yum repository:<br />
For the baseurl attribute, provide the path where the RPMs are available.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto"># cd /etc/yum.repos.d/
# echo &#8220;[rhel5_8]&#8221; &gt; rhel5_8.repo 
# echo &#8220;name=RHEL 5.8&#8221; &gt;&gt; rhel5_8.repo
# echo &#8220;baseurl=file:///path/to/rpm/&#8221; &gt;&gt; rhel5_8.repo
# echo &#8220;enabled=0&#8221; &gt;&gt; rhel5_8.repo</pre>
</div>Once yum local repository is set, install temporary OS in the swap partition which is now mounted in /tmp/tmproot/ dir.<br />
Note that we are just installing Base and Core packages. If additional packages are required those packages too to be added in the &#8220;groupinstall&#8221; option of below command.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># yum &#8211;&#8211;installroot=/tmp/tmproot &#8211;&#8211;enablerepo=tempos  groupinstall  Base Core &#8211;y &#8211;&#8211;nogpgcheck</pre>
</div><br />
Once the installation is done, it is necessary that few important files are copied to temporary OS installation so that when the temporary OS is booted, the parameters of original OS are available to new OS as well.<br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto"># cp &#8211;p /etc/fstab  /tmp/root2/etc/
# cp &#8211;p /etc/passwd  /tmp/root2/etc/
# cp &#8211;p /etc/shadow  /tmp/root2/etc/
# cp &#8211;p /etc/group  /tmp/root2/etc/</pre>
</div>Edit the fstab to mount correct filesystems.<br />
The copied fstab should look something as below:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 162px;
		text-align: left;
		overflow: auto"># cat /tmp/root2/etc/fstab

/dev/VolGroup01/Lv_root 	/               	ext3    defaults        1 1
LABEL=/boot             		/boot                ext3    defaults        1 2
tmpfs                   		/dev/shm           tmpfs   defaults        0 0
devpts                  		/dev/pts             devpts  gid=5,mode=620  0 0
sysfs                   		/sys                   sysfs   defaults        0 0
proc                    		/proc                  proc    defaults        0 0
/dev/VolGroup01/Lv_swap 	swap                  swap    defaults        0 0</pre>
</div>The fstab entries are to be edited so that /dev/VolGroup01/Lv_root2 logical volume is to be mounted as root (/) partition. Edit the /tmp/root2/etc/fstab as below (changes in red).<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 130px;
		text-align: left;
		overflow: auto">/dev/VolGroup01/<font color="Red">Lv_root2</font> 	/               	ext3    defaults        1 1			&#61663; Edited
LABEL=/boot             		/boot                ext3    defaults        1 2
tmpfs                   		/dev/shm           tmpfs   defaults        0 0
devpts                  		/dev/pts             devpts  gid=5,mode=620  0 0
sysfs                   		/sys                   sysfs   defaults        0 0
proc                    		/proc                  proc    defaults        0 0
/dev/VolGroup01/Lv_swap 	swap                  swap    defaults        0 0</pre>
</div>Edit the /boot/grub/grub.conf to add additional boot option from Lv_root2 logical volume.<br />
Typical grub.conf:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 178px;
		text-align: left;
		overflow: auto"># cat /boot/grub/grub.conf

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-246.el5)
        root (hd0,0)
         kernel /vmlinuz-2.6.18-246.el5 ro root=/dev/VolGroup01/Lv_root  rhgb quiet
        initrd /initrd-2.6.18-246.el5.img</pre>
</div><br />
Modified grub.conf to add additional OS in boot menu (Those marked in red are to be replaced with the actual version of the additional OS that is being installed)<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 226px;
		text-align: left;
		overflow: auto">default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-246.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-246.el5 ro root=/dev/VolGroup01/Lv_root rhgb quiet
        initrd /initrd-2.6.18-246.el5.img

title Red Hat Enterprise Linux Server 5.8 (<font color="Red">2.6.18-274.el5</font>)
        root (hd0,0)
        kernel /vmlinuz-<font color="Red">2.6.18-274.el5</font> ro root=/dev/VolGroup01/<font color="Red">Lv_root2</font> rhgb quiet
        initrd /initrd-<font color="Red">2.6.18-274.el5</font>.img</pre>
</div><br />
If required the default value can be set to 1 to boot from new OS when boot menu timeout is hit. Otherwise user can press any key during boot menu and select any OS to boot from.<br />
Depending on whether to enable or disable SELinux, the configuration has to be edited accordingly in the new OS.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto"># cd /tmp/root2/etc/selinux/
# vi config			;# Edit the config file and set SELINUX=disabled for disabling SELinux</pre>
</div>Now additional OS is installed and sitting parallel to existing OS. Reboot the system to boot on OS of your choice.<br />
<br />
<i>-	Lakshmivaragan<br />
HCL Technologies Ltd,<br />
Chennai, India<br />
lakshmivaraganm at hcl dot com</i></div>

]]></content:encoded>
			<dc:creator>iamswift</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog/iamswift-664867/rhel-%96-installing-multiple-os-versions-using-logical-volume-manager-35078/</guid>
		</item>
		<item>
			<title>RHEL – Create new logical volume from root volume</title>
			<link>http://www.linuxquestions.org/questions/blog/iamswift-664867/rhel-%96-create-new-logical-volume-from-root-volume-35077/</link>
			<pubDate>Wed, 10 Oct 2012 09:51:28 GMT</pubDate>
			<description>Introduction: 
We know that modern systems can have multiple hard disks and each hard disk can be divided as partitions. The idea behind partition is...</description>
			<content:encoded><![CDATA[<div><font size="2">Introduction:</font><br />
We know that modern systems can have multiple hard disks and each hard disk can be divided as partitions. The idea behind partition is that it gives flexibility in managing the disks. Let&#8217;s say we have multiple operating systems to be installed in the same machine, partition provides solution for this. Each partition can have its own operating system. Apart from this advantage, partitions also help in grouping the type of files that are stored.<br />
The Linux Logical Volume Manager (LVM) gives more flexibility in managing disks. In LVM, logical partitions can be spanned across different physical hard drives. The physical volumes can be combined into one big entity named &#8220;logical volume group&#8221;. Under this group we can have several logical volumes. These individual logical volumes can be considered a partition.<br />
There are tons and tons of LVM references available online.<br />
Getting around LVM:<br />
A Typical disk structure is shown below. The entire disk space is segregated into two partitions: <br />
One for boot partition and another for remaining of disk made such that to be controlled by LVM.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 162px;
		text-align: left;
		overflow: auto"># fdisk &#8211;l
Disk /dev/sda: 146.8 GB, 146810536448 bytes
255 heads, 63 sectors/track, 17848 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       17848   143259637+  8e   Linux LVM
#</pre>
</div>The &#8220;lvs&#8221; command can be used to list all the logical volumes available under LVM. We have two logical volumes: One for root (Lv_root) where OS files are available, and another logical volume for swap (Lv_swap). (The logical volume name can be any word / sequence of chars but would be reasonable to name it meaningful)<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto"># lvs
  LV           VG                 Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  Lv_root    VolGroup01  -wi-ao 128.69G
  Lv_swap  VolGroup01  -wi-ao  17.62G
#</pre>
</div>In order to make use any disk, we need to first mount it. On bootup, default file systems are mounted on specified mount point (based on /etc/fstab entires). We use &#8220;df&#8221; command to list the current mount info. For the above setup, below is the output of &#8220;df&#8221; command.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 114px;
		text-align: left;
		overflow: auto"># df -h
Filesystem            			Size  	Used 	Avail 	Use% 	Mounted on
/dev/mapper/VolGroup01-LogVol00	129G  	7G   	122G  	5% 	/
/dev/sda1              			99M   	67M   	28M  	72% 	/boot
tmpfs                 				7.8G     0  	7.8G   	0% 	/dev/shm
#</pre>
</div><br />
The Lv_root logical volume is mounted on &#8220;/&#8221;. This is root partition where OS is installed. This filesystem cannot be un-mounted because the OS that is currently using this disk. All other mount entries can be un-mounted. <br />
<b>Note:</b> The swap logical volume (Lv_swap) is not listed in &#8220;df&#8221; output. <br />
Creating new logical volume by splitting root partition:<br />
We have seen that root filesystem cannot be un-mounted as the OS is currently running and using the file system. So how do we unmount that? We need another temporary OS to which we can boot to. For temporary OS, the root partition of original OS is just another mount point. The original OS&#8217; root partition is not used by temporary OS. Once booted to temporary OS, the original root partition can be unmounted and can be split to create another new logical volume.<br />
<br />
But in the above sample setup, we just have single OS and there is no space to install temporary OS. How and where can we install temporary OS? This is where the swap logical volume tends its helping hand. The swap partition is required for applications that need heavy memory usage but for OS booting and operations, swap is not required. We can make use of the swap partition to install a temporary OS.<br />
Fortunately we have 17.62GB available in swap. For installing a minimal version of Linux (as temporary OS) we just need 3GB or max 5GB.<br />
<br />
First step is to identify which partition / logical volume is used for swap.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto"># swapon &#8211;s
Filename                                		Type            Size    	Used    Priority
/dev/mapper/VolGroup01-Lv_swap         partition       18481144        0       -1
#</pre>
</div>Next, we have to switch off the swap. Use the partition or logical volume name from above command. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># swapoff  /dev/mapper/VolGroup01-Lv_swap</pre>
</div>In case a partition (instead of logical volume) is used for swap, the same can be used as well. In the above swapoff command, instead of providing logical volume path, provide the partition used for swap. For e.g: swapoff  /dev/sda2<br />
The swap partition is of the swapfs type. We cannot install Linux in swap file system. So the swap partition needs to be formatted in ext2/ext3 format.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># mkfs &#8211;t ext3 /dev/mapper/VolGroup01-Lv_swap</pre>
</div>Once the swap partition is formatted as ext3 format, we can mount this to a dir (mount point) and can carry out the temporary OS installation.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto"># mkdir &#8211;p /tmp/tmproot/
# mount /dev/mapper/VolGroup01-Lv_swap  /tmp/tmproot/</pre>
</div>Installing temporary OS in swap logical volume (or partition) can be done in several ways. A yum local repository can be setup where the minimal version of RHEL OS rpms can be placed and installed into swap partition. Another method is to use the &#8220;rpm&#8221; command and install temporary OS in swap partition. The advantage of &#8220;yum&#8221; is that the package dependency is resolved internally and the order of installing the package is taken care by &#8220;yum&#8221;.<br />
<br />
To set local yum repository:<br />
For the baseurl attribute, provide the path where the RPMs are available.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto"># cd /etc/yum.repos.d/
# echo &#8220;[tempos]&#8221; &gt; tempos.repo		;# Create temp os repo 
# echo &#8220;name=Temp OS&#8221; &gt;&gt; tempos.repo
# echo &#8220;baseurl=file:///path/to/rpm/&#8221; &gt;&gt; tempos.repo
# echo &#8220;enabled=0&#8221; &gt;&gt; tempos.repo</pre>
</div>Once yum local repository is set, install temporary OS in the swap partition which is now mounted in /tmp/tmproot/ dir.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># yum &#8211;&#8211;installroot=/tmp/tmproot &#8211;&#8211;enablerepo=tempos  groupinstall  Base Core &#8211;y &#8211;&#8211;nogpgcheck</pre>
</div>Once the installation is done, it is necessary that few important files are copied to temporary OS installation so that when the temporary OS is booted, the parameters of original OS are available to temp OS as well.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto"># cp &#8211;p /etc/fstab  /tmp/tmproot/etc/
# cp &#8211;p /etc/passwd  /tmp/tmproot/etc/
# cp &#8211;p /etc/shadow  /tmp/tmproot/etc/
# cp &#8211;p /etc/group  /tmp/tmproot/etc/</pre>
</div>Edit the fstab to mount correct filesystems.<br />
The copied fstab should look something as below:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 162px;
		text-align: left;
		overflow: auto"># cat /tmp/tmproot/etc/fstab

/dev/VolGroup01/Lv_root 	/               ext3    defaults        1 1
LABEL=/boot             	/boot           ext3    defaults        1 2
tmpfs                   	/dev/shm        tmpfs   defaults        0 0
devpts                  	/dev/pts        devpts  gid=5,mode=620  0 0
sysfs                   	/sys            sysfs   defaults        0 0
proc                    	/proc           proc    defaults        0 0
/dev/VolGroup01/Lv_swap 	swap            swap    defaults        0 0</pre>
</div>The fstab entries are to be edited so that /dev/VolGroup01/Lv_swap logical volume is to be mounted root (/) partition. The swap partition is not required or available. Edit the /tmp/tmproot/etc/fstab as below (changes in red).<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 130px;
		text-align: left;
		overflow: auto">/dev/VolGroup01/<font color="Red">Lv_swap</font> 	/               ext3    defaults        1 1			&#61663; Edited
LABEL=/boot             	/boot           ext3    defaults        1 2
tmpfs                   	/dev/shm        tmpfs   defaults        0 0
devpts                  	/dev/pts        devpts  gid=5,mode=620  0 0
sysfs                   	/sys            sysfs   defaults        0 0
proc                    	/proc           proc    defaults        0 0
<font color="Red">#</font>/dev/VolGroup01/Lv_swap 	swap            swap    defaults        0 0			&#61663; Edited</pre>
</div>Edit the /boot/grub/grub.conf to boot from Lv_swap logical volume.<br />
Typical grub.conf:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 178px;
		text-align: left;
		overflow: auto"># cat /boot/grub/grub.conf

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-246.el5)
        root (hd0,0)
         kernel /vmlinuz-2.6.18-246.el5 ro root=/dev/VolGroup01/Lv_root  rhgb quiet
        initrd /initrd-2.6.18-246.el5.img</pre>
</div>Modified grub.conf to boot temporary OS (changes in red)<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 146px;
		text-align: left;
		overflow: auto">default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-246.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-246.el5 ro root=/dev/VolGroup01/<font color="Red">Lv_swap</font> rhgb quiet            &#61663; Edited 
        initrd /initrd-2.6.18-246.el5.img</pre>
</div>Reboot the system to boot from temporary OS.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># reboot</pre>
</div>Once booted on to temporary OS, the original root logical volume is now available for any modification.<br />
<br />
First check the original file system using fsck.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># e2fsck &#8211;f  /dev/VolGroup01/Lv_root</pre>
</div><br />
Shrink the root logical volume to desired size. From the &#8220;lvs&#8221; command run earlier, the size of the root partition is 128GB. Make be we can shrink it to half the size and make it as 64GB for original root partition and another 64GB for the new partition to be created.<br />
The resize2fs command will shrink the logical volume capacity to the size mentioned.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># resize2fs   /dev/VolGroup01/Lv_root  64G</pre>
</div><br />
The logical volume ledger too is to be updated on the reduced size of Lv_root logical volume. This is done with &#8220;lvreduce&#8221; command.<br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># lvreduce &#8211;f &#8211;L 64G /dev/VolGroup01/Lv_root</pre>
</div><br />
Now the original root logical volume is reduced in size, a new logical volume can be created with the available space freed up. The below command creates new logical volume with name &#8220;Lv_root2&#8221; under &#8220;VolGroup01&#8221; volume group. The size of new logical volume is set 64GB.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># lvcreate &#8211;L 64G &#8211;n VolGroup01 Lv_root2</pre>
</div><br />
All the disk operations on original root partition is complete. The grub.conf is now edited back to previous form so that the original OS is booted. <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 146px;
		text-align: left;
		overflow: auto">default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-246.el5)
        root (hd0,0)
         kernel /vmlinuz-2.6.18-246.el5 ro root=/dev/VolGroup01/<font color="Red">Lv_root</font>  rhgb quiet
        initrd /initrd-2.6.18-246.el5.img</pre>
</div><br />
Reboot the system to boot from original OS.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># reboot</pre>
</div>After booting to original OS, now we have an extra logical volume carved out of the root logical volume. We have installed temporary OS in the swap partition; now this is to be made swap again.<br />
<br />
Format the swap partition to swap filesystem type.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># mkswap  dev/VolGroup01/Lv_swap</pre>
</div><br />
Enable the swap.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># swapon  dev/VolGroup01/Lv_swap</pre>
</div><br />
Check out the current logical volumes available using lvs command.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 114px;
		text-align: left;
		overflow: auto"># lvs
  LV           VG                 Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  Lv_root    VolGroup01  -wi-ao  64G
  Lv_root2  VolGroup01  -wi-ao  64G					&#61663; New logical volume
  Lv_swap  VolGroup01  -wi-ao  17.62G
#</pre>
</div><i>-	Lakshmivaragan<br />
HCL Technologies Ltd,<br />
Chennai, India<br />
lakshmivaraganm at hcl dot com</i></div>

]]></content:encoded>
			<dc:creator>iamswift</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog/iamswift-664867/rhel-%96-create-new-logical-volume-from-root-volume-35077/</guid>
		</item>
		<item>
			<title>In place upgrade from RHEL 5.x to RHEL 6.x</title>
			<link>http://www.linuxquestions.org/questions/blog/iamswift-664867/in-place-upgrade-from-rhel-5-x-to-rhel-6-x-34929/</link>
			<pubDate>Fri, 17 Aug 2012 07:25:56 GMT</pubDate>
			<description>*Inplace upgrade from RHEL 5.x to RHEL 6.x 
* 
Recently I contacted RH for in-place upgrade from RHEL 5 to RHEL 6 and got the standard reply from RH...</description>
			<content:encoded><![CDATA[<div><b><font size="3"><div align="center">Inplace upgrade from RHEL 5.x to RHEL 6.x</div></font></b><br />
Recently I contacted RH for in-place upgrade from RHEL 5 to RHEL 6 and got the standard reply from RH that this kind of upgrade is not supported.<br />
I pressed for any document that gives steps carried out when the &#8220;upgradeall&#8221; option is selected while upgrading from RHEL 5 to RHEL 6 but got the same reply, saying in-place upgrade is not supported across major releases.<br />
Below is the list of steps I followed to get in-place upgrade from RHEL 5.5 to RHEL 6.2.<br />
<br />
<b>Disclaimer</b>: The packages I installed in RHEL 5.5 and RHEL 6.2 is minimal set (say some 650+ packages) and the below steps correspond to upgrade from minimal set RHEL 5.5 to RHEL 6.2. While the below steps should be sufficient to make upgraded RHEL 6.2 to up and running, there might be other rpm upgrades which might fail. The installation logs can be looked into to rectify them on case to case basis.<br />
<br />
<b><font size="3">1.	RPM magic number differs </font></b><br />
<b>Problem:</b><br />
The first and foremost hurdle is the rpm support. The magic number used in RHEL 5 is changed in RHEL 6. This means the existing rpm utility installed in RHEL 5.5 cannot be used to install any of the RHEL 6.2 package. If you try to install, following error is thrown:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto"><i>/media/Packages # rpm -U --nodeps zip-3.0-1.el6.x86_64.rpm
warning: zip-3.0-1.el6.x86_64.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID fd431d51
<font color="Red">error: unpacking of archive failed: cpio: Bad magic</font>
/media/Packages #
</i></pre>
</div><b>Solution:</b><br />
We need &#8216;rpm&#8217; and related packages of RHEL 6.2 to be installed in the RHEL 5.5 first and then use it to install all other packages of RHEL 6.2. <br />
Following are the RHEL 6.2 packages which need to be installed/copied manually in RHEL 5.5 to proceed further:<br />
&#8226;	rpm-*<br />
&#8226;	popt<br />
&#8226;	glibc-*<br />
&#8226;	libcap<br />
&#8226;	db4<br />
&#8226;	xz-libs<br />
&#8226;	lua<br />
<br />
Extract the above packages from RHEL 6.2 repository or DVD using below command:<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">mkdir rpm_6.2/
cd rpm_6.2/
rpm2cpio /path/to/&lt;pkg&gt;.rpm | cpio &#8211;idmv
tar zcvf ../rpm_for_6.2.tar.gz  *			;# Notice tar file created in parent dir</pre>
</div></i><br />
The tar ball has all the RHEL 6.2 rpms required to install the other RHEL 6.2 RPMs.<br />
<br />
Copy the created tar file in RHEL 5.5 machine and extract it from &#8220;/&#8221;.<br />
<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">cd  /
tar  xvf  /path/to/ rpm_for_6.2.tar.gz</pre>
</div></i><br />
<br />
There is one other small step required to make the rpm work. The old libpopt libraries are still referred to by the new rpm binary as the /usr/lib64 path is precedent over /lib64/ dir. The old libraries are no longer required and can just be removed.<br />
<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">cd /usr/lib64/
ls &#8211;l libpopt.so*
rm &#8211;f libpopt.so*</pre>
</div></i><br />
        Check the rpm version<br />
<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">/home # rpm &#8211;version
RPM version 4.8.0
/home #</pre>
</div></i><br />
Now we have rpm package of RHEL 6.2 in place of older 4.4.x version of rpm package of RHEL 5.5.<br />
<br />
<font size="3"><b>2.	Getting Installation order list and installing packages</b></font><br />
<br />
Traverse to dir where the RHEL 6.2 packages are available and execute below command to get the order of rpm packages<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">rpm &#8211;Uvv *.rpm 2&gt;&amp;1 | tee pkg_order.log</pre>
</div></i><br />
<br />
The command would read all the packages and provide us the order in which the packages are to be installed (In log file pkg_order.log). Extract the package names and write it in a separate file, say, order_file.txt<br />
<br />
The upgrade is triggered by installing RHEL 6.2 rpm packages one-by-one in the same order as given out by previous step.<br />
<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto">cd /path/to/rh6.2pkgs/
for Pkg in $(cat order_file.txt)
do
    rpm &#8211;Uvv  --force  --nodeps  $Pkg  2&gt;&amp;1 | tee &#8211;a install_logs.log
done</pre>
</div></i><br />
<b><font size="3">3.	Kernel upgrade and creation of initramfs</font></b><br />
<br />
<b>Problem:</b><br />
While installing kernel package, the creation of initramfs fails. The installation of kernel package itself will be successful but the scriptlet results in error and thereby failing to create the initramfs under /boot. The failure happens because of the segfault while executing /bin/mktemp.<br />
<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 290px;
		text-align: left;
		overflow: auto">+ NEWKERNARGS=
+ grep -q crashkernel
+ '[' 1 -ne 0 ']'
+ NEWKERNARGS=--kernel-args=crashkernel=auto
+ /sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update 2.6.32-220.el6.x86_64 --kernel-args=crashkernel=auto
<font color="Red">mktemp[12333]: segfault   rsp: 0000xxxxxxx xxxxxxxx x  xxxxxxxxxxxx</font>
chmod: cannot access `': No such file or directory
usage: plymouth [ --verbose | -v ] { --targetdir | -t } &lt;initrd_directory&gt;
cp: `/etc/ld.so.conf' and `/etc/ld.so.conf' are the same file
cp: `/etc/ld.so.conf.d' and `/etc/ld.so.conf.d' are the same file

gzip: stdout: No space left on device
E: dracut: creation of /boot/initramfs-2.6.32-220.el6.x86_64.img failed
<font color="Red">mkinitrd failed</font>
+ exit 1
D: (null): waitpid(8650) rc 8650 status 100 secs 127.394
warning: %posttrans(kernel-2.6.32-220.el6.x86_64) scriptlet failed, exit status 1</pre>
</div></i><br />
<br />
<b>Solution:</b><br />
Obviously something is wrong with the mktemp. The kernel that is loaded in memory is that of RHEL 5.5 (2.6.18-x) and it expects mktemp version corresponding to RHEL 5.5 whereas the currently installed mktemp is version 8.x which is installed from coreutils package of RHEL 6.2.<br />
<br />
Extract mktemp-xxx.rpm package of RHEL 5.5 to get mktemp binary. While the kernel package is upgraded, the mktemp of RHEL 5.5 should be available in /bin/ so that the mktemp does not crask and scriptlet succeeds in creating the initramfs for RHEL 6.2.<br />
<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">cd  /home/mktemp_5.5/
rpm2cpio  /path/to/mktemp-xxx.x86_64.rpm  |  cpio  -idmv
mv   /bin/mktemp   /bin/mktemp_6.2
cp &#8211;p /home/mktemp_5.5/mktemp    /bin/</pre>
</div></i><br />
Once the kernel package is installed successfully, the mktemp binaries are to be swapped back to have the correct mktemp version that corresponds to RHEL 6.2<br />
<br />
<i><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">mv  /bin/mktemp_6.2   /bin/mktemp</pre>
</div></i><br />
<br />
Once complete, reboot the system and see those beautiful messages of RHEL 6.2 scroll through screen.<br />
<br />
<i>-	Lakshmivaragan<br />
HCL Technologies Ltd,<br />
Chennai, India<br />
lakshmivaraganm at hcl dot com</i></div>

]]></content:encoded>
			<dc:creator>iamswift</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog/iamswift-664867/in-place-upgrade-from-rhel-5-x-to-rhel-6-x-34929/</guid>
		</item>
	</channel>
</rss>
