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.

  • 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)? Jun 11 '11 at 8:16

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
  • nice spotting. I wouldn't have seen that immediately :)
    – Martin M.
    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.) Jun 9 '11 at 17:04
/dev/VolGroup00/LogVol01 swap                   swap    defaults        0 0


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

then post the output.

  • # umount: /dev/VolGroup00/LogVol01: not mounted Jun 14 '11 at 14:42
  • When I do swapon -a I get swapon: /dev/VolGroup00/Log01: Invalid argument Jun 14 '11 at 14:44
  • But doing a mkswap /dev/VolGroup00/LogVol01 and then swapon -a works. Jun 14 '11 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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