Thursday, January 17, 2013

How to create swap partition on Archlinux

If you forgot to create swap partition on Archlinux. You can create it manually. For me swap is needed although i have more rams. This happens when i building android from source, i stuck on "Virtual Memory Exhaust", after i turn on swap partition, i can build without problem.


Ok, Create swap partition.

1. Check your partition with blkid commands.
Here's the results of my machines:
I have swap on /dev/sda2, & /dev/sda5, so to turn on swap
$sudo swapon /dev/sda2
or
$sudo swapon /dev/sda5
If swap partition isn't on the list, then you still didn't create it before.

2. Create swap partition
If you still didn't create it, create using gparted. Choose partition that you want to resize, for this example ext4 partition. Right click and resize.
Grey area is for your swap, set size on Free space Following
Then you will get unallocated space, right click on it, then choose new. On file system change into linux-swap.


Add, then you will get swap partition, then apply to make changes into system. For this example, swap file is created on /dev/sdc3

so to activate it.
$sudo swapon /dev/sdc3

3. Set swapon every boot
To make swap is on every boot, you can edit /etc/fstab
$sudo nano /etc/fstab

add this line at the end (for this example is /dev/sdc1)

/dev/sda2 none swap defaults 0 0 

Then save. Now reboot to see the results on Archlinux.

Enjoy.

Share on Facebook
Share on Twitter
Share on Google+

Related : How to create swap partition on Archlinux