<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>My Scripts and Tips &#187; Linux and Unix</title>
	<atom:link href="http://www.tipsandscripts.net/archives/category/linux-and-unix/feed" rel="self" type="application/rss+xml" />
	<link>http://www.tipsandscripts.net</link>
	<description>Various things I've found useful in my travels</description>
	<lastBuildDate>Mon, 09 Aug 2010 09:23:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Script to document a Red Hat Enterprise Linux 3 system</title>
		<link>http://www.tipsandscripts.net/archives/17</link>
		<comments>http://www.tipsandscripts.net/archives/17#comments</comments>
		<pubDate>Fri, 16 Nov 2007 04:43:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux and Unix]]></category>

		<guid isPermaLink="false">http://www.tipsandscripts.net/archives/17</guid>
		<description><![CDATA[This script should output html documenting the important parts of a system: sysinfo If anyone sees something I&#8217;ve left out, and I&#8217;m sure there&#8217;s a lot, please leave a comment.]]></description>
			<content:encoded><![CDATA[<p>This script should output html documenting the important parts of a system:</p>
<p><a href="http://www.tipsandscripts.net/wp-content/uploads/2007/11/sysinfo.txt" title="sysinfo">sysinfo</a></p>
<p>If anyone sees something I&#8217;ve left out, and I&#8217;m sure there&#8217;s a lot, please  leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tipsandscripts.net/archives/17/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backing Up a Linux server in the DMZ to a Windows Share</title>
		<link>http://www.tipsandscripts.net/archives/15</link>
		<comments>http://www.tipsandscripts.net/archives/15#comments</comments>
		<pubDate>Mon, 12 Nov 2007 04:22:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux and Unix]]></category>

		<guid isPermaLink="false">http://www.tipsandscripts.net/archives/15</guid>
		<description><![CDATA[This script connects to a remote Linux server and backs it up to a file share on a Windows server. Note, that because the version of smbfs used does not support files larger than 2GB the backup is split into multiple files. Later versions of smbfs don&#8217;t have this limitation. ?View Code BASH #!/bin/sh RemHost=lnx-server [...]]]></description>
			<content:encoded><![CDATA[<p>This script connects to a remote Linux server and backs it up to a file share on a Windows server. Note, that because the version of smbfs used does not support files larger than 2GB the backup is split into multiple files. Later versions of smbfs don&#8217;t have this limitation.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p15code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p152"><td class="code" id="p15code2"><pre class="bash" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;">#!/bin/sh</span>
 <span style="color: #007800;">RemHost</span>=lnx-server
 <span style="color: #007800;">TarFile</span>=<span style="color: #ff0000;">&quot;/windows-server/lnx-server-backup/lnx-server.tar.gz.&quot;</span>
 <span style="color: #666666; font-style: italic;"># Mount the drive to backup to</span>
 <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> smbfs <span style="color: #660033;">-o</span> <span style="color: #007800;">username</span>=<span style="color: #ff0000;">&quot;domain\\account&quot;</span> \
   <span style="color: #660033;">-o</span> <span style="color: #007800;">password</span>=<span style="color: #ff0000;">&quot;'password'&quot;</span> \
   <span style="color: #ff0000;">'//windows-server/lnx-server-backup$'</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lnx-server-backup
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$RemHost</span> <span style="color: #ff0000;">&quot;cd / ; tar --gzip -cf - . ; /root/logs/backup.log&quot;</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">split</span> <span style="color: #660033;">-b</span> <span style="color: #000000;">2000000000</span> - <span style="color: #007800;">$TarFile</span>
 <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">10</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lnx-server-backup</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tipsandscripts.net/archives/15/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script to send alerts if disk usage too high</title>
		<link>http://www.tipsandscripts.net/archives/14</link>
		<comments>http://www.tipsandscripts.net/archives/14#comments</comments>
		<pubDate>Mon, 12 Nov 2007 02:40:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux and Unix]]></category>

		<guid isPermaLink="false">http://www.tipsandscripts.net/archives/14</guid>
		<description><![CDATA[The following script will monitor file system usage and, if it goes above certain thresholds, send an email alert. Note that it will only send an alert once per threshold unless usage drops back below the threshold. This means that you won&#8217;t get bombarded with emails. The script sends an email to the alias diskusage. [...]]]></description>
			<content:encoded><![CDATA[<p>The following script will monitor file system usage and, if it goes above certain thresholds, send an email alert. Note that it will only send an alert once per threshold unless usage drops back below the threshold. This means that you won&#8217;t get bombarded with emails.</p>
<p>The script sends an email to the alias diskusage.  You can easily change that to an actual email address if you like.</p>
<p>Limitations of the script (minus indents which seem to have been lost by the editor):</p>
<ul>
<li>It only checks usage for ext3 file systems, but that&#8217;s easy to change</li>
<li>At the moment the script uses the same thresholds for all file systems &#8211; maybe I&#8217;ll change that in a future version</li>
</ul>
<p>Anyway, here&#8217;s the script:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.tipsandscripts.net/wp-content/plugins/wp-codebox/wp-codebox.php?p=14&amp;download=monitor-disk-usage.sh">monitor-disk-usage.sh</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p144"><td class="code" id="p14code4"><pre class="text" style="font-family:monospace;">#!/bin/sh
#
# Check disk usage and if over specified thresholds send an email
#
# Author: Me
# Date: 20071105
#
&nbsp;
while true
do
  df -t ext3
  sleep 60
done | awk '
function SendEmail(HostName, FileSystem, PercentUsed)
{
  Message=&quot;File system &quot; FileSystem &quot; on &quot; HostName
  Message=Message &quot; is &quot; PercentUsed &quot;% full&quot;
  Subject=&quot;Low Disk Space Alert for &quot; HostName
  SysCommand=&quot;echo &quot; Message &quot;| mail -s \&quot;&quot; Subject
  SysCommand=SysCommand &quot;\&quot; diskusage&quot;
  # Send the email and return the status of the system call
  return system(SysCommand)
}
&nbsp;
function CheckUsage(FileSystem,PercentUsed,Threshold)
{
  OverThreshold=&quot;no&quot;
  if ( PercentUsed &amp;gt; Threshold ) {
    OverThreshold=&quot;yes&quot;
    if ( FirstTime[FileSystem,Threshold] == &quot;no&quot; )
      next
    else {
      if ( ! SendEmail(HostName, FileSystem, PercentUsed) ) {
        # If we had no errors sending the email then dont send
        # any more alerts
        print &quot;yes&quot;
        FirstTime[FileSystem,Threshold]=&quot;no&quot;
      }
    }
  } else {
    # Make sure we toggle to send alerts in future
    FirstTime[FileSystem,Threshold]=&quot;yes&quot;
  }
  # If we are over the threshold return &quot;yes&quot;
  return OverThreshold
}
/^\// {
  FileSystem=$6
  # Remove the % sign and convert to numeric
  PercentUsed=substr($5,1,length($5)-1) * 1
  # Check if over the threshold. Check the highest
  # threshold first, there is no point in checking the
  # lower threshold if the the higher one is exceeded
  if (CheckUsage(FileSystem,PercentUsed,99)==&quot;no&quot;)
    if (CheckUsage(FileSystem,PercentUsed,95)==&quot;no&quot;)
      CheckUsage(FileSystem,PercentUsed,90)
} ' HostName=$HOSTNAME</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tipsandscripts.net/archives/14/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recovering a Linux System using CommVault</title>
		<link>http://www.tipsandscripts.net/archives/13</link>
		<comments>http://www.tipsandscripts.net/archives/13#comments</comments>
		<pubDate>Fri, 09 Nov 2007 08:29:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CommVault]]></category>
		<category><![CDATA[Linux and Unix]]></category>

		<guid isPermaLink="false">http://www.tipsandscripts.net/archives/13</guid>
		<description><![CDATA[Scope Linux is not Windows. You should not need to reinstall the operating system to restore it. This document describes a way to boot a Linux system from the Red Hat install CD so it can then be restored from a CommVault backup. It does not document how to do the actual restore within CommVault. [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><strong><span lang="EN-AU">Scope<o:p></o:p></span></strong></p>
<p class="MsoNormal"><span lang="EN-AU">Linux is not Windows. You should not need to reinstall the operating system to restore it. This document describes a way to boot a Linux system from the Red Hat install CD so it can then be restored from a CommVault backup.<span>  </span>It does not document how to do the actual restore within CommVault. It was tested on a system running Red Hat Enterprise Linux AS 3 Update 9 and CommVault 7 with Service Pack 1.</span></p>
<p class="MsoNormal"><span lang="EN-AU">This document only examines how to recover the operating system residing on local disks. It does not consider devices that might need additional kernel modules to be loaded. Nor does it consider external file systems such as those mounted via NFS or from a SAN. However, in the latter case that should not be an obstacle â€“ it should be possible to restore the OS and then, using that, restore everything else.</span></p>
<p class="MsoNormal"><strong><span lang="EN-AU">Assumptions<o:p></o:p></span></strong></p>
<ul>
<li>The system to be restored is completely gone â€“ itâ€™s OK to overwrite the old disks</li>
<li>The hardware is identical</li>
<li>The server is using Grub</li>
<li>The local disks can be accessed using a Red Hat install CD without additional kernel modules being needed</li>
</ul>
<p><span></span></p>
<p class="MsoNormal"><strong><span lang="EN-AU">Prerequisites<o:p></o:p></span></strong></p>
<p class="MsoNormal">You need the following:</p>
<ul>
<li>Details of all partitions, volume groups, logical volumes and file systems. Also keep a copy of /etc/fstab
<ul>
<li>Use the commands:
<ul>
<li>fdisk â€“l /dev/sda</li>
<li>vgdisplay â€“v</li>
<li>pvdisplay /dev/sda5</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li> Network details including hostname, IP addresses, default gateway, contents of /etc/hosts and /etc/resolv.conf.
<ul>
<li>Use the commands:
<ul>
<li>ifconfig â€“a</li>
<li>cat /etc/hosts</li>
<li>cat /etc/resolv.conf</li>
<li>netstat â€“rn</li>
<li>hostname</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li>A backup of the CommVault client
<ul>
<li>I included the following in my backup of the CommVault client:
<ul>
<li>/etc/CommVaultRegistry</li>
<li>/etc/rc.d/rc3.d/S99Galaxy</li>
<li>/etc/rc.d/rc3.d/K99Galaxy</li>
<li>/var/log/galaxy</li>
<li>/opt/galaxy</li>
</ul>
</li>
<li>If you donâ€™t have a copy of the client but itâ€™s backed up in CommVault try restoring it to a different location and then copying it across.</li>
<li>I was unable to install the CommVault client on to a machine that booted from the Red Hat CD. If you donâ€™t have a backup of the client then youâ€™re on your own.</li>
</ul>
</li>
</ul>
<ul>
<li>A copy of awk</li>
<li>Somewhere on the local server to copy the CommVault client to. I normally set up a separate /tmp file system. So, in the example below I used that space for the CommVault client. Iâ€™m sure you could use NFS or smbmount to mount a remote file system as an alternative. Another option might be to use the partition reserved for swap. Initially set it up with ext3. Once the restore is completed unmount it and convert it to swap.</li>
<li>And of course a CommVault backup of the server</li>
</ul>
<p><strong><span lang="EN-AU">Recovering the System<o:p></o:p></span></strong></p>
<p class="MsoNormal"><span lang="EN-AU">Boot up off the Red Hat install CD</span></p>
<p class="MsoNormal"><span lang="EN-AU">At the â€œboot:â€ prompt type:</span></p>
<p><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;linux rescue</pre></p>
<p class="MsoNormal"><span lang="EN-AU">When prompted select the language to use and then the keyboard type. </span></p>
<p class="MsoNormal"><span lang="EN-AU">Select â€œYesâ€ to start the network interfaces on the system.</span></p>
<p class="MsoNormal"><span lang="EN-AU">Enter the network configuration recorded above.</span></p>
<p class="MsoNormal"><span lang="EN-AU">Skip searching for and mounting the file systems.</span></p>
<p class="MsoNormal">Configure the remaining network settings that will be needed:</p>
<ul>
<li>Set the hostname using the hostname command. For example:</li>
</ul>
<p><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hostname srvlnx05</pre></p>
<ul>
<li>Put the correct entries in /etc/hosts. For example:</li>
</ul>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;127.0.0.1&nbsp;&nbsp; localhost localhost.localdomain
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;192.168.1.5 srvlnx05.mycompany.com srvlnx05</pre></pre></p>
<ul>
<li>Put the DNS search path on /etc/resolv.conf. For example:</li>
</ul>
<p><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;search mycompany.com</pre></p>
<ul>
<li>Set any required routes</li>
</ul>
<p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">At the command prompt recreate the partitions using the information recorded above.</span></p>
<p class="MsoNormal"><span lang="EN-AU">Recreate any logical volumes. First do a vgscan, then create the physical volume, then the logical volumes. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vgscan
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pvcreate /dev/sda5
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vgcreate LocalVG /dev/sda5
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lvcreate â€“l 64 --name tmpLV LocalVG
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lvcreate -l 32 --name varLV LocalVG
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lvcreate -l 14 --name testLV LocalVG</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-AU">Once the partitions are created, recreate the file systems. Note that if labels were used in /etc/fstab you will need to create the file systems with the appropriate labels.</span></p>
<p class="MsoNormal"><span lang="EN-AU">For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkfs.ext3 â€“L /boot /dev/sda1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkfs.ext3 â€“L / /dev/sda2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkfs.ext3 /dev/LocalVG/tmpLV
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkfs.ext3 /dev/LocalVG/varLV
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkfs.ext3 /dev/LocalVG/testLV</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">Format any swap partitions. For example:</span></p>
<p><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkswap /dev/sda3</pre></p>
<p class="MsoNormal"><span lang="EN-AU">In the example below I will be using the file system reserved for /tmp to store the CommVault client. As an alternative you could use space reserved for swap. Just convert it to a partition type of 83 and add a file system to it.</span></p>
<p class="MsoNormal"><span lang="EN-AU">Mount the file system. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir /tmp/cv-client
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mount /dev/LocalVG/tmpLV /tmp/cv-client</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">Copy the CommVault client. I had a tar archive on another server. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cd /tmp/cv-client
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ssh user@srvlnx02 â€œcat commvault.tar.gzâ€ | tar -zxf -</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">Create symbolic links so that the CommVault client will be accessible from the correct paths. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ln -s /tmp/cv-client/opt /opt
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ln -s /tmp/cv-client/etc/rc.d /etc/rc.d
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ln -s /tmp/cv-client/etc/CommVaultRegistry /etc/CommVaultRegistry
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ln -s /tmp/cv-client/var/log /var/log/</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">The CommVault start up script needs awk. Copy awk to /bin. For example:</span></p>
<p><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scp user@srvlnx02:/bin/awk /bin/.</pre></p>
<p class="MsoNormal"><span lang="EN-AU">Start CommVault. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cd /
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/etc/rc.d/rc3.d/S99Galaxy start</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">Mount the file systems. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir/tmp/cv-restore/
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mount /dev/sda2 /tmp/cv-restore
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir /tmp/cv-restore/boot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mount /dev/sda1 /tmp/cv-restore/boot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir /tmp/cv-restore/var
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mount /dev/LocalVG/varLV /tmp/cv-restore/var
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir /tmp/cv-restore/test
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mount /dev/LocalVG/testLV /tmp/cv-restore/test</pre></pre></p>
<p class="MsoNormal">Restore the files using the CommVault management server. Specify the alternate location that you have mounted the file systems on (e.g. /tmp/cv-restore). You might want to exclude from the restore the following:</p>
<ul>
<li>If youâ€™re using a file system on the local disk to temporarily hold the CommVault client you might want to exclude it. In the example Iâ€™m using that would be /tmp.</li>
<li>Any file systems that you need to load kernel modules to access. For example, if you have file systems residing on SAN you might want to exclude them from the restore. Once you have the system up you can then restore them if need be.</li>
</ul>
<p><span lang="EN-AU">Once the restore has finished we need to make the system bootable. On my test system Iâ€™m using Grub. I used <a href="http://www.whoopis.com/howtos/howto_restore_mbr_grub.php">http://www.whoopis.com/howtos/howto_restore_mbr_grub.php</a> to guide me in this. I did a chroot to the root of the local disk before doing this step. You need to determine the root device. I looked in the restored grub.conf (boot/grub/grub.conf) for this information. In my case it was (hd0,0). Next run grub, specify the root device and then setup. For example:</span><br />
<pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chroot /tmp/cv-restore
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grub
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;root (hd0,0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setup (hd0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quit
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">You will also need to make sure thereâ€™s a /proc file system on the local disk â€“ the system wonâ€™t boot correctly without it. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir /tmp/cv-restore/proc
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chmod 555 /tmp/cv-restore/proc</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">Stop the CommVault client. For example:</span></p>
<p><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/etc/rc.d/rc3.d/K99Galaxy stop</pre></p>
<p class="MsoNormal"><span lang="EN-AU">Unmount the file systems. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cd /
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;umount /tmp/cv-restore/boot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;umount /tmp/cv-restore/var
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;umount /tmp/cv-restore/test
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;umount /tmp/cv-restore</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">Unmount the file system that held the CommVault client:</span></p>
<p><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;umount /tmp/cv-client</pre></p>
<p class="MsoNormal"><span lang="EN-AU">If you used a swap partition for your temporary file system then convert it to swap and format it. For example:</span></p>
<p><pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sfdisk â€“change-id /dev/sda 3 82
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkswap /dev/sda3</pre></pre></p>
<p class="MsoNormal"><span lang="EN-AU">Restart the server. </span></p>
<p class="MsoNormal">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tipsandscripts.net/archives/13/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copying a directory tree in Unix or Linux</title>
		<link>http://www.tipsandscripts.net/archives/6</link>
		<comments>http://www.tipsandscripts.net/archives/6#comments</comments>
		<pubDate>Sat, 01 Sep 2007 15:29:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux and Unix]]></category>

		<guid isPermaLink="false">http://www.tipsandscripts.net/archives/6</guid>
		<description><![CDATA[cd to the parent of the source directoryUse the following command: tar -cf - sourcedir &#124; &#34;cd destdirparent &#38;&#38; tar -xf -&#34; where: sourcedir is the directory to copy destdirparent is the parent directory to copy the directory to The -f - option tells tar to write the archive to stdout or read the archive [...]]]></description>
			<content:encoded><![CDATA[<p>cd to the parent of the source directoryUse the following command:<br />
<pre><pre>
tar -cf - sourcedir | &quot;cd destdirparent &amp;&amp; tar -xf -&quot;</pre></pre><br />
where:<br />
<em>sourcedir</em> is the directory to copy<br />
<em>destdirparent</em> is the parent directory to copy the directory to</p>
<p>The<span style="font-family: courier new; font-size: 85%"> -f -</span> option tells tar to write the archive to stdout or read the archive from stdin as the case may be.</p>
<p>Placing the command after the pipe in quotes causes it to run in a subshell. This means that the two halves to the command can operate in different directories. The &amp;&amp; means that if the cd command fails the tar won&#8217;t run either.</p>
<p>For example:<br />
<pre><pre>
cd /home/fred
tar -cf - Maildir | &quot;cd /d02/backup/fred &amp;&amp; tar -xf -&quot;</pre></pre><br />
Note also that the source directory could be the current directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tipsandscripts.net/archives/6/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using ssh to copy a directory tree from one host to another</title>
		<link>http://www.tipsandscripts.net/archives/5</link>
		<comments>http://www.tipsandscripts.net/archives/5#comments</comments>
		<pubDate>Sat, 01 Sep 2007 15:27:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux and Unix]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://www.tipsandscripts.net/archives/5</guid>
		<description><![CDATA[From the source host:cd to the parent directory Use the following command: tar cf - sourcedir &#124; ssh username@destination &#34;cd destdirparent &#38;&#38; tar xf -&#34; where: sourcedir is the directory to copy username is your username on the remote (destination) host destdirparent is the parent directory on the remote (destination) host]]></description>
			<content:encoded><![CDATA[<p>From the source host:cd to the parent directory<br />
Use the following command:<br />
<pre><pre>
tar cf - sourcedir | ssh username@destination &quot;cd destdirparent &amp;&amp; tar xf -&quot;</pre></pre><br />
where:<br />
<em>sourcedir</em> is the directory to copy<br />
<em>username</em> is your username on the remote (destination) host<br />
<em>destdirparent</em> is the parent directory on the remote (destination) host</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tipsandscripts.net/archives/5/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
