add swap to cloud host (KVM)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

add swap to cloud host (KVM)

Eliza
Hi,

I have two cloud hosts both which are ubuntu, one has swap enabled:

$ free -m
               total        used        free      shared  buff/cache
available
Mem:            991          88         233          29         670
    684
Swap:           974         136         838

Another has none:

$ free -m
               total        used        free      shared  buff/cache
available
Mem:            985         423         171          26         390
    391
Swap:             0           0           0

So how to add swap to the system?

Thanks.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: add swap to cloud host (KVM)

Piper McCorkle
On 8/6/19 8:36 PM, Eliza wrote:
> So how to add swap to the system?

DigitalOcean has a good guide that should work on most distros:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-18-04

TL;DR:

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

pEpkey.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: add swap to cloud host (KVM)

Eliza
Great. Thanks for helps.

在 2019/8/8 3:57, Piper McCorkle 写道:

> On 8/6/19 8:36 PM, Eliza wrote:
>> So how to add swap to the system?
>
> DigitalOcean has a good guide that should work on most distros:
>
> https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-18-04
>
> TL;DR:
>
> sudo fallocate -l 1G /swapfile
> sudo chmod 600 /swapfile
> sudo mkswap /swapfile
> sudo swapon /swapfile
> echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
>
>

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users