<?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>Hack Admin &#187; ubuntu</title>
	<atom:link href="http://www.hackadmin.com/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackadmin.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 21:31:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IP Failover For Web Cluster</title>
		<link>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/</link>
		<comments>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 00:38:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=258</guid>
		<description><![CDATA[keepalived provides a strong and robust health checking for LVS clusters. It nginx implements a framework of health checking on multiple layers for server failover, and VRRPv2 stack to handle director failover. How do I install and configure Keepalived for reverse proxy server such as nginx or lighttpd?]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>keepalived provides a strong and robust health checking for LVS clusters. It nginx implements a framework of health checking on multiple layers for server failover, and VRRPv2 stack to handle director failover. How do I install and configure Keepalived for reverse proxy server such as nginx or lighttpd?</p>
<p><span id="more-258"></span><br />
If your are using a LVS director to loadbalance a server pool in a production environment, you may want to have a robust solution for healthcheck &amp; failover. This will also work with reverse proxy server such as nginx.</p>
<p>lb0 &#8211; Linux box directly connected to the Internet via eth1. This is master load balancer.<br />
lb1 &#8211; Linux box directly connected to the Internet via eth1. This is backup load balancer. This will become active if master networking failed.</p>
<p>202.54.1.1 &#8211; This ip moves between lb0 and lb1 server. It is called virtual IP address and it is managed by keepalived.<br />
eth0 is connected to LAN and all other backend software such as Apache, MySQL and so on.</p>
<p><strong>You need to install the following softwares on both lb0 and lb1:<br />
</strong><br />
keepalived for IP failover.<br />
iptables to filter traffic<br />
nginx or lighttpd revers proxy server.</p>
<p><strong>DNS settings should be as follows:</strong></p>
<p><a href="http://hackadmin.in/" target="_blank">hackadmin.in</a> &#8211; Our sample domain name.<br />
<a href="http://lb0.hackadmin.in/" target="_blank">lb0.hackadmin.in</a> &#8211; 202.54.1.11 (real ip assigned to eth1)<br />
<a href="http://lb1.hackadmin.in/" target="_blank">lb1.hackadmin.in</a> &#8211; 202.54.1.12 (real ip assigned to eth1)<br />
<a href="../" target="_blank">www.hackadmin.com</a> &#8211; 202.54.1.1 (VIP for web server) do not assign this IP to any interface.</p>
<p><strong>Install Keepalived</strong></p>
<p>Visit <a href="http://keepalived.org/" target="_blank">keepalived.org</a> to grab latest source code. You can use the wget command to download the same (you need to install keepalived on both lb0 and lb1):</p>
<p># cd /opt</p>
<p># wget <a href="http://www.keepalived.org/software/keepalived-1.1.19.tar.gz" target="_blank">http://www.keepalived.org/software/keepalived-1.1.19.tar.gz</a></p>
<p>#  tar -zxvf keepalived-1.1.19.tar.gz</p>
<p># cd keepalived-1.1.19</p>
<p><strong>Install Kernel Headers</strong></p>
<p>You need to install the following packages:</p>
<p>Kernel-headers &#8211; includes the C header files that specify the interface between the Linux kernel and userspace libraries and programs. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package.<br />
kernel-devel &#8211; this package provides kernel headers and makefiles sufficient to build modules against the kernel package.</p>
<p>Make sure kernel-headers and kernel-devel packages are installed. If not type the following install the same:<br />
<strong><br />
Compile keepalived</strong></p>
<p><strong>Type the following command:</strong><br />
# ./configure &#8211;with-kernel-dir=/lib/</p>
<div id=":1j0">modules/$(uname -r)/build</p>
<p>Sample outputs:</p>
<p>checking for gcc&#8230; gcc<br />
checking for C compiler default output file name&#8230; a.out<br />
checking whether the C compiler works&#8230; yes<br />
checking whether we are cross compiling&#8230; no<br />
checking for suffix of executables&#8230;<br />
checking for suffix of object files&#8230; o<br />
&#8230;<br />
&#8230;..<br />
..<br />
config.status: creating keepalived/check/Makefile<br />
config.status: creating keepalived/libipvs-2.6/Makefile</p>
<p><strong>Keepalived configuration</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Keepalived version       : 1.1.19<br />
Compiler                 : gcc<br />
Compiler flags           : -g -O2<br />
Extra Lib                : -lpopt -lssl -lcrypto<br />
Use IPVS Framework       : Yes<br />
IPVS sync daemon support : Yes<br />
Use VRRP Framework       : Yes<br />
Use Debug flags          : No</p>
<p><strong>Compile and install the same:</strong><br />
# make &amp;&amp; make install</p>
<p><strong>Create Required Softlinks</strong></p>
<p>Type the following commands to create service and run it at RHEL / CentOS run level #3 :<br />
# cd /etc/sysconfig<br />
# ln -s /usr/local/etc/sysconfig/keepalived .<br />
# cd /etc/rc3.d/<br />
# ln -s /usr/local/etc/rc.d/init.d/keepalived S100keepalived<br />
# cd /etc/init.d/<br />
# ln -s /usr/local/etc/rc.d/init.d/keepalived .<br />
<strong><br />
Configuration</strong></p>
<p>Your main configuration directory is located at /usr/local/etc/keepalived and configuration file name is keepalived.conf. First, make backup of existing configuration:<br />
# cd /usr/local/etc/keepalived<br />
# cp keepalived.conf keepalived.conf.bak<br />
Edit keepalived.conf as follows on lb0:</p>
<p>vrrp_instance VI_1 {<br />
interface eth0<br />
state MASTER<br />
virtual_router_id 51<br />
priority 101<br />
authentication {<br />
auth_type PASS<br />
auth_pass Add-Your-Password-Here<br />
}<br />
virtual_ipaddress {<br />
<a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> dev eth1<br />
}<br />
}</p>
<p>Edit keepalived.conf as follows on lb1 (note priority set to 100 i.e. backup load balancer):</p>
<p>vrrp_instance VI_1 {<br />
interface eth0<br />
state MASTER<br />
virtual_router_id 51<br />
priority 100<br />
authentication {<br />
auth_type PASS<br />
auth_pass Add-Your-Password-Here<br />
}<br />
virtual_ipaddress {<br />
<a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> dev eth1<br />
}<br />
}</p>
<p>Save and close the file. Finally start keepalived on both lb0 and lb1 as follows:<br />
# /etc/init.d/keepalived start</p>
<p>Verify: Keepalived Working Or Not</p>
<p>/var/log/messages will keep track of VIP:<br />
# tail -f /var/log/messages<br />
Sample outputs:</p>
<p>Feb 21 04:06:15 lb0 Keepalived_vrrp: Netlink reflector reports IP 202.54.1.1 added<br />
Feb 21 04:06:20 lb0 Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for 202.54.1.1</p>
<p>Verify that VIP assigned to eth1:<br />
# ip addr show eth1<br />
<strong>Sample outputs:</strong></p>
<p>3: eth1:  mtu 1500 qdisc pfifo_fast qlen 10000<br />
link/ether 00:30:48:30:30:a3 brd ff:ff:ff:ff:ff:ff<br />
inet <a href="http://202.54.1.11/29" target="_blank">202.54.1.11/29</a> brd 202.54.1.254 scope global eth1<br />
inet <a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> scope global secondary eth1</p>
<p><strong>ping failover test</strong></p>
<p>Open UNIX / Linux / OS X desktop terminal and type the following command to ping to VIP:<br />
# ping 202.54.1.1<br />
Login to lb0 and halt the server or take down networking:<br />
# halt<br />
Within seconds VIP should move from lb0 to lb1 and you should not see any drops in ping. On lb1 you should get the following in /var/log/messages:</p>
<p>Feb 21 04:10:07 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) forcing a new MASTER election<br />
Feb 21 04:10:08 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Transition to MASTER STATE<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTER STATE<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) setting protocol VIPs.<br />
Feb 21 04:10:09 lb1 Keepalived_healthcheckers: Netlink reflector reports IP 202.54.1.1 added<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for 202.54.1.1</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>How to Recover a Lost MySQL Password</title>
		<link>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/</link>
		<comments>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 18:23:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=256</guid>
		<description><![CDATA[This article explains the process that will allow you to recover a lost MySQL password:

Stop the MySQL server process]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>This article explains the process that will allow you to recover a lost MySQL password:</p>
<p>Stop the MySQL server process</p>
<p>Start the MySQL (mysqld) server/daemon process with the<br />
&#8211;skip-grant-tables option so that it will not prompt for password.</p>
<p><span id="more-256"></span></p>
<p>Connect to mysql server as the root user.</p>
<p>Setup new mysql root account password.</p>
<p>Exit and restart the MySQL server.</p>
<p><strong>Example:</strong></p>
<p># service mysqld stop</p>
<p><strong>Output:</strong></p>
<p>Stopping MySQL database server: mysqld.</p>
<p>Then start MySql in safe mode</p>
<p># mysqld_safe &#8211;skip-grant-tables</p>
<p><strong>Output</strong></p>
<p>[1] 5988<br />
Starting mysqld daemon with databases from /var/lib/mysql</p>
<p>Then connect the mysql without any password</p>
<p># mysql -u root</p>
<p>( Then setup password )</p>
<p>mysql&gt; use mysql;</p>
<p>mysql&gt; update user set password=PASSWORD(&#8221;NEW-ROOT-PASSWORD&#8221;) where User=&#8217;root&#8217;;</p>
<div id=":1it">
<p>mysql&gt; flush privileges;</p>
<p>mysql&gt; quit</p>
<p>Then stop mysql</p>
<p># service mysql stop</p>
<p># service mysql start</p>
<p>Then Try your new password :</p>
<p># mysql -u root -p</p>
<p>Good Luck!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Port Redirection through the iptables</title>
		<link>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/</link>
		<comments>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 03:44:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=254</guid>
		<description><![CDATA[How do I redirect 80 port to 8123 using iptables?

You can easily redirect incoming traffic by inserting rules into PREROUTING chain of the nat table. You can set destination port using the REDIRECT target.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong> </strong>How do I redirect 80 port to 8123 using iptables?</p>
<p>You can easily redirect incoming traffic by inserting rules into PREROUTING chain of the nat table. You can set destination port using the REDIRECT target.</p>
<p><span id="more-254"></span><br />
<strong>Syntax<br />
</strong><br />
The syntax is as follows to redirect tcp $srcPortNumber port to $dstPortNumber:</p>
<p>iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport $srcPortNumber -j REDIRECT &#8211;to-port $dstPortNumbe</p>
<p>The syntax is as follows to redirect udp $srcPortNumber port to $dstPortNumber:</p>
<p>iptables -t nat -A PREROUTING -i eth0 -p udp &#8211;dport $srcPortNumber -j REDIRECT &#8211;to-port $dstPortNumber</p>
<p>Replace eth0 with your actual interface name. The following syntax match for source and destination ips:</p>
<p>iptables -t nat -I PREROUTING &#8211;src $SRC_IP_MASK &#8211;dst $DST_IP -p tcp &#8211;dport $portNumber -j REDIRECT &#8211;to-ports $rediectPort</p>
<p><strong>Examples:</strong></p>
<p>In The following example redirects TCP port 25 to port 2525:</p>
<p># iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport 25 -j REDIRECT &#8211;to-port 2525</p>
<p>this example all incoming traffic on port 80 redirect to port 8123</p>
<p># iptables -t nat -I PREROUTING &#8211;src 0/0 &#8211;dst 192.168.1.5 -p tcp &#8211;dport 80 -j REDIRECT &#8211;to-ports 8123</p>
<p><strong>How Do I View NAT Rules?</strong></p>
<p>Type the following command:</p>
<p># iptables -t nat -L -n -v</p>
<p><strong>How Do I Save NAT Redirect Rules?</strong></p>
<p>Type the following command:</p>
<p># iptables-save</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>Apache Modules and Their Functions</title>
		<link>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/</link>
		<comments>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 18:04:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=249</guid>
		<description><![CDATA[Apache is a powerful and widely-used World-Wide Web (Web) server. One of its strengths is that the modules that it is made of are customizable according to the user's requirements. Ashish Kumar discusses the benefits and the process of customization, along with a brief introduction to some useful modules.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong style="color: #333333;"><span style="font-size: medium;">Apache Performance Modules</span></strong><br style="color: #333333;" /><br style="color: #333333;" /><span style="color: #333333;">Apache is a powerful and widely-used World-Wide Web (Web) server. One of its strengths is that the modules that it is made of are customizable according to the user&#8217;s requirements. Ashish Kumar discusses the benefits and the process of customization, along with a brief introduction to some useful modules.</span><br style="color: #333333;" /><br style="color: #333333;" /></p>
<p><span id="more-249"></span><br />
<span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<h2 style="color: #333333;">List of Standard Modules</h2>
<p style="color: #333333;">This appendix (alphabetically) lists of all of the standard modules that are part of the current (version 1.3.x) Apache distribution. Table 1 the modules that are compiled-in by default and Table 2 lists the ones which are not.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_access</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Host based access control</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_actions</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Filetype/method-based script execution</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_alias</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Aliases and redirects</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_asis</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">The .asis file handler</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using text files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_autoindex</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Automatic directory listings</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cgi</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Invoking CGI scripts</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_dir</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic directory handling</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_env</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Passing of environments to CGI scripts</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_imap</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">The imagemap file handler</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_include</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server-parsed documents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_isapi</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Windows ISAPI extension support</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_config</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User-configurable logging</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mime</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Determining document types using file extension</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_negotiation</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Content negotiation</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_setenvif</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Set environment variables based on client information</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_status</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server status display</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_userdir</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User home directories</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_unique_id</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Generate unique request identifier for every request</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_usertrack</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User tracking using Cookies</td>
</tr>
</tbody>
</table>
<p><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<p style="color: #333333;">Table 1. Apache Standard Modules Compiled-In by Default.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_anon</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Anonymous user authentication, FTP-style</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_db</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using Berkeley DB files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_dbm</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using DBM files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cern_meta</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Support for HTTP header metafiles</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_digest</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">MD5 authentication</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_example</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Demonstrates Apache API</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_expires</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Apply Expires: headers to resources</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_headers</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Add arbitrary HTTP headers to resources</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_info</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server configuration information</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_agent</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Logging of user agents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_referer</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Logging of document references</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mime_magic</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Determining document types using &#8220;magic numbers&#8221;</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mmap_static</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Mapping files into memory for faster serving</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_proxy</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Caching proxy abilities</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_rewrite</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Powerful URI-to-filename mapping using regular expressions</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_so</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Experimental support for loading modules (DLLs on Windows) at runtime (not compiled-in the UNIX distribution)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_speling</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Automatically correct minor typos in URLs</td>
</tr>
</tbody>
</table>
<p style="color: #333333;">Table 2. Apache Standard Modules Not Compiled-In by Default.</p>
<h2 style="color: #333333;"><a style="color: #005488;" name="126daf85273bb1e9_126dacf4e92051a1_app2"></a>Appendix II : List of Nonstandard Modules</h2>
<p style="color: #333333;">This appendix is a list of some nonstandard Apache modules. The selection is biased towards modules for programming language support and Web site administration. See Table 3.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">apache_ssl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">SSL extensions for Apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_bandwidth</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Limit bandwidth based on number of connections</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cint</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embedded C/C++ interpreter module for apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Chili!ASP</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Active Server Pages module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">ColdFusion Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Interface to the ColdFusion application server (Windows NT only)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Cookie Authentication</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Fake Basic authentication using Cookies</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">dir_log_module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Implements per-directory logging</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Distributed Permanence Control Apache Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Module designed to work with RCS and CVS to encourage the permanence of document version/editions on the Web</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">FastCGI</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Keeps CGI processes alive to avoid per-hit forks</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">GIF Counter</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic GIF counter</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Hotwired Mod_include</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Hotwired extensions to mod_include</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Indexer</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Configurable directory listing module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Java Wrapper Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Enables execution of Java applications as CGI directly</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_allowdev</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Restricts access to filespace more efficiently</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_ldap</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Apache LDAP authentication module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_mysql</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mySQL authentication module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_udp</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">External authentication using UDP</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cgisock</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Socket implementation of the CGI</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_format</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Formats C, C++, and Java source code using HTML</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_gunzip</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">On-the-fly decompression of HTML documents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_hosts_access</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Allows you to use the hosts.allow and hosts.deny files to configure access to Apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_javascript</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">JavaScript module (ECMA-262)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_jserv</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Java servlet interface</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_neoinclude</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">NeoWebScript &#8211; Tcl scripting extension</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_perl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embeds Perl language interpreter and provides a Perl interface to the server API</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_ssl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Free Apache interface to SSLeay</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_weborb</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Directly invokes CORBA-objects to handle CGI requests</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_msql</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic authentication with the mSQL database</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">parselog</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Perl script to parse and store logs by server and date</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">PHP</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server-side scripting language with extensive database support</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_pyapache</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embedded Python language interpreter</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">TalentSoft WebPlus (Web+)</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Web+ (WebPlus) application development tool/database middleware. Supports Linux, Apache API, mySQL, miniSQL, PostgreSQL, etc.</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif; color: #000000;" valign="top">WebCounter</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Page counter</td>
</tr>
</tbody>
</table>
<p><br style="color: #333333;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>How to Create Connection Limits with Iptables</title>
		<link>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/</link>
		<comments>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:21:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=243</guid>
		<description><![CDATA[How do I restrict the number of connections used by a single IP address to my server for port 80 and 25 using iptables?

You need to use the connection limit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). This is useful to protect your server or vps box against flooding, spamming or content scraping.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a><br />
<span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><span style="font-size: medium;"><strong></strong></span></span></p>
<p>How do I restrict the number of connections used by a single IP address to my server for port 80 and 25 using iptables?</p>
<p>You need to use the connection limit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). This is useful to protect your server or vps box against flooding, spamming or content scraping.</p>
<p><span id="more-243"></span><br />
<strong>Syntax</strong><br />
The syntax is as follows:</p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport $port -m connlimit &#8211;connlimit-above N -j REJECT &#8211;reject-with tcp-reset</p>
<p>save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Example</strong>: Limit SSH Connections Per IP / Host</p>
<p>Only allow 3 ssh connections per client host:</p>
<p># /sbin/iptables  -A INPUT -p tcp &#8211;syn &#8211;dport 22 -m connlimit &#8211;connlimit-above 3 -j REJECT</p>
<p>save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Example</strong>: Limit HTTP Connections Per IP / Host</p>
<p>Only allow 20 http connections per IP (MaxClients is set to 60 in httpd.conf):</p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport 80 -m connlimit &#8211;connlimit-above 20 -j REJECT &#8211;reject-with tcp-reset<br />
save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Skip proxy server IP 1.2.3.4 from this kind of limitations:</strong></p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport 80 -d ! 1.2.3.4 -m connlimit-above 20 -j REJECT &#8211;reject-with tcp-reset</p>
<p>Enjoy it&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/feed/</wfw:commentRss>
		<slash:comments>62</slash:comments>
		</item>
		<item>
		<title>ISCSI Target ( Server )</title>
		<link>http://www.hackadmin.com/2010/02/16/iscsi-target-server/</link>
		<comments>http://www.hackadmin.com/2010/02/16/iscsi-target-server/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 16:12:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[iscsi]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=231</guid>
		<description><![CDATA[Article by Aashish
 


Storage resource located on an iSCSI server known as a &#8220;target&#8221;. An iSCSI target usually represents nothing but hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.

iSCSI initiator (client)

An initiator functions as an iSCSI client. An initiator typically serves the same purpose [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<div style="text-align: center;"><strong><span style="font-size: medium;"><br />
</span></strong></div>
<p>Storage resource located on an iSCSI server known as a &#8220;target&#8221;. An iSCSI target usually represents nothing but hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.</p>
<p><span id="more-231"></span><br />
<strong>iSCSI initiator (client)<br />
</strong><br />
An initiator functions as an iSCSI client. An initiator typically serves the same purpose to a computer as a SCSI bus adapter would, except that instead of physically cabling SCSI devices (like hard drives and tape changers), an iSCSI initiator sends SCSI commands over an IP network.</p>
<p><strong>Debian / Ubuntu Linux Install tgt<br />
</strong><br />
Type the following command to install Linux target framework user-space tools:</p>
<p>$ sudo apt-get install tgt</p>
<p>CentOS / RHEL / Red Hat Linux Install tgt</p>
<p>RHEL 5.2 and older version do not have tgt tools. However, RHEL 5.3 (preview version) comes with tgt tools.</p>
<p>tgtadm &#8211; Linux SCSI Target Administration Utility</p>
<p>tgtadm is used to monitor and modify everything about Linux SCSI target software: targets, volumes, etc. This tool allows a system to serve block-level SCSI storage to other systems that have a SCSI initiator. This capability is being initially deployed as a Linux iSCSI target, serving storage over a network to any iSCSI initiator.</p>
<p>Start tgtd</p>
<p>To start the tgtd, enter:</p>
<p># /usr/sbin/tgtd</p>
<p>Under RHEL 5.3 to start the tgtd service, enter:</p>
<p># /etc/init.d/tgtd start</p>
<p><strong>Define an iscsi target name<br />
</strong><br />
The following example creates a target with id 1 (the iqn is 19 iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz) and adds a 20 logical unit (backed by /dev/hdc1)with lun 1.</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode target &#8211;tid 1 -T iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz<br />
To view the current configuration, enter:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op show &#8211;mode target<br />
<strong><br />
Sample output:</strong></p>
<p>Target 1: iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz</p>
<p>System information:</p>
<p>Driver: iscsi</p>
<p>Status: running</p>
<p>I_T nexus information:</p>
<p>LUN information:</p>
<p>LUN: 0</p>
<p>Type: controller</p>
<p>SCSI ID: deadbeaf1:0</p>
<p>SCSI SN: beaf10</p>
<p>Size: 0</p>
<p>Online: No</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: No backing store</p>
<p>Account information:</p>
<p>ACL information:</p>
<p>Add a logical unit to the target (/dev/sdb1):</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode logicalunit &#8211;tid 1 &#8211;lun 1 -b /dev/sdb1</p>
<p><strong>Note:-</strong><span> </span>about home computer / test system</p>
<p>Most production boxes will only use iSCSI root with real iSCSI devices, but for testing purposes it can be quite useful to set up an iSCSI target on your image server. This is useful for testing and learning iSCSI target and iSCSI initiator at home, simply use filesystem for testing purpose. Use dd command to create diskbased filesystem:</p>
<p># dd if=/dev/zero of=/fs.iscsi.disk bs=1M count=512</p>
<p>Add /fs.iscsi.disk as a logical unit to the target:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode logicalunit &#8211;tid 1 &#8211;lun 1 -b /fs.iscsi.disk</p>
<p>Now, you should able to view details:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op show &#8211;mode target</p>
<p><strong>Sample output:<br />
</strong><br />
Target 1: iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz</p>
<p>System information:</p>
<p>Driver: iscsi</p>
<p>Status: running</p>
<p>I_T nexus information:</p>
<p>LUN information:</p>
<p>LUN: 0</p>
<p>Type: controller</p>
<p>SCSI ID: deadbeaf1:0</p>
<p>SCSI SN: beaf10</p>
<p>Size: 0</p>
<p>Online: No</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: No backing store</p>
<p>LUN: 1</p>
<p>Type: disk</p>
<p>SCSI ID: deadbeaf1:1</p>
<p>SCSI SN: beaf11</p>
<p>Size: 512M</p>
<p>Online: Yes</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: /fs.iscsi.disk</p>
<p>Account information:</p>
<p>ACL information:</p>
<p>Accept iSCSI Target</p>
<p>To enable the target to accept any initiators, enter:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op bind &#8211;mode target &#8211;tid 1 -I ALL</p>
<p>This should open network port # 3260:</p>
<p># netstat -tulpn | grep 3260</p>
<p><strong>Sample output:<br />
</strong><br />
tcp 0 0<span> </span><a style="color: #005488;" href="http://0.0.0.0:3260/" target="_blank">0.0.0.0:3260</a><span> </span>0.0.0.0:* LISTEN 27328/tgtd<br />
tcp6 0 0 :::3260 :::* LISTEN 27328/tgtd</p>
<p>And you are done. Your system is configured as iSCSI Target. Remote client computer can access this computers hard disk over network. Your can use cluster aware filesystem to setup real shared storage for small business. Open TCP port 3260 in your firewall, if required.</p>
<p><strong>For Client<br />
</strong>Install Required Package</p>
<p>iscsi-initiator-utils RPM package &#8211; The iscsi package provides the server daemon for the iSCSI protocol, as well as the utility programs used to manage it. iSCSI is a protocol for distributed disk access using SCSI commands sent over Internet Protocol networks. This package is available under Redhat Enterprise Linux / CentOS / Fedora Linux and can be installed using yum command:</p>
<p># yum install iscsi-initiator-utils</p>
<p>A note about Debian / Ubuntu Linux</p>
<p>If you are using Debian / Ubuntu Linux install open-iscsi package, enter:</p>
<p>$ sudo apt-get install open-iscsi</p>
<p>iSCSI Configuration</p>
<p>There are three steps needed to set up a system to use iSCSI storage:</p>
<p>1. iSCSI startup using the init script or manual startup. You need to edit and configure iSCSI</p>
<p>via /etc/iscsi/iscsid.conf file</p>
<p>2. Discover targets.</p>
<p>3. Automate target logins for future system reboots.</p>
<p>4. You also need to obtain iSCSI username, password and storage server IP address (target host)</p>
<p><strong>Step # 1: Configure iSCSI</strong></p>
<p>Open /etc/iscsi/iscsid.conf with vi text editor:</p>
<p># vi /etc/iscsi/iscsid.conf</p>
<p>Setup username and password:</p>
<p>node.session.auth.username = My_ISCSI_USR_NAME</p>
<p>node.session.auth.password = MyPassword</p>
<p>discovery.sendtargets.auth.username = My_ISCSI_USR_NAME</p>
<p>discovery.sendtargets.auth.password = MyPassword</p>
<p>Where,</p>
<p>* node.session.* is used to set a CHAP username and password for initiator authentication by the target(s).<br />
* discovery.sendtargets.* is used to set a discovery session CHAP username and password for the initiator authentication by the target(s)</p>
<p>You may also need to tweak and set other options. Refer to man page for more information. Now start the iscsi service:</p>
<p># /etc/init.d/iscsi start</p>
<p><strong>Step # 2: Discover targets</strong><br />
Now use iscsiadm command, which is a command-line tool allowing discovery and login to iSCSI targets, as well as access and management of the open-iscsi database. If your storage server IP address is 192.168.1.5, enter:</p>
<p># iscsiadm -m discovery -t sendtargets -p 192.168.1.5</p>
<p># /etc/init.d/iscsi restart</p>
<p>Now there should be a block device under /dev directory. To obtain new device name, type:</p>
<p># fdisk -l</p>
<p>or</p>
<p># tail -f /var/log/messages</p>
<p><strong>Output:<br />
</strong>Oct 10 12:42:20 ora9is2 kernel: Vendor: EQLOGIC Model: 100E-00 Rev: 3.2<br />
Oct 10 12:42:20 ora9is2 kernel: Type: Direct-Access ANSI SCSI revision: 05<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: unknown partition table<br />
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi disk sdd<br />
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi generic sg3 type 0<br />
Oct 10 12:42:20 ora9is2 kernel: rtc: lost some interrupts at 2048Hz.<br />
Oct 10 12:42:20 ora9is2 iscsid: connection0:0 is operational now<br />
/dev/sdd is my new block device.</p>
<p><strong>Step # 3: Format and Mount iSCSI Volume<br />
</strong><br />
You can now partition and create a filesystem on the target using usual fdisk and mkfs.ext3 commands:</p>
<p># fdisk /dev/sdd</p>
<p># mke2fs -j -m 0 -O dir_index /dev/sdd1</p>
<p><strong>OR<br />
</strong><br />
# mkfs.ext3 /dev/sdd1</p>
<p>Tip: If your volume is large size like 1TB, run mkfs.ext3 in background using nohup:</p>
<p># nohup mkfs.ext3 /dev/sdd1 &amp;</p>
<p>Mount new partition:</p>
<p># mkdir /mnt/iscsi</p>
<p># mount /dev/sdd1 /mnt/iscsi</p>
<p><strong>Step #4: Mount iSCSI drive automatically at boot time<br />
</strong><br />
First make sure iscsi service turned on at boot time:</p>
<p># chkconfig iscsi on</p>
<p>Open /etc/fstab file and append config directive:</p>
<p>/dev/sdd1 /mnt/iscsi ext3 _netdev 0 0</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/16/iscsi-target-server/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server</title>
		<link>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/</link>
		<comments>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 18:29:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[rsnapshot]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=224</guid>
		<description><![CDATA[Article by Aashish
How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server

Q. I am using an HP RAID 6 server running RHEL 5.x. I&#8217;d like this box to act as a backup server for my other Red Hat DNS and Web server. The server must keep backup in hourly, daily and monthly [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong>How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server<br />
</strong><br />
<strong>Q.</strong> I am using an HP RAID 6 server running RHEL 5.x. I&#8217;d like this box to act as a backup server for my other Red Hat DNS and Web server. The server must keep backup in hourly, daily and monthly format. How do I configure my Red Hat / CentOS Linux server as remote backup or snapshot server? </p>
<p><span id="more-224"></span><br />
<strong>A.</strong> rsnapshot is easy, reliable and a good disaster recovery backup solution. It is a remote backup program that uses rsync to take backup snapshots of your filesystems. It uses hard links to save space on disk and offers following features:</p>
<p><strong>• Filesystem snapshot</strong> &#8211; for local or remote systems.</p>
<p><strong>• Database backup</strong> &#8211; MySQL backup</p>
<p><strong>• Secure</strong> &#8211; Traffic between remote backup server is always encrypted using openssh</p>
<p><strong>• Full backup</strong> &#8211; plus incremental</p>
<p><strong>• Easy to restore</strong> &#8211; Files can restored by the users who own them, without the root user getting involved.</p>
<p><strong>• Automated backup</strong> &#8211; Runs in background via cron.</p>
<p><strong>• Bandwidth friendly</strong> &#8211; rsync used to save bandwidth </p>
<p><strong>Sample setup</strong></p>
<p>• snapshot.example.com &#8211; HP box with RAID 6 configured with Red Hat / CentOS Linux ac as backup server for other clients.</p>
<p>• DNS ns1.example.com &#8211; Red Hat server act as primary name server.</p>
<p>• DNS ns2.example.com &#8211; Red Hat server act as secondary name server.</p>
<p>• www.example.com &#8211; Red Hat running Apache web server.</p>
<p>• mysql.example.com &#8211; Red Hat mysql server.</p>
<p><strong>Install rsnapshot</strong></p>
<p>Login to snapshot.example.com. Download rsnapshot rpm file, enter: WARNING! These examples only works on Red hat / CentOS / Suse / RHEL / Fedora Linux. See Debian / Ubuntu Linux backup server instructions here.</p>
<p># cd /tmp</p>
<p># wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.0-1.noarch.rpm</p>
<p># wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.0-1.noarch.rpm.md5</p>
<p>Verify rpm file for integrity, enter</p>
<p># md5sum -c rsnapshot-1.3.0-1.noarch.rpm.md5</p>
<p><strong>Sample output:</strong><br />
rsnapshot-1.3.0-1.noarch.rpm: OK<br />
Install rsnapshot, enter:</p>
<p># rpm -ivh rsnapshot-1.3.0-1.noarch.rpm<br />
Sample output:<br />
Preparing&#8230; ########################################### [100%]<br />
1:rsnapshot ########################################### [100%]</p>
<p><strong>Configure rsnapshot</strong></p>
<p>You need to perform following steps</p>
<p>Step # 1: Configure passwordless login</p>
<p>To perform remote backup you need to setup passwordless login using openssh. Create ssh rsa key and upload them to all servers using scp (note you are overwriting ~/ssh/authorized_keys2 files).You need to type following commands on snapshot.example.com server:</p>
<p># ssh-keygen -t rsa</p>
<p># scp .ssh/id_rsa.pub root@ns1.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@ns2.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@www.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@mysql.example.com:.ssh/authorized_keys2</p>
<p>Step # 2: Configure rsnapshot</p>
<p>The default configuration file is located at /etc/rsnapshot.conf. Open configuration file using a text editor, enter:</p>
<p># vi /etc/rsnapshot.conf</p>
<p><strong>Configuration rules</strong></p>
<p>You must follow two configuration rules:</p>
<p>• rsnapshot config file requires tabs between elements.</p>
<p>• All directories require a trailing slash. For example, /home/ is correct way to specify directory, but /home is wrong.</p>
<p>First, specify root directory to store all snapshots such as /snapshots/ or /dynvol/snapshot/ as per your RAID setup, enter:</p>
<p>snapshot_root /raiddisk/snapshots/</p>
<p>You must separate snapshot_root and /raiddisk/snapshots/ by a [tab] key i.e. type snapshot_root hit [tab] key once and type /raiddisk/snapshots/.</p>
<p><strong>Define snapshot intervals</strong></p>
<p>You need to specify backup intervals i.e. specify hourly, daily, weekly and monthly intervals:</p>
<p>interval hourly 6</p>
<p>interval daily 7</p>
<p>interval weekly 4</p>
<p>interval monthly 3</p>
<p>The line &#8220;interval hourly 6&#8243; means 6 hourly backups a day. Feel free to adapt configuration as per your backup requirements and snapshot frequency.</p>
<p><strong>Remote backup directories</strong></p>
<p>To backup /var/named/ and /etc/ directory from ns1.example.com and ns2.example.com, enter:</p>
<p>backup root@ns1.example.com:/etc/ ns1.example.com/</p>
<p>backup root@ns1.example.com:/var/named/ ns1.example.com/</p>
<p>backup root@ns2.example.com:/etc/ ns2.example.com/</p>
<p>backup root@ns2.example.com:/var/named/ ns2.example.com/</p>
<p>To backup /var/www/, /var/log/httpd/ and /etc/ directory from www.example.com, enter</p>
<p>backup root@www.example.com:/var/www/ www.example.com/</p>
<p>backup root@www.example.com:/etc/ www.example.com/</p>
<p>backup root@www.example.com:/var/log/httpd/ www.example.com/</p>
<p>To backup mysql database files stored at /var/lib/mysql/, enter:</p>
<p>backup root@mysql.example.com:/var/lib/mysql/ mysql.example.com/dbdump/Save and close the file. To test your configuration, enter:</p>
<p># rsnapshot configtest</p>
<p>Sample output:</p>
<p>Syntax OK</p>
<p><strong>Schedule cron job</strong></p>
<p>Create /etc/cron.d/rsnapshot cron file. Following values used correspond to the examples in<br />
#vim /etc/rsnapshot.conf.</p>
<p>0 */4 * * * /usr/bin/rsnapshot hourly</p>
<p>50 23 * * * /usr/bin/rsnapshot daily</p>
<p>40 23 * * 6 /usr/bin/rsnapshot weekly</p>
<p>30 23 1 * * /usr/bin/rsnapshot monthly</p>
<p>Save and close the file. Now rsnapshot will work as follows to backup files from remote boxes:</p>
<p>1. 6 hourly backups a day (once every 4 hours, at 0,4,8,12,16,20)</p>
<p>2. 1 daily backup every day, at 11:50PM</p>
<p>3. 1 weekly backup every week, at 11:40PM, on Saturdays (6th day of week)</p>
<p>4. 1 monthly backup every month, at 11:30PM on the 1st day of the month<br />
<strong><br />
How do I see backups?</strong></p>
<p>To see backup change directory to</p>
<p># cd /raiddisk/snapshots/</p>
<p># ls -l</p>
<p>Sample output:<br />
drwxr-xr-x 4 root root 4096 2008-07-04 06:04 daily.0<br />
drwxr-xr-x 4 root root 4096 2008-07-03 06:04 daily.1<br />
drwxr-xr-x 4 root root 4096 2008-07-02 06:03 daily.2<br />
drwxr-xr-x 4 root root 4096 2008-07-01 06:02 daily.3<br />
drwxr-xr-x 4 root root 4096 2008-06-30 06:02 daily.4<br />
drwxr-xr-x 4 root root 4096 2008-06-29 06:05 daily.5<br />
drwxr-xr-x 4 root root 4096 2008-06-28 06:04 daily.6<br />
drwxr-xr-x 4 root root 4096 2008-07-05 18:05 hourly.0<br />
drwxr-xr-x 4 root root 4096 2008-07-05 15:06 hourly.1<br />
drwxr-xr-x 4 root root 4096 2008-07-05 12:06 hourly.2<br />
drwxr-xr-x 4 root root 4096 2008-07-05 09:05 hourly.3<br />
drwxr-xr-x 4 root root 4096 2008-07-05 06:04 hourly.4<br />
drwxr-xr-x 4 root root 4096 2008-07-05 03:04 hourly.5<br />
drwxr-xr-x 4 root root 4096 2008-07-05 00:05 hourly.6<br />
drwxr-xr-x 4 root root 4096 2008-07-04 21:05 hourly.7<br />
drwxr-xr-x 4 root root 4096 2008-06-22 06:04 weekly.0<br />
drwxr-xr-x 4 root root 4096 2008-06-15 09:05 weekly.1<br />
drwxr-xr-x 4 root root 4096 2008-06-08 06:04 weekly.2</p>
<p><strong>How do I restore backup?</strong></p>
<p>Let us say you would like to restore a backup for www.example.com. Type the command as follows (select day and date from ls -l output):</p>
<p># cd /raiddisk/snapshots/<br />
# ls -l</p>
<p># cd hourly.0/www.example.com/</p>
<p># scp -r var/www/ root@www.example.com:/var/www/</p>
<p># scp -r etc/httpd/ root@www.example.com:/etc/httpd/</p>
<p><strong>How do I exclude files from backup?</strong></p>
<p>To exclude files from backup, open rsnapshot.conf file and add following line:</p>
<p>exclude_file /etc/rsnapshot.exclude.www.example.com</p>
<p>Create /etc/rsnapshot.exclude.www.example.com as follows:</p>
<p>/var/www/tmp/</p>
<p>/var/www/*.cache</p>
<p>That&#8217;s It!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding IP Addresses to Ubuntu -via Khaled</title>
		<link>http://www.hackadmin.com/2010/02/12/adding-ip-addresses-to-ubuntu-via-medi/</link>
		<comments>http://www.hackadmin.com/2010/02/12/adding-ip-addresses-to-ubuntu-via-medi/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 17:36:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Khaled]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Virtual_Interface]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=191</guid>
		<description><![CDATA[1. Setup More than one IP address for one network interface:

The file which contains descriptions of the network interfaces on Ubuntu or debian is /etc/nework/interfaces
A network interface (material) by default is referenced by eth0 so if you have more than one it would be eth1 eth2, ]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/khaled/">Khaled</a></p>
<p>1. Setup More than one IP address for one network interface:</p>
<p>The file which contains descriptions of the network interfaces on Ubuntu or debian is /etc/nework/interfaces<br />
A network interface (material) by default is referenced by eth0 so if you have more than one it would be eth1 eth2,<br />
etc&#8230; so to setup a virtual ip we should create a virtual network interface, the name of this one would be as follows<br />
eth0:1, eth0:2 etc&#8230; to create this interface we should add some lines to the<br />
/etc/network/interfaces file to discribe this interface</p>
<p><span id="more-191"></span></p>
<p>NB: modifying this file need the superuser privilages</p>
<p>laptop:/$ sudo nano /etc/network/interfaces</p>
<p>We add this lines</p>
<p>auto eth0:1  //&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-we have one eth0 and we add another virtual interface refered by :1<br />
iface eth0:1 inet static //&#8212;&#8212;-this interface would use a static IP We can use dhcp as well<br />
address 192.168.1.34   //&#8212;&#8212;&#8212; IP we want to assign<br />
netmask 255.255.255.0  //&#8212;&#8212;&#8212; The netmask IP<br />
broadcast 192.168.1.255 //&#8212;&#8212;&#8211; Broadcast IP<br />
gateway 192.168.1.1     //&#8212;&#8212;&#8211; Gateway (router or&#8230;)</p>
<p>Save the file</p>
<p>As you can see this is a simple text file, so right now the network interface isn&#8217;t set yet because this<br />
configuration isn&#8217;t applied</p>
<p>To set it we should restart our network interface by using this command with superuser privilages:</p>
<p>laptop:/$ sudo /etc/init.d/networking restart</p>
<p>Your interface is set</p>
<p>To verify if it works you can ping the address you assigned by useing this command</p>
<p>laptop:/$ ping [IP_you_assigned]</p>
<p>_______________________________________________________________________________________</p>
<p>2. There is a second method we can use is not permanent which means if you restart your machine or your interface<br />
it would be deleted.</p>
<p>To do it we have to use the binary file /sbin/ip</p>
<p>To add a virtual IP we use this command:</p>
<p>laptop:/$ sudo /sbin/ip addr add [IP_you_want_to_add]/24 dev eth0</p>
<p>Here we don&#8217;t need to restart our network interface cause it&#8217;s not a simple file it a binary file it&#8217;s applied by<br />
this command.</p>
<p>To check that your change works you can ping the new address using this command:</p>
<p>laptop:/$ sudo ping [IP_address_you_added]</p>
<p>You can also verify the new IP has been added by using the ifconfig command as shown below:</p>
<p>laptop:/$ ifconfig eth0:1<br />
eth0:1    Link encap:Ethernet  HWaddr 00:26:b9:11:34:16<br />
          inet addr:192.168.3.22  Bcast:192.168.3.255  Mask:255.255.255.0<br />
          UP BROADCAST MULTICAST  MTU:1500  Metric:1<br />
          Interrupt:19 Base address:0xa000 </p>
<p>This will show you that the address you assigned is actually on the correct interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/12/adding-ip-addresses-to-ubuntu-via-medi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Audio Clip Editing for Dave&#8230;</title>
		<link>http://www.hackadmin.com/2009/11/28/audio-clip-editing-for-dave/</link>
		<comments>http://www.hackadmin.com/2009/11/28/audio-clip-editing-for-dave/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 14:06:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[audacity]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[podcast]]></category>
		<category><![CDATA[sound]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=160</guid>
		<description><![CDATA[A quick overview of how to create an mp3 from a podcast in Ubuntu Linux using Audacity.]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;m a fan of the Sick and Wrong Podcast.  I often enjoy spreading the word about said program as I&#8217;ve found that many of the people I interact with have a similar passion for this planet&#8217;s oddities.  Dave, however, has been especially resistant to my requests to audit this fine program.  His typical response is a cynical jab: &#8220;Do you watch Fringe&#8221;.   This makes sense because I have been opposed to spending 30 minutes of my time on this rock to view this program ( Fringe )&#8230;  Which leads me to my next point.</p>
<p>Opening a single episode and finding that you are 1.5 hours from completion can be daunting.  I&#8217;ve closed many a youtube video as soon as I realize it&#8217;s going to last more than 20 or 30 seconds.  Thus I can understand Dave&#8217;s apprehension.  It&#8217;s difficult to invest 1+ hours of your internet time in a single location.  And assuming you like it, you&#8217;re immediately 201 episodes behind.  At an average run time of 1.5 hours you&#8217;re talking 12.5 earth days of catching up.  </p>
<p>At any rate, my task today is to grab a short clip from the most recent podcast to pass along to Dave in hopes that he will climb aboard with the rest of us.  Of course, I&#8217;m a audio/video idiot which makes it a bit of a challenge.  Sure, people do this all the time, I however do not.</p>
<p>** Dave, please skip to the end of this article for your clip **</p>
<p><span id="more-160"></span><br />
I&#8217;m hoping this is really quick and solidifies my choice of linux on my Dell XPS1340 that is coming next week.  I&#8217;m running Ubuntu 9.04 and I did a quick search for: &#8220;linux edit audio file&#8221;.  That took me to a page ( the number 1 listing ) for <a href="http://audacity.sourceforge.net/">audacity</a>.  I scanned the site and realized it would do what I needed and proceeded to load it up.</p>
<p>A quick aptitude search gives the available packages:<br />
<code><br />
[7:20am] giant:/tmp# aptitude search audacity<br />
i   audacity                                                                   - A fast, cross-platform audio editor<br />
i A audacity-data                                                              - A fast, cross-platform audio editor (data)<br />
p   audacity-dbg                                                               - A fast, cross-platform audio editor (debug)<br />
[7:20am] giant:/tmp#<br />
</code><br />
then:<br />
<code><br />
[7:20am] giant:/tmp# apt-get install audacity<br />
</code><br />
To install what audacity needs to run.</p>
<p>At this point I went to Applications>Sound &#038; Video and expected to see Audacity in the list.  It was not.  So I proceeded to run it from the command line.  As root this gave me an error that Audacity could not find a place to store it&#8217;s temporary files.  So I switched back to my normal less privileged user and voila, the GUI came up.</p>
<p>Next I clicked on File>Open and browsed to the place where I saved the Sick And Wrong podcast 202 and loaded it into audacity.  The <a href="http://www.sickandwrongpodcast.com/podcasts/Sick_and_Wrong_Podcast202.mp3">full episode can be found here</a>, by the way.</p>
<p>Once it was loaded up, I clicked at the 1hr 30min point and it drew a line as a start point.  I clicked play and validated that this was in fact where I wanted to start.  I clicked around in the menus in hopes of finding something that said &#8220;clip&#8221;, that wasn&#8217;t to be found so I went back to my start point and used the tried and true method of holding down the shift key and using my right arrow.  Sure enough this started building a range on the audio graphic that was selected.</p>
<p>Once I had the area I wanted I clicked around in the menus looking for something equivalent to &#8220;crop&#8221;&#8230; again I was disappointed, so I just clicked &#8220;cut&#8221; from the edit menu.  I then clicked new, brought up a new window and clicked edit and paste.  At this point I had the abbreviated output in a new window.  It&#8217;s a miracle!  </p>
<p>The next step was to save.  If you try to &#8220;save as&#8221; it will attempt to save your work as a project.  I just wanted an mp3 so the next choice from the File menu was obviously &#8220;export&#8221;.  This prompted me for a bunch of naming crap which I don&#8217;t care about, so I just passed it by.  The next window ask where I wanted to save and the format, I chose mp3.  When I tried to save I got an error that a library was not available for the exporting of mp3 data.  It named the missing library and I used apt-get to load it up:<br />
<code><br />
[7:46am] giant:/tmp# apt-get install libmp3lame0<br />
</code><br />
I then attempted the export a second time and it completed.  </p>
<p>Here is the finished product:</p>
<p><a href="http://www.hackadmin.com/wp-content/uploads/ds.mp3">Dave Download This</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2009/11/28/audio-clip-editing-for-dave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.sickandwrongpodcast.com/podcasts/Sick_and_Wrong_Podcast202.mp3" length="49876772" type="audio/mpeg" />
<enclosure url="http://www.hackadmin.com/wp-content/uploads/ds.mp3" length="3891617" type="audio/mpeg" />
		</item>
		<item>
		<title>Disk Imaging with Partimage</title>
		<link>http://www.hackadmin.com/2009/05/31/disk-imaging-with-partimage/</link>
		<comments>http://www.hackadmin.com/2009/05/31/disk-imaging-with-partimage/#comments</comments>
		<pubDate>Sun, 31 May 2009 21:35:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Disk Imaging]]></category>
		<category><![CDATA[master boot record]]></category>
		<category><![CDATA[mbr]]></category>
		<category><![CDATA[Partimage]]></category>
		<category><![CDATA[partition table]]></category>
		<category><![CDATA[recovery cd]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Ubuntu Imaging]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/2009/05/31/disk-imaging-with-partimage/</guid>
		<description><![CDATA[I&#8217;ve been looking for an easy way to do some imaging so I can swap back to a clean Ubuntu load that has a certain amount of prep done in a relatively quick fashion.  What I think I&#8217;m going to use is partimage .    Here&#8217;s the breakdown of how I&#8217;m doing it:
I have 2 machines.  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for an easy way to do some imaging so I can swap back to a clean Ubuntu load that has a certain amount of prep done in a relatively quick fashion.  What I think I&#8217;m going to use is <a href="http://www.partimage.org">partimage</a> .    Here&#8217;s the breakdown of how I&#8217;m doing it:</p>
<p>I have 2 machines.  My main Ubuntu box which has a ton of storage on it, and a crappy old gateway thats got about a 20GB disk.</p>
<p>I do a clean load of whichever Ubuntu version I want to image on the gateway.</p>
<p>Next, I add any custom packages, network keys, etc etc, to the newly loaded box.</p>
<p><span id="more-19"></span>Once I have it like I want, I reboot the system to a recovery cd that you can download from <a href="http://www.sysresccd.org">this site</a> .  This is a good image in that it has the tools we&#8217;ll need to make partimage work.</p>
<p>On my main server I create an NFS share to /mnt/images and export it.</p>
<p>Once booted to the recovery CD, I first add an ip address to eth0</p>
<p><em>root@sysresccd: ifconfig eth0 192.168.2.2</em></p>
<p>Then I mount the share on the main box</p>
<p><em>root@sysresccd: mount -t nfs 192.168.2.1:/mnt/images /tmp/images</em></p>
<p>Once this is complete, I first take a copy of my  MBR like so:</p>
<p><em>root@sysresccd: dd if=/dev/sda of=flash-sda.mbr count=1 bs=512</em></p>
<p>Next, I make a copy of the partition table:</p>
<p><em>root@sysresccd: sfdisk -d /dev/sda &gt; flash-sda.fs</em> (Note: sfdisk is a utility that comes by default on the resource disk refereced earlier)</p>
<p>At this point, we have the data we need to recreate our master boot record as well as our existing partition tables.  We now need to get images of the data.  This is where partimage does it&#8217;s thing.  To initiate the gui for partimage simply type partimage  at the recovery CD prompt.</p>
<p><a id="file-link-20" class="file-link image" title="Partimage Main Screen" href="http://www.hackadmin.com/wp-admin/upload.php?style=inline&amp;tab=browse&amp;post_id=19&amp;_wpnonce=283515e0f5&amp;ID=20&amp;action=view&amp;paged"> </a><a title="Partimage Main Screen" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-first.png"><img title="Partimage Main Screen" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-first.png" border="0" alt="Partimage Main Screen" width="450" height="350" /></a></p>
<p>Once you&#8217;re in the GUI, you should see the slices that are available on the disk.  In my case I have 3 sda1, sda2 and sda5.  This is the default configuration of an Ubuntu 9.04 install.  I  can see from the gui, that one slice is the majority of my disk, 18.25G, and is labeled as ext3fs.  This is the slice that is holding all of the data.  The second slice is labeled extended and has no file system info, and the third slice is labeled as swap.  All I need is an image of sda1 and I&#8217;m good to go.</p>
<p>In the GUI, I need to make sure that sda1 is highlighted, then tab to the &#8220;Image file to create/use&#8221; text box.</p>
<p><a title="Partimage File Name" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-2.png"><img title="Partimage File Name" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-2.png" border="0" alt="Partimage File Name" width="450" height="350" /></a></p>
<p>In this box I will put the name of the image that I will create of sda1.  I&#8217;ll use a path to the nfs mount so the image will be saved to my secondary machine, just as my mbr and fs information was.  Then hit F5 to continue</p>
<p>On the next screen I choose a compression level of &#8220;None&#8221;, because it&#8217;s the only happening on my LAN, and it&#8217;s fast.  Then hit F5 again to continue.</p>
<p><a title="Partimage 3" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-3.png"><img title="Partimage 3" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-3.png" border="0" alt="Partimage 3" width="450" height="350" /></a></p>
<p>The app then asks for a description of the image.  Add whatever you like here.</p>
<p>Depending on the size of your slice, this next step might take some time.  Once it completes, you will have all the info necessary to do a bare metal restore of the machine.</p>
<p>To test, all you need to do is use fdisk to destroy the existing partition table.</p>
<p>From the sysresccd command prompt type in: fdisk /dev/sda  (or whatever your disk is).</p>
<p>From here, you&#8217;ll see a prompt similar to the one below:</p>
<p><a title="fdisk-1" href="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-1.png"><img title="fdisk-1" src="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-1.png" border="0" alt="fdisk-1" width="450" height="350" /></a></p>
<p>From this interface you can use the &#8220;p&#8221; command to print the existing partition table:</p>
<p><a title="Fdisk-2" href="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-2.png"><img title="Fdisk-2" src="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-2.png" border="0" alt="Fdisk-2" width="450" height="350" /></a></p>
<p>Our goal here is to make it a blank disk, clear of partition information and then write our changes.</p>
<p>Step One is to delete what is there, the following screen shot shows this process, I delete all of the primary partitions, print to verify and then write the changes with the &#8220;w&#8221; command.</p>
<p><a title="Fdisk-3" href="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-3.png"><img title="Fdisk-3" src="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-3.png" border="0" alt="Fdisk-3" width="450" height="350" /></a></p>
<p>Now we are going to use the previously created MBR and FS files to recreate the partition tables.  The following screen shot shows this process.</p>
<p>1.)  Use DD to rewrite the master boot record.</p>
<p>2.) Use sfdisk to import the partition data.</p>
<p><a title="restore-partitions.png" href="http://www.hackadmin.com/wp-content/uploads/2009/05/restore-partitions.png"><img title="restore-partitions.png" src="http://www.hackadmin.com/wp-content/uploads/2009/05/restore-partitions.png" border="0" alt="restore-partitions.png" width="450" height="429" /></a></p>
<p>At this point, you can check fdisk and see that the disk is back in the condition that it was after the Ubuntu load.</p>
<p><a title="Check Fdisk" href="http://www.hackadmin.com/wp-content/uploads/2009/05/check-fdisk.png"><img title="Check Fdisk" src="http://www.hackadmin.com/wp-content/uploads/2009/05/check-fdisk.png" border="0" alt="Check Fdisk" width="450" height="328" /></a></p>
<p>The last step here will be to reimage sda1 with the data from the partimage backup.  We&#8217;ll want to start partimage again from the recovery disk:</p>
<p>1.) Make sure your restore slice is highlighted, then tab to the file name textbox.</p>
<p>2.) Add the filename of the image that is on the NFS share.</p>
<p>3.) Make sure that you move the * to &#8220;Restore partition from an image file&#8221;.</p>
<p><a title="partimage restore 1" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-restore1.png"><img title="partimage restore 1" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-restore1.png" border="0" alt="partimage restore 1" width="450" height="350" /></a></p>
<p>Press F5 to continue.</p>
<p>In the following dialog, if you are confident in what we have done to this point, there is no need to change anything, just press F5 to continue and the image restore will begin.</p>
<p><a title="partimage restore 2" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-restore2.png"><img title="partimage restore 2" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-restore2.png" border="0" alt="partimage restore 2" width="450" height="350" /></a></p>
<p>Once the restore finishes, press enter on the &#8220;OK&#8221; and then reboot your box.  Try to hold back the excitment when it comes up exactly as you left it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2009/05/31/disk-imaging-with-partimage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

