Última atividade 1722577474

Malin's Avatar Malin revisou este gist 1722577473. Ir para a revisão

1 file changed, 25 insertions

swapfile-proxomx.sh(arquivo criado)

@@ -0,0 +1,25 @@
1 + #!/bin/bash
2 +
3 + # Define swapfile size and path
4 + SWAPFILE_PATH="/var/lib/vz/swapfile"
5 + SWAPFILE_SIZE="64G"
6 +
7 + # Create the swapfile with the specified size
8 + fallocate -l $SWAPFILE_SIZE $SWAPFILE_PATH
9 +
10 + # Set the correct permissions
11 + chmod 600 $SWAPFILE_PATH
12 +
13 + # Set up the swap space
14 + mkswap $SWAPFILE_PATH
15 +
16 + # Enable the swapfile
17 + swapon $SWAPFILE_PATH
18 +
19 + # Add the swapfile entry to /etc/fstab
20 + echo "$SWAPFILE_PATH none swap sw 0 0" >> /etc/fstab
21 +
22 + # Verify the swap is active
23 + swapon --show
24 +
25 + echo "64GB swapfile created and mounted successfully."
Próximo Anterior