We know that the security problems are becoming more and more serious, and there are many information leakage problems in some places. For example, a swap partition. The swap partition frees up some of the space in the hard disk space when the system's physical memory is not available for use by the currently running program. The freed space may come from programs that have not been manipulated for a long time, and the freed space is temporarily saved to the swap partition until those programs are run and the saved data is restored to memory from the swap partition. That is, the swap partition is a swap area that is swapped with the physical memory when it is not enough (not in all cases, of course).
Then, it is necessary to safely erase (release) the swap partition when the computer is turned on, to ensure that the memory that is swapped out by the application is completely erased when it is rebooted.
Our release of the swap space is actually done by closing the swap partition and then restarting the swap partition.
We can begin by following a few commands to achieve our goal:
Free-m
Swapoff-a
Free-m
Swapon-a
Free-m
First, the first free-m command can be used to see the swap usage and distribution, and then swapoff-a close the swap partition, then view the partition, swapon-a open the swap partition, free-m before the comparison.
If a swap partition is used, the result of the first free-m and the third free-m should be different. In addition, these two commands of swap must be executed under root authority.
Next, we only use the set power on automatically execute swapoff-a and swapon-a two command on line
The
Under root permissions to/ETC/RC.D to see if there is no rc.local file, if there is a direct swapoff-a and swapon-a the two commands added to the line, if you do not have this file to build one, and then in the form of shell script to write these two commands in.
OK, so that we can safely erase (release) the swap partition at boot time, ensuring that the memory that is swapped out by the application is completely erased at boot time.