M HYPE SPLASH
// updates

How to enlarge swap space on a linux VPS in order to compile an R package?

By Michael Henderson

Matt Lacey explained how to compile dplyr on low memory VPS. He managed to install dplyr by adding a larger swap space. Unfortunately this operation is not permitted on my VPS (Virtual Private Server): "swapon failed: Operation not permitted". Here is the output:

$ sudo fallocate -l 1G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=3bfbcf12-6b81-46b4-96b0-7de37fa1640b
$ sudo swapon /swapfile
swapon: /swapfile: swapon failed: Operation not permitted
$ cat /proc/swaps
Filename Type Size Used Priority
/dev/null partition 131072 3060 -1

EDIT I used other instructions from digitalocean to create a swap file. But they failed too:

sudo swapon /var/swap.img
swapon: /var/swap.img: swapon failed: Operation not permitted

There is a related issue in the dplyr package's repository.

Are there other, recommended ways to enlarge the swap space?

8

1 Answer

No, you can either:

  • Add a parttion to page to,
  • or add a file (as you tried) to page to,
  • or add more physical memory,
  • or ask the VPS provider to allocate more resources.

Alternatively, you could compile it on a different host and upload it to the VPS. (e.g. compile, create .rpm or whatever package manager you use on the VPS, upload that rpm).

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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