<?xml version="1.0" encoding="ISO-8859-15"?>
<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>etd's Dos and Dont's &#187; Hardware</title>
	<atom:link href="http://weblog.nomejortu.com/category/hardware/feed" rel="self" type="application/rss+xml" />
	<link>http://weblog.nomejortu.com</link>
	<description>specialization is for insects</description>
	<lastBuildDate>Sun, 20 Jul 2008 21:45:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>howto resize an ext3 partition without losing data</title>
		<link>http://weblog.nomejortu.com/hardware/howto-resize-an-ext3-partition-without-losing-data</link>
		<comments>http://weblog.nomejortu.com/hardware/howto-resize-an-ext3-partition-without-losing-data#comments</comments>
		<pubDate>Thu, 13 Dec 2007 22:47:05 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=39</guid>
		<description><![CDATA[This has not been the first time I have tried, but it has been the first time it has worked. And the best of it, no Partition Magic or (qt)parted is needed, just pure old tune2fs, resize2fs and fdisk (read the man pages and backup everything as usual   ).

In order to resize it, [...]]]></description>
			<content:encoded><![CDATA[<p>This has not been the first time I have tried, but it has been the first time it has worked. And the best of it, no Partition Magic or (qt)parted is needed, just pure old <code>tune2fs</code>, <code>resize2fs</code> and <code>fdisk</code> (read the man pages and backup everything as usual <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_rolleyes.gif' alt=':roll:' class='wp-smiley' />  ).<br />
<span id="more-39"></span><br />
In order to resize it, the partition should not be mounted. You should read the full post before start issuing any commands.</p>
<p>As an example we are going to resize <code>/dev/sda1</code> from 200G to 50G. Since the partition is the primary /root we need to use a rescue disk to boot the system, I used <a href="http://www.remote-exploit.org/backtrack.html">BackTrack</a> from a USB stick (<a href="http://backtrack.offensive-security.com/index.php/Howto:USB_Stick">Howto:USB Stick</a>).</p>
<ol>
<li>use <code>tune2fs</code> to remove the journal from your ext3 partition:
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>tune2fs -O ^has_journal /dev/sda1</pre></div></div>
<p> Now the partition is effectively an ext2 file system.</li>
<li>use &#8220;<code>resize2fs /dev/sda1 50G</code>&#8221; to resize the file system.</li>
<li>use fdisk to resize the partition: delete the old partition (no data will be lost! <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_twisted.gif' alt=':twisted:' class='wp-smiley' /> ). Create a new one of the desired size (exercise caution <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_exclaim.gif' alt=':!:' class='wp-smiley' />   see below). Save changes.</li>
<li>use &#8220;<code>resize2fs /dev/sda1</code>&#8221; (no size this time) to resize the file system to the maximum available.</li>
<li>use <code>tune2fs</code> to add the journal agai:
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>tune2fs -j /dev/sda1</pre></div></div>
<p>  This turns the partition back to ext3.</li>
</ol>
<p>Regarding the new size for the partition, it is important to allocate enough physical space to support the file system. I used the formula recommended by <a href="#2">[2]</a>:</p>
<blockquote><p>
We multiply the amount of blocks from the resize2fs output (1536000) by the size of a block (4k), and to go sure the partition is big enough, we add 3 to 5% to it (3% was enough for me, but if you want to go sure take 5%):</p>
<p>1536000 * 4k * 1.03 = 6328320k
</p></blockquote>
<p>The interesting number is the first one, and you can get it by looking at the output of <code>resize2fs</code> on step 2. You just need to specify that number when asked by <code>fdisk</code> (step 3) for the last cylinder of the new partition. Again from the same reference:</p>
<blockquote><p>
Last cylinder or +size or +sizeM or +sizeK (1-1247, default 1247): +6328320K
</p></blockquote>
<p>Note that this is not the vaule I used (I forgot to write it down), but I guess that this number depends on the hardware and the important bit is to learn how to apply <a href="http://www.imdb.com/title/tt0137523/quotes#qt0190452">The Formula</a>.</p>
<h3>References</h3>
<p>This post consists of 100% recycled  information, credit goes to:</p>
<ul>
<li>[1] <a href="http://www.linuxquestions.org/questions/linux-newbie-8/another-resize-ext3-problem-123378/">Another resize ext3 problem</a></li>
<li><a name="2"></a>[2] <a href="http://www.howtoforge.com/linux_resizing_ext3_partitions">How To Resize ext3 Partitions Without Losing Data</a></li>
</ul>
<h3>Last minute note</h3>
<blockquote><p>Support for ext3 was added to resize2fs in version 1.19, more than 7 years ago.  There is no reason to convert to ext2 first unless you are running a REALLY old system.</p></blockquote>
<p>So you may avoid steps 1 and 5 if your <code>resize2fs</code> supports ext3. <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=39&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/hardware/howto-resize-an-ext3-partition-without-losing-data/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mge ellipse 1200 ups. nut how-to</title>
		<link>http://weblog.nomejortu.com/shell-script/mge-ellipse-1200-ups-nut-how-to</link>
		<comments>http://weblog.nomejortu.com/shell-script/mge-ellipse-1200-ups-nut-how-to#comments</comments>
		<pubDate>Tue, 22 Nov 2005 21:37:44 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Shell Script]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=7</guid>
		<description><![CDATA[Finally I have bought an UPS. Its the MGE Pulsar Ellipse 1200. I have chosen MGE because of their support to the open source community (mge opensource). You can connect up to four standard computers to this UPS, it&#8217;s perfect for my home network.

What I want to do is to be able to shut down [...]]]></description>
			<content:encoded><![CDATA[<p>Finally I have bought an UPS. Its the <a href="http://www.mgeups.com/products/pdt230/smallups/ellipse/ellipse.htm">MGE Pulsar Ellipse 1200</a>. I have chosen MGE because of their support to the open source community (<a href="http://opensource.mgeups.com/">mge opensource</a>). You can connect up to four standard computers to this UPS, it&#8217;s perfect for my home network.</p>
<p><img src="http://weblog.nomejortu.com/data/img/ellipse.jpg" alt="MGE Ellipse UPS" /></p>
<p>What I want to do is to be able to shut down my computers when de charge of the UPS is below a certain level. So I have spent some time this afternoon configuring <a href="http://www.networkupstools.org/">nut</a> (<em>network UPS tools</em>).<br />
<span id="more-7"></span></p>
<p>From their website:</p>
<blockquote><p>
The primary goal of the Network UPS Tools (NUT) project is to provide reliable monitoring of UPS hardware and ensure safe shutdowns of the systems which are connected.
</p></blockquote>
<p>So it&#8217;s perfect for our purposes. It hasn&#8217;t be the first time that I have tried to configure nut, but It has been the one that I have finally managed to do it. It was as easy as finding <a href="http://opensource.mgeups.com/howto.htm">mge and nut how-to</a>.</p>
<p>In this first article I am going to explain how to configure nut to detect your pulsar ellipse ups. maybe someday I will explain how to set up the safe shutdown proccess.</p>
<p>The steps to make nut work are as follows:</p>
<ol>
<li>identify the NUT driver needed: go to <a href="http://opensource.mgeups.com/ups.htm">supported upss</a> and find what driver you should use for your ups. <strong>newhidups</strong> does the job for my <em>ellipse 1200</em></li>
<li>install NUT packages: <code>apt-get install nut-usb usbutils</code>. Once dependencies are resolved you end up installing also <code>nut</code> and <code>hotplug</code> packages.</li>
<li>configure NUT: see below.</li>
<li>test your configuration: issue <code>upsc ellipse@localhost</code> if no error message is returned, you are done.</li>
</ol>
<p>You have to do a few tricks in order to set up the configuration files of nut. Create a copy of the configuration files from the <em>examples</em> dir: <code> cp /usr/share/doc/nut/examples/* /etc/nut</code>.</p>
<p>Then modify <code>/etc/default/nut</code> to look like this:</p>
<div class="hl-surround" ><div class="hl-main"><pre># start upsd
START_UPSD=yes

# start upsmon
START_UPSMON=yes</pre></div></div>
<p>You have to configure <code>/etc/nut/ups.conf</code>, adding something like this:</p>
<div class="hl-surround" ><div class="hl-main"><pre>[ellipse]
        driver = newhidups
        port = auto</pre></div></div>
<p>Nothing to be done with <code>/etc/nut/upsd.conf</code>.</p>
<p>Add the following lines to <code>/etc/nut/upsd.users</code> file:</p>
<div class="hl-surround" ><div class="hl-main"><pre># Supervision user
[admin]
        password = mypass
        allowfrom = localhost
        actions = SET
        instcmds = ALL

# Protection user
        [monuser]
        password  = mypass
        allowfrom = localhost
        upsmon master</pre></div></div>
<p>Reload the diferent services: <code>invoke-rc.d hotplug restart</code> and <code>invoke-rc.d nut restart</code></p>
<p>Please take care to change the passwords given here because of obvious security reasons.</p>
<p>And as usual, don&#8217;t forget to google on it, browse through <strong>man</strong>, and read the <a href="http://opensource.mgeups.com/howto.htm">official how-to</a>.</p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=7&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/shell-script/mge-ellipse-1200-ups-nut-how-to/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>install auditor in your hard drive</title>
		<link>http://weblog.nomejortu.com/hardware/install-auditor-in-your-hard-drive</link>
		<comments>http://weblog.nomejortu.com/hardware/install-auditor-in-your-hard-drive#comments</comments>
		<pubDate>Thu, 22 Sep 2005 10:02:31 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.nomejortu.com/weblog/?p=3</guid>
		<description><![CDATA[Auditor is a knoppix-based linux distribution full of network auditing tools. The main drawback is that it is unable to boot from a firewire cd-rom, so if you have one, you need to install Auditor on your hard drive.
You need some tricks to make it work.

You have to create an empty partition of 700 Mb [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://new.remote-exploit.org/index.php/Auditor_main">Auditor</a> is a knoppix-based linux distribution full of network auditing tools. The main drawback is that it is unable to boot from a firewire cd-rom, so if you have one, you need to install Auditor on your hard drive.</p>
<p>You need some tricks to make it work.<br />
<span id="more-3"></span><br />
You have to create an empty partition of 700 Mb (using repartitioning tools such as <a href="http://qtparted.sourceforge.net/">gqparted</a> or the no-gpl <a href="http://www.powerquest.com/partitionmagic/">Partition Magic</a>). </p>
<p>Boot your linux, then format the new partition (<em>/dev/hda6</em> in my case) using <emph>mkfs.ext2</emph> program:<br />
<code>mkfs.ext2 /dev/hda6</code></p>
<p>Here is how my drive looks:<br />
<a href="http://weblog.nomejortu.com/data/img/snap_hdd2.png"><img src="http://weblog.nomejortu.com/data/img/snap_hdd1.png" alt="My hard drive partition table (qtparted)" /></a></p>
<p>Mount it where you want, for example in <em>/mnt/</em>. Once you have it, let&#8217;s copy the contents of the Auditor&#8217;s iso image to that partition.</p>
<p>First of all get an <a href="http://new.remote-exploit.org/index.php/Auditor_mirrors">iso image</a> from Auditor&#8217;s website. Once you have it you need to mount it in your current linux filesystem, for example in <em>/cdrom/</em> usign (as root) the following line:</p>
<p><code>mount -o loop /tmp/auditor-200605-02-no-ipw2100.iso /cdrom</code></p>
<p>NOTE: for mounting .iso files you have to had some features compiled in your kernel. These include:</p>
<div class="hl-surround" ><div class="hl-main"><pre>#kernel options for .iso file mounting
Block Devices-&gt;Loopback device support
Filesystems-&gt;CD-ROM/DVD Filesystems-&gt; ISO 9660 CDROM file system support</pre></div></div>
<p>To copy the contents of the .iso file to the newly created partition use:</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>cp -a /cdrom/* /mnt/</pre></div></div>
<p>To make it clear: now you have a partition in your hard drive that contains just the same files and folders of the Auditor&#8217;s cd-rom. Let&#8217;s boot from this partition. As boot manager I use <emph>grub</emph> so here is my customization of the <a href="http://weblog.nomejortu.com/data/files/menu.lst">menu.lst</a> file:</p>
<div class="hl-surround" ><div class="hl-main"><pre># For booting the Auditor distro from /dev/hda6
title  GNU/Linux - auditor
kernel (hd0,5)/isolinux/vmlinuz root=/dev/hda6 ramdisk_size=100000 init=/etc/init lang=es splash psmouse.proto=imps dma nodhcp noapm noagp screen=1024x768 vga=791 nowheelmouse nomce  quiet BOOT_IMAGE=/KNOPPIX/KNOPPIX fromhd=/dev/hda6
initrd=(hd0,5)/isolinux/miniroot.gz</pre></div></div>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=3&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/hardware/install-auditor-in-your-hard-drive/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
