Linux 7.7设置交换分区SWAP
程序员文章站
2022-06-03 07:51:25
...
1. 创建交换分区文件
[[email protected] wxadmin]# dd if=/dev/zero of=/opt/swapfile bs=1M count=4096
4096+0 records in
4096+0 records out
4294967296 bytes (4.3 GB) copied, 20.789 s, 207 MB/s
2. 给文件授权
[[email protected] wxadmin]# chmod 600 /opt/swapfile
3. 格式化交换分区
[[email protected] wxadmin]# mkswap /opt/swapfile
Setting up swapspace version 1, size = 4194300 KiB
no label, UUID=bfe83644-0fa0-43f9-bf7e-69f9e24b391f
4. 开启交换分区
[[email protected] wxadmin]# swapon /opt/swapfile
5. 查看交换分区状态
[[email protected] wxadmin]# free -m
total used free shared buff/cache available
Mem: 3789 2682 208 280 898 586
Swap: 4095 0 4095
[[email protected] wxadmin]#
下一篇: linux中swap管理分区