<?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>apocryph.org &#187; growfs</title>
	<atom:link href="http://apocryph.org/tag/growfs/feed/" rel="self" type="application/rss+xml" />
	<link>http://apocryph.org</link>
	<description>Notes to my future self</description>
	<lastBuildDate>Mon, 09 Aug 2010 16:59:34 +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>Extending swap space on FreeBSD 5.4</title>
		<link>http://apocryph.org/2005/12/06/extending_swap_space_on_freebsd_5_4/</link>
		<comments>http://apocryph.org/2005/12/06/extending_swap_space_on_freebsd_5_4/#comments</comments>
		<pubDate>Tue, 06 Dec 2005 18:48:34 +0000</pubDate>
		<dc:creator>anelson</dc:creator>
				<category><![CDATA[Migrated from Drupal]]></category>
		<category><![CDATA[bonzo]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[growfs]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[tech diary]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://apocryph.org/?p=98</guid>
		<description><![CDATA[When I first created bonzo, I allocated 96MB of RAM in VMWare. As I ran Gallery 2, Drupal, ByteHoard, etc, it became clear from the out-of-memory errors that I needed to boost the memory space. I since increased the allocation to 256MB, but the swap file is still only 160MB. Consequently, I&#8217;m plagued by kernel [...]]]></description>
			<content:encoded><![CDATA[<p>When I first created <code>bonzo</code>, I allocated 96MB of RAM in VMWare.  As I ran Gallery 2, Drupal, ByteHoard, etc, it became clear from the out-of-memory errors that I needed to boost the memory space.  I since increased the allocation to 256MB, but the swap file is still only 160MB.  Consequently, I&#8217;m plagued by kernel out of space space errors like:</p>
<pre><code>Dec  5 18:09:18 bonzo kernel: swap_pager_getswapspace(6): failed
</code></pre>
<p>and</p>
<pre><code>Dec  6 03:03:07 bonzo kernel: swap_pager: out of swap space
Dec  6 03:03:07 bonzo kernel: swap_pager_getswapspace(4): failed
Dec  6 03:03:07 bonzo kernel: pid 15958 (httpd), uid 80, was killed: out of swap space
</code></pre>
<p>I&#8217;ve expanded <code>bonzo</code>&#8216;s virtual disk by an additional gigabyte, using the steps from my previous post on <a href="growing_a_vmware_virtual_disk">growing VMWare disks</a>, and now I need to get FreeBSD to use that new space as swap.</p>
<p>I ran <code>sysinstall</code> to go through the FreeBSD installer again, which is how I created the FreeBSD disk label initially.  The disk label is what I as a Windows guy would think of as the partition table; it&#8217;s the list of partitions on the disk and their file system types.</p>
<p>To access the disk labeler again I went to &#8216;Expert&#8217; mode in the installer, then chose &#8216;Label&#8217;.  I hit &#8216;C&#8217; to create a new label, and got:</p>
<pre><code>Not enough space to create an additional FreeBSD partition
</code></pre>
<p>Sure enough, the label editor shows:</p>
<pre><code>Disk: ad0       Partition name: ad0s1   Free: 0 blocks (0MB)
</code></pre>
<p>Clearly it doesn&#8217;t &#8216;see&#8217; the 1GB I added to the end of the disk.</p>
<p>When I first accessed the &#8216;Label&#8217; function, I got:</p>
<pre><code>                     │WARNING:  A geometry of 113179/15/63 for ad0 is incorrect.  Using  │
                     │a more likely geometry.  If this geometry is incorrect or you      │
                     │are unsure as to whether or not it's correct, please consult       │
                     │the Hardware Guide in the Documentation submenu or use the         │
                     │(G)eometry command to change it now.                               │
                     │                                                                   │
                     │Remember: you need to enter whatever your BIOS thinks the          │
                     │geometry is!  For IDE, it's what you were told in the BIOS         │
                     │setup. For SCSI, it's the translation mode your controller is      │
                     │using.  Do NOT use a ``physical geometry''.                        │
</code></pre>
<p>However, I get that alot for large disks or RAID arrays, not just VMware disks, so I didn&#8217;t pay it any mind.  Perhaps I should.</p>
<p>Apparently there is a tool, <code>growfs</code>, which has been in the FreeBSD base install for years.  From the <a href="http://www.freebsd.org/cgi/man.cgi?query=growfs&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+6.0-RELEASE+and+Ports&amp;format=html"><code>growfs(8)</code> man page</a>:</p>
<pre><code> The growfs utility extends the newfs(8) program.  Before starting growfs
 the disk must be labeled to a bigger size using bsdlabel(8).  If you wish
 to grow a file system beyond the boundary of the slice it resides in, you
 must re-size the slice using fdisk(8) before running growfs.
</code></pre>
<p>Awesome.  So I have to resize the slice with <code>fdisk</code>, label the disk to a bigger size with <code>bsdlabel</code>, and only then can I expand the filesystem with <code>growfs</code>.  Hmm.  I&#8217;ll try later.</p>
<p>UPDATE: I wimped out.  I&#8217;m rather scared to death of damaging bonzo&#8217;s filesystem.  Even though it&#8217;s backed up nightly to <code>jane</code>, that doesn&#8217;t mean I relish the prospect of rebuilding the filesystem under duress.  Thus, I&#8217;ve taken the easy way out; I&#8217;ve added a new, 2GB hard drive using VMware, and will make that into a swap volume.</p>
<p>I ran <code>sysinstall</code> again, to use its GUI fdisk-er and label-er.  I&#8217;ve created a single partition, <code>ad1s1b</code>, which is a 2GB swap partition.  I&#8217;ve added it to <code>/etc/fstab</code> (<code>sysinstall</code> tried, but the kernel hadn&#8217;t picked up the newly created filesystem on <code>/dev/ad1</code> yet, so it failed.  Not a big deal.).  A reboot, and I&#8217;ll inspect my handiwork.</p>
<p>Sweet:</p>
<pre><code>bonzo# swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ad0s1b        162632        0   162632     0%
/dev/ad1s1b       2097112        0  2097112     0%
Total             2259744        0  2259744     0%
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://apocryph.org/2005/12/06/extending_swap_space_on_freebsd_5_4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
