1- Conéctese a su servidor Cloud con el protocolo SSH
ssh root@SERVER_IP
2- Confirme el espacio de intercambio (swap) actual (debería estar en 0 en el servidor Cloud)
[root@localhost ~]# free -m total used free shared buffers cached Mem: 489 51 438 0 3 9 -/+ buffers/cache: 37 451 Swap: 0 0 0 <---------------- Here you can find the swap space information
3- Valide el uso actual del espacio en el disco
[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 9.9G 653M 8.8G 7% /
4- Cree un archivo con el espacio de intercambio deseado (en este ejemplo hemos elegido 1024*1M = 1G)
[root@localhost ~]# dd if=/dev/zero of=/swapfile1 bs=1024 count=1M 1048576+0 records in 1048576+0 records out 1073741824 bytes (1.1 GB) copied, 12.4263 s, 86.4 MB/s
![]() |
|
5- Confirme el archivo de intercambio que acaba de crear
[root@localhost ~]# ls -lh /swapfile1 -rw-r--r-- 1 root root 1.0G Mar 22 21:04 /swapfile1
6- Declare el archivo de intercambio como espacio de intercambio real
[root@localhost ~]# mkswap /swapfile1 Setting up swapspace version 1, size = 1048572 KiB no label, UUID=6550cc52-1a36-4ca4-a295-11c440a3e5ca
7- Corrija el propietario y el permiso
[root@localhost ~]# chown root:root /swapfile1 [root@localhost ~]# chmod 0600 /swapfile1
8- Active su nuevo espacio espacio
[root@localhost ~]# swapon /swapfile1
9- Confirme que su espacio de intercambio ahora está disponible para usarse
[root@localhost ~]# free -m total used free shared buffers cached Mem: 489 483 6 0 3 427 -/+ buffers/cache: 52 437 Swap: 1023 0 1023 <---------------- Here you can find the swap space information
10- Monte automáticamente su nuevo espacio espacio al inicio del servidor
[root@localhost ~]# echo "/swapfile1 swap swap defaults 0 0" >> /etc/fstab
11- Confirme que " /etc/fstab" se ha actualizado correctamente desde el comando anterior
[root@localhost ~]# cat /etc/fstab /dev/xvda1 / ext4 defaults 1 1 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0 /swapfile1 swap swap defaults 0 0 <------------ Line that has been added to /etc/fstab
0 Comentarios