Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 KiB
no label, UUID=f071fec6-0589-443f-9d46-1c126636418b

I'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/sw1
swapon on /swap/sw1
swapon: /swap/sw1: Operation not permitted

I'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.

share|improve this question
2  
Are you executing swapon as root? –  Kristof Provost Oct 8 '10 at 13:55
1  
@Kristof, configurator did state that he is running as root –  Stefan Oct 8 '10 at 15:58

1 Answer 1

up vote 10 down vote accepted

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

share|improve this answer
1  
Well, pardon my bluntness, but this is shit. Indeed it says right on VPSLink's website that their OpenVZ plan doesn't support swap space. Here's hoping I can run my programs without it! –  configurator Oct 8 '10 at 23:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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