I'm running this as root, obviously.I've created a file called /swap/sw1, by dumping 512 megs of /dev/zero into it. I then ran mkswap, which said:Setting up swapspace version 1, size = 524284 KiBno label, UUID=f071fec6-0589-443f-9d46-1c126636418bI'm assuming this means it worked fine. I've chmodded the file to 0600, and the file is owned by root. I then ran swapon:$ swapon -v /swap/sw1swapon on /swap/sw1swapon: /swap/sw1: Operation not permittedI've also tried adding this to fstab and calling swapon -a -v, but go the same problem. Why am I not allowed to use this file as a swap file?One note, which I think is irrelevant but I could be wrong - I'm running on an OpenVZ VM.
swapon: Operation not permitted
ubuntu;swap
I think you were hit by the limitations of OpenVZ. OpenVZ does not allow what they call user defined swap: Swap is only available as a whole for the whole system, not for individual VPSes, see http://forums.vpslink.com/linux/621-swap-space.html#post3915