Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    86369155

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

1. Check memory usage

Check the usage of virtual memory before swap is added

free -m

2. Create swap file

Use the dd command to create a swap file with a size of 2G

dd if=/dev/zero of=/home/swap bs=1024 count=2048000 The larger the file, the more factory the time it is created.

3. Convert to swap format

Convert file format to swap format

mkswap /home/swap

4. Mount the swap partition

Use the swapon command to mount the swap partition to the swap partition

swapon /home/swap If an error is reported: swapon: /home/swap: insecure permissions 0644, 0600 suggested.

Modify permissions:

chmod 600 /home/swap

5. Check the memory usage again

Pay attention to the changes in observation and 1.

free -m

6. Setting up restart is still valid

To prevent the swap partition from becoming 0 after restart, you need to modify the /etc/fstab file:

At the end of the file (the last line)

/home/swap swap swap default 0 0

7. Deactivate virtual memory

swapoff -v /home/swap