一.swap分区
1.swap作用
程序在运行时所有数据是在RAM。当RAM使用量超过了限额,为了使系统更加稳定,我们在硬盘上划分一部分空间来作内存缓冲区swap。
当内存使用超过限额,内核会把内存中闲置的数据存放到swap中
当程序需要swap分区中的数据时内核将swap分区中的数据在交还给内存进程处理
2.swap分区大小建议
说明:HIBERNATE是一个开源框架,做数据的插件。HIBERNATE开启之后,会暂存系统的电源信息。开机之后会把电源信息交还给内存,使得开机速度变快
3.swap管理
①查看swap分区
[root@rhel8 ~]# swapon -s ##查看swap分区信息
Filename Type Size Used Priority
/dev/nvme0n1p2 partition 511996 0 -2
②创建swap分区
创建分区并设定分区的类型为Linuxswap
[root@rhel8 ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x034d90a2.
Command (m