<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pedromussato.com/index.php?action=history&amp;feed=atom&amp;title=Creating_swap_on_Linux</id>
	<title>Creating swap on Linux - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pedromussato.com/index.php?action=history&amp;feed=atom&amp;title=Creating_swap_on_Linux"/>
	<link rel="alternate" type="text/html" href="https://wiki.pedromussato.com/index.php?title=Creating_swap_on_Linux&amp;action=history"/>
	<updated>2026-04-10T13:07:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.pedromussato.com/index.php?title=Creating_swap_on_Linux&amp;diff=6&amp;oldid=prev</id>
		<title>413vhcu1lq0463ob: Created page with &quot;== This should work in any Linux distro ==  === Create a swapfile === To create the swapfile let&#039;s just use the /dev/zero and append on /swapfile we&#039;re using 16MB blocks and making 64 of those, in another words 1GB, you can make 0.5GB or 4GB doesn&#039;t really matters:  dd if=/dev/zero of=/swapfile bs=16M count=64 # 1GB or:  dd if=/dev/zero of=/swapfile bs=16M count=128 # 2GB or:  dd if=/dev/zero of=/swapfile bs=16M count=256 # 4GB Select one and go for it.  === Changing fil...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.pedromussato.com/index.php?title=Creating_swap_on_Linux&amp;diff=6&amp;oldid=prev"/>
		<updated>2024-10-06T22:25:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== This should work in any Linux distro ==  === Create a swapfile === To create the swapfile let&amp;#039;s just use the /dev/zero and append on /swapfile we&amp;#039;re using 16MB blocks and making 64 of those, in another words 1GB, you can make 0.5GB or 4GB doesn&amp;#039;t really matters:  dd if=/dev/zero of=/swapfile bs=16M count=64 # 1GB or:  dd if=/dev/zero of=/swapfile bs=16M count=128 # 2GB or:  dd if=/dev/zero of=/swapfile bs=16M count=256 # 4GB Select one and go for it.  === Changing fil...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== This should work in any Linux distro ==&lt;br /&gt;
&lt;br /&gt;
=== Create a swapfile ===&lt;br /&gt;
To create the swapfile let&amp;#039;s just use the /dev/zero and append on /swapfile we&amp;#039;re using 16MB blocks and making 64 of those, in another words 1GB, you can make 0.5GB or 4GB doesn&amp;#039;t really matters:&lt;br /&gt;
 dd if=/dev/zero of=/swapfile bs=16M count=64 # 1GB&lt;br /&gt;
or:&lt;br /&gt;
 dd if=/dev/zero of=/swapfile bs=16M count=128 # 2GB&lt;br /&gt;
or:&lt;br /&gt;
 dd if=/dev/zero of=/swapfile bs=16M count=256 # 4GB&lt;br /&gt;
Select one and go for it.&lt;br /&gt;
&lt;br /&gt;
=== Changing file privileges to 600 ===&lt;br /&gt;
Nothing crazy:&lt;br /&gt;
 chmod 600 /swapfile&lt;br /&gt;
&lt;br /&gt;
=== Formating this file as a swapfile ===&lt;br /&gt;
Just using mkswap and making /swapfile in fact a swapfile:&lt;br /&gt;
 mkswap /swapfile&lt;br /&gt;
&lt;br /&gt;
=== Activating swap on this file ===&lt;br /&gt;
To activate the swap now on this file you can just use swapon (swap on) and pass the file as a parameter:&lt;br /&gt;
 swapon /swapfile&lt;br /&gt;
&lt;br /&gt;
==== Deactivating swap on this file ====&lt;br /&gt;
To deactivate the swap on this file just use the inverse swapoff (swap off) and pass the file as a parameter.:&lt;br /&gt;
 swapoff /swapfile&lt;br /&gt;
&lt;br /&gt;
=== Appending swap configuration to fstab ===&lt;br /&gt;
Simple as this:&lt;br /&gt;
 echo &amp;quot;/swapfile none swap sw 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
Or if you want to open the /etc/fstab file and append the configurations you can append just this:&lt;br /&gt;
 /swapfile none swap sw 0 0&lt;br /&gt;
&lt;br /&gt;
=== Single line and all done ===&lt;br /&gt;
 dd if=/dev/zero of=/swapfile bs=16M count=128 ; chmod 600 /swapfile ; mkswap /swapfile ; swapon /swapfile ; echo &amp;quot;/swapfile none swap sw 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab #2GB&lt;/div&gt;</summary>
		<author><name>413vhcu1lq0463ob</name></author>
	</entry>
</feed>