Swapping via NFS for Linux

You are visitor number since Sunday, June 1st 2003.

Contents.

  • Project pages at SourceForge.net Logo
  • Status.
  • Stability.
  • Applying the patches.
  • Enabling swapping via NFS.
  • Pitfalls.
  • Implementations Notes.
  • Downloading.
  • Old web page and patches.
  • Links.
  • Stories of Success.
  • Credits.
  • Impressum

  • Status of this project.

    Unluckily, I do not have the time to maintain the patches any further. Sad, was quite a lot of fun.


    Which of the patches are considered to be stable?

    In short: NONE. I'm just saying this because the patches were not tested very much. I'm using an old 486 machine with 8MB for quick testing, and the thing was able to run a recent Linux distribution with X without deadlocking.

    Use at your own risk. Comments and bug-reports or bug-fixes are welcome.


    How to apply the patch files

    To apply the patches below, change to the location of your kernel source tree, e.g.

    /usr/src/hacking/linux/

    and run the patch command like this

    	gunzip -c /usr/src/linux-2.2.14-nfs-swap.diff.gz |  patch -p1 -l -s
          

    where you have to replace /usr/src/linux-2.2.14-nfs-swap.diff.gz by the name of the patch file your are actually using. The example given above assume that you have down-loaded the patch file into /usr/src/.

    After applying the patch you have to reconfigure your kernel. Run make menuconfig or make xconfig at the top-level directory of the patched kernel tree. Then enable the following configuration options

    Code maturity level options
    Prompt for development and/or incomplete code/drivers
    Networking options
    Swapping via network sockets (EXPERIMENTAL)
    Filesystems/Network File Systems
    Swapping via NFS (EXPERIMENTAL)

    Your computer probably doesn't have a hard-disk. So you can also disable the Swapping to block devices option in the Filesystems menu. This will will save a little bit of memory, 2k or so. Also, you probably need to enable the following options as well

    Networking options
    IP: kernel level autoconfiguration
    Networking options
    IP: DHCP support
    Networking options
    IP: BOOTP support
    Networking options
    IP: RARP support
    Filesystems/Network File Systems
    Root file system on NFS

    You probably need only one of DHCP, BOOTP and RARP, depending on you setup.


    How to enable swapping using the NFS protocol

    After you have recompiled and installed the kernel in the usual way you have to reboot. Afterwards you can enable swapping to files located on an NFS server by using the commands dd, mkswap and swapon which are available on virtually any Linux machine. Proceed as follows (customise to your needs!!!). The example assumes that your machine also gets its root file-system via NFS.

    	dd if=/dev/zero of=/SWAPFILE bs=1k count=20480
    	mkswap /SWAPFILE 20480
    	swapon /SWAPFILE
          

    That's it. You have created a 20MB swap-file and told your kernel to use it. Please refer to the man-pages for the respective programs for more information (man 8 swapon, man 8 mkswap).


    Pitfalls


    Implementation notes


    Where to download the patch files from

    Protocol Location
    SourceForge.net Logo http://sourceforge.net/project/showfiles.php?group_id=82543


    Old web page (and patches)

    Can be found here.


    Links


    Stories of Success


    Credits.


    webmaster   Impressum
    Last modified: Wed Mar 2 00:53:11 CET 2005