[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

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
0
HarryF1
Asked:
HarryF1
  • 6
  • 2
  • 2
  • +1
1 Solution
 
james_zhangCommented:
1. You should be root to turn on swap
2. use swapon /dir_name/swapfile
0
 
HarryF1Author Commented:
That was what I wrote!! Exactly THIS does not work!
0
 
HarryF1Author Commented:
Edited text of question
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
tryxCommented:
Does the procedure work on non-NFS filesystems.
This might be a first step in solving your problem.
0
 
HarryF1Author Commented:
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.

0
 
tryxCommented:
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)
0
 
HarryF1Author Commented:
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.

0
 
strobertCommented:
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
0
 
HarryF1Author Commented:
I'm running 2.0.30. There is a patch? Any idea where I can find it?
0
 
strobertCommented:
the URL for swap over NFS (2.0.x patch):
http://www.linuxhq.com/patch/20-p0530.html

www.linuxhq.com basically collects almost every kernel patch... good place to look.
0
 
HarryF1Author Commented:
Thank you - this patch solved the problem!
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 6
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now