SWAP: Creating Dynamic Swap
Introduction
Creating a swap partition is quite straightforward but extremely useful when you’re running out of RAM.
Creating Swap
On a Partition
Use fdisk on the target partition:
|
|
Then create a primary partition with the key combination “n p 1”. Next, change the ID to indicate it’s a swap partition with “t 82”.
Save everything with the “w” key. To finish setting up our partition, we need to initialize it:
|
|
Now let’s use it:
|
|
I recommend modifying your /etc/fstab
file so that the swap is used on the next boot:
|
|
On a Disk Image
If you can’t create a swap partition, you have the option to create a disk image and assign it as additional swap:
|
|
Obviously, this size is small and serves as an example. You should adjust the dd command according to the available space on one of your partitions and adapt it to your swap needs.
Resources
Last updated 19 Sep 2009, 21:47 CEST.