How to set up a swap space on an existing Debian server

Post Reply
User avatar
Posts: 160
Joined: Sat Jul 11, 2020 9:44 am
Been thanked: 5 times

how can add swap for myvesta ?


User avatar
Site Admin
Posts: 934
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

Since you can't do repartition of existing disk (in order to add swap partition), you can create swap inside an file:

Code: Select all

dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576 # this is 1GB file
chown root:root /swapfile1
chmod 0600 /swapfile1
mkswap /swapfile1
swapon /swapfile1
echo "/swapfile1 none swap sw 0 0" >> /etc/fstab
free -m
Post Reply