Differences between revisions 1 and 2
Revision 1 as of 2009-07-15 07:37:52
Size: 690
Editor: SamatJain
Comment:
Revision 2 as of 2009-07-27 09:21:33
Size: 716
Editor: SamatJain
Comment:
Deletions are marked like this. Additions are marked like this.
Line 18: Line 18:
----
CategoryCheatSheet

Create and use a swap file

Instead of letting space go to waste in a swap partition, Linux can use a small swap file instead:

   1 sudo dd if=/dev/zero of=/swap-file bs=1M count=255
   2 sudo mkswap /swap-file
   3 sudo swapon /swap-file

To automatically bring it up on reboot, place into fstab:

/swap-file none swap sw 0 0

(!) Note: The Linux kernel does not support sparse files as swap files. It's also best to create the swap file immediately after filesystem creation to insure a contigiuous file. Other than that, choice of filesystem does not matter. Reference on LKML.


CategoryCheatSheet

SamatsWiki: CheatSheet/Partitioning (last edited 2022-06-28 20:12:45 by SamatJain)