When I reboot my Linux server the swap space reads 0 in top.

  • I am running a vanilla install of CentOS 5.2
  • /etc/fstab looks fine from what I can tell

    /dev/VolGroup00/LogVol01 swap swap defaults 0 0
    
  • swapon -a returns "invalid params" error message for /dev/VolGroup00/LogVol01

Doing a mkswap /dev/VolGroup00/LogVol01 and then swapon -a works.

But each time I reboot the swap space goes back to 0 in top.

link|improve this question

43% accept rate
1) Are you sure the error is "invalig params" not "invalid argument"? Don't retype manually, copy-paste everything. 2) Can you test whether reading from the logical volume is possible without errors (dd if=/dev/VolGroup00/LogVol01 bs=512 count=10 of=/dev/null)? – Aleksander Adamowski Jun 11 '11 at 8:16
feedback

2 Answers

In /etc/fstab, all fields should be separated by whitespace. You have the last 2 fields' (fs_freq and fs_passno) values (zeros in both cases) separated by a comma.

Instead of this:

/dev/VolGroup00/LogVol01 swap swap defaults 0,0

You should have:

/dev/VolGroup00/LogVol01 swap swap defaults 0 0
link|improve this answer
nice spotting. I wouldn't have seen that immediately :) – Server Horror Jun 7 '11 at 18:45
I mistyped that line, it does not contain a comma. I just confirmed this on the machine. (I edited the question.) – Jared Brown Jun 9 '11 at 17:04
feedback
/dev/VolGroup00/LogVol01 swap                   swap    defaults        0 0

-

# swapoff -a
# umount /dev/VolGroup00/LogVol01
# mount -a

then post the output.

link|improve this answer
# umount: /dev/VolGroup00/LogVol01: not mounted – Jared Brown Jun 14 '11 at 14:42
When I do swapon -a I get swapon: /dev/VolGroup00/Log01: Invalid argument – Jared Brown Jun 14 '11 at 14:44
But doing a mkswap /dev/VolGroup00/LogVol01 and then swapon -a works. – Jared Brown Jun 14 '11 at 14:44
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.