Create and use SWAP file

General Q&A stuff about FoxyRoxyLinux

Create and use SWAP file

Postby saintless » Sun Nov 11, 2012 7:38 am

To create SWAP file type:
Code: Select all
root@debian:~# dd if=/dev/zero of=/live/image/swapfile bs=1024 count=524288

Code: Select all
root@debian:~# mkswap /live/image/swapfile 524288

In this example the SWAP file is 512 Mb and it is placed in /live/image.

You can start using this swapfile right a way without reboot with this command:
Code: Select all
root@debian:~# swapon /live/image/swapfile

And you can stop it with this one:
Code: Select all
root@debian:~# swapoff /live/image/swapfile

You can move this swap file on different partition and use it from there by changing the path, or you can delete it and recreate it again when you need it.
User avatar
Posts: 246
Joined: Sat Jul 14, 2012 7:01 am
Location: Bulgaria

Return to Do General Stuff

Who is online

Users browsing this forum: No registered users and 1 guest