Linux CentOS7.7 Swap swap area expansion

Preface

This chapter shares the process of setting the size of the Linux Swap swap area by yourself, hoping to help friends in need. When many programs are installed, they will check whether the size of the swap area meets the installation requirements, especially when installing the Oracle database. Next, I will share with you the Linux CentOS7.7 system as an example. Please give more pointers in the comment area for deficiencies, thank you.

One, create swap partition file

Use the following command to create a swap partition file.

dd if=/dev/zero of=/home/swapfile bs=10M count=1024

bs is the size of each block, count is the number of blocks, bs * count is the size of the swap file, here 10M * 1024=10G, you can adjust it according to your needs, of is the path of the swap partition file, you can modify it according to your needs, I will directly Put it under the /home path.

Insert picture description here

Second, format the swap partition file

Use the following command to format the swap partition file.

mkswap swapfile

Three, enable swap partition file

swapon swapfile

Insert picture description here

Four, check the mounting situation

free

Insert picture description here

Five, set up automatic mounting

Modify the file /etc/fstab and add /home/swapfile swap swap defaults 0 0.

vi /etc/fstab

/home/swapfile swap swap defaults 0 0

Insert picture description here

After editing, press Esc, enter: wq to save and exit, you are done here, you can reboot to test.

Guess you like

Origin blog.csdn.net/ZGS_CSDN_YH/article/details/109274797