next up previous
Next: Installing software Up: Setting up a Linux Previous: Initialisation scripts


Good luck.

With kernel revision 2.4.9, use enbd for swapping. enbd is not suited for this, as it has no way of handling the race condition described in the theory chapter. However, especially if you specify a large number of connection to the swap server (I'd use -n 6), it will work. Usually, as soon as the kernel has started swapping, you are on dry land. It is the transition from not swapping to swapping that is most prone to race conditions.

After compilation, the enbd server ist started with

nbd-server <port> <swapfile> -i <some signature>.
The nbd client is started with
nbd-client <swapserver> <port (same as above)> -n <connections>\
You may have to create a sufficient amount of special files. Their names are determined by nbd-client by appending a number from 1 to <connections> to <device>. Those files must be block devices with major 43, minor = their number.

Example: nbd-client foo 1100 -n 3 /dev/nda

In this case, /dev/nda must be a block device with major 43, minor 0.

/dev/nda1: 43,1

/dev/nda2: 43,2

Note that the kernel may very well encounter a race condition when using this method. Also note that it is possible to use SSL to encrypt the memory pages sent over the net.

If you chose linux-2.4.5 and included support for swapping over NFS, you will have to export an additional directory from your server. This is because to avoid the famous race condition the block size for the NFS data transfers must be much smaller than the kernel page size, which is 4k. This does impede performance a lot. Therefore, you may wish to keep as little as possible on that particular export.

From the client, mount the exported directory with rsize and wsize options set to 2048. Create a file of the desired size, using something along the lines of

dd if=/dev/zero of=<name of the swapfile> bs=1M\
count=<swapsize in megabytes>
Now just run a swapon on that file. You can easily put that swapon command into a startup script. Note that clients cannot share swap files. Also note that the content of the client's RAM is sent over the network unencrypted when using this approach.

next up previous
Next: Installing software Up: Setting up a Linux Previous: Initialisation scripts