Link to home
Start Free TrialLog in
Avatar of HarryF1
HarryF1

asked on

Swap and NFS on Linux

Hello,

I'm on Linux machines and run into the following problem:
I want to run a diskless X-Terminal which runs several other services as well. Therefore it needs a little swap space which I want to provide via NFS and which I can't get to work.

I did the following (as described in man mkswap and of course I am root when doing this):

$ dd if=/dev/zero of=swapfile bs=1024 count=8192
$ mkswap swapfile 8192
$ sync
$ swapon swapfile

Everything went fine except the swapon command. It complains about a wrong argument. In the syslog I get the following lines:

Jun  3 10:09:05 host kernel: rw_swap_page: bad swap file
Jun  3 10:09:05 host last message repeated 3 times
Jun  3 10:09:05 host kernel: Unable to find swap-space signature

How can I get the swapfile working?

Harry
Avatar of james_zhang
james_zhang

1. You should be root to turn on swap
2. use swapon /dir_name/swapfile
Avatar of HarryF1

ASKER

That was what I wrote!! Exactly THIS does not work!
Avatar of HarryF1

ASKER

Edited text of question
Does the procedure work on non-NFS filesystems.
This might be a first step in solving your problem.
Avatar of HarryF1

ASKER

Yes, it does. Swap on local drives is no problem but as I have to use the terminal without HDD I can't use it.

Something else you could try is perform all but the last step on the NFS server, and to only do the swapon on the diskless station. (the sync you perform doesn't sync the disk on the NFS server, I suppose)
Avatar of HarryF1

ASKER

I already tried this. I created the file on the server and just did a swapon file on the client. The result was the same.

what linux version are you using?  I think there is a swap over NFS patch floating out somewhere, I'll see if I can find it.  It might be included in 2.1.x, but I am pretty sure such support isn't in 2.0.x
Avatar of HarryF1

ASKER

I'm running 2.0.30. There is a patch? Any idea where I can find it?
ASKER CERTIFIED SOLUTION
Avatar of strobert
strobert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HarryF1

ASKER

Thank you - this patch solved the problem!