<?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>Helm&#039;s Technology Blog &#187; swap</title>
	<atom:link href="http://www.ihelm.org.uk/tag/swap/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ihelm.org.uk</link>
	<description>Linux Servers, Cpanel and Mysql along with my own tech thoughts</description>
	<lastBuildDate>Sun, 11 Jul 2010 10:50:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Adding a new swap partition &#8211; Linux</title>
		<link>http://www.ihelm.org.uk/2009/07/adding-a-new-swap-partition-linux/</link>
		<comments>http://www.ihelm.org.uk/2009/07/adding-a-new-swap-partition-linux/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 20:24:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">http://www.ihelm.org.uk/?p=62</guid>
		<description><![CDATA[I realised after my previous post I realised that it would be worthwhile talking about adding a new partitition.

The first thing you need - or I assume - is that you have a separate hard-drive which is not active (mounted) or can be unmounts using the standard umount command.

We assume the device is sdc  (it could be sdb, sda, hda1 etc..).]]></description>
			<content:encoded><![CDATA[<p>I realised after my previous post I realised that it would be worthwhile talking about adding a new partitition.</p>
<p>The first thing you need &#8211; or I assume &#8211; is that you have a separate hard-drive which is not active (mounted) or can be unmounts using the standard umount command.</p>
<p>We assume the device is sdc  (it could be sdb, sda, hda1 etc..).</p>
<ol>
<li>Ensure the drive is unmounted &#8211; turn off any swap already on it with swapoff (or if it&#8217;s clean of swap partitions then you can ignore swapoff)</li>
<li>type in &#8220;parted /dev/sdc&#8221;  This loads the parted prompt which allows you to manage the disk.</li>
<li>enter &#8220;print&#8221; to view details of any existing partitions and free space.</li>
<li>once you have decided the size you need (at minimum I would recommend match your RAM) type &#8220;mkpartfs part-type linux-swap start end&#8221;  Where for the start and end match the start point available in the print command and ending a number x megabtes above i.e. if the start point is 1024 then the end point would be 5120 for a four gigabyte partition (4096)</li>
<li>once done type quit to exit parted.  The new partition will have been given a number e.g. sdc2 (or higher if others exist)</li>
<li>all that needs doing is to format the partition &#8220;mkswap /dev/sdc&#8221;</li>
<li>to enable it&#8217;s the same process as for the file &#8211; &#8220;swapon /dev/sdc&#8221;</li>
</ol>
<p>If you want to make it work each boot &#8211; then edit the fstab using</p>
<p>vi /etc/fstab</p>
<p>add to the bottom: (press insert to enter edit mode)</p>
<p>/dev/sdc2 swap swap defaults 0 0</p>
<p>then press escape and shift-Z shift-Z</p>
<p>as before you can check to see if it&#8217;s been added by using</p>
<p>/proc/swaps</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ihelm.org.uk/2009/07/adding-a-new-swap-partition-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Swap Space without a partition &#8211; Linux</title>
		<link>http://www.ihelm.org.uk/2009/07/adding-swap-space-without-a-partition-linux/</link>
		<comments>http://www.ihelm.org.uk/2009/07/adding-swap-space-without-a-partition-linux/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 19:47:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">http://www.ihelm.org.uk/?p=59</guid>
		<description><![CDATA[We had a problem on one of the servers which I help administer.  Every now and again RAM usage would max out and SWAP would then be used - this would sometimes max out and bye bye server, normally this happened for only a few seconds and all was fine - however if it lasted more then when SWAP ran out - the server ground to a halt and needed a manual restart.

The server in question is quite busy - but only had 512Meg of RAM (this has since been rectified) historically as it wasn't that busy at first several years ago has slowly grown as websites on it have grown in popularity and databases have grown.

So an immediate fix was required]]></description>
			<content:encoded><![CDATA[<p>We had a problem on one of the servers which I help administer.  Every now and again RAM usage would max out and SWAP would then be used &#8211; this would sometimes max out and bye bye server, normally this happened for only a few seconds and all was fine &#8211; however if it lasted more then when SWAP ran out &#8211; the server ground to a halt and needed a manual restart.</p>
<p>The server in question is quite busy &#8211; but only had 512Meg of RAM (this has since been rectified) historically as it wasn&#8217;t that busy at first several years ago has slowly grown as websites on it have grown in popularity and databases have grown.</p>
<p>So an immediate fix was required &#8211; it had a swap partition &#8211; couldn&#8217;t create a new one, it would mean downtime as we are using the hard-drives!</p>
<p>So added a swap file &#8211; here&#8217;s how to do it:</p>
<ol>
<li>Change to a directory (on a partition) where you have lots of space &#8211; e.g. /home  &#8221;cd /home&#8221;</li>
<li>Create a file swapfile using dev null &#8211; the following command will create a 4meg file:  &#8221;dd if=/dev/zero of=swapfile bs=1024 count=4194304&#8243;<br />
This creates an empty file called &#8220;swapfile&#8221; with a block size of 1024bytes and creates 419304 (to get the size do 4194304 / 1024 then divide by 1024 to get the size in gigabytes).</li>
<li>chmod it so it can be used &#8220;chmod 600 swapfile&#8221;</li>
<li>format the file to a swapfile type so the system can use it &#8220;mkswap swapfile&#8221;</li>
<li>In order to use it &#8211; turn it on &#8220;swapon swapfile&#8221;</li>
</ol>
<p>At the end of this if yo do the following &#8220;cat /proc/swaps&#8221; to see your swapspace.  It&#8217;s now larger by a lot and hey presto.  Of course a long-term fix has to be more ram if possible or tweak your setups! (or a new server!)</p>
<p>This doesn&#8217;t get setup to activate on boot &#8211; mainly because I didn&#8217;t need this &#8211; a temporary fix and therefore didn&#8217;t want todo this as the RAM would be upgraded soon, but if you need more memory &#8211; and don&#8217;t mind it being slow for stability then this is a possible solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ihelm.org.uk/2009/07/adding-swap-space-without-a-partition-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->