SWAP partition settings in LINUX

    How to set the size of SWAP partition in LINUX? When installing oracle, the swap is too small to continue the installation, so is there any way to change the size of swap without installing os?
    The following operations require root privileges:
# cd /usr/
# mkdir swap
# cd swap
# dd if=/dev/zero of=swapfile bs=1G count=8
This command separates a space of 8×1G from the hard disk, Hang on swapfile.
# mkswap swapfile
builds the swap format on /usr/swap/swapfile
# swapon swapfile
activates the swapfile and adds it to the swap partition.
The above operations will lose the swapfile in the swap space after restarting the system. Adding the swapfile to the /etc/fstab entry will enable the system to call swapon -a in the init process to automatically mount the swapfile, so that the swapfile will be valid every time the machine is restarted. swap space.
Add the following line to the /etc/fstab file:
/usr/swap/swapfile swap swap defaults 0 0

After the configuration is successful, check the size of the swap partition:
# free -m
             total       used       free     shared    buffers     cached
Mem:          7869       6702       1166          0         26       6353
-/+ buffers/cache:        322       7546
Swap:         8191          0       8191

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327069723&siteId=291194637