dd 命令创建一个空文件,if指定一个来源/dev/zero(/dev/zero文件提供源源不断的“0”数据),of指定存储文件,bs=定义块的大小,count=定义块的数量
[root@localhost ~]# dd if=/dev/zero of=/root/test bs=100M count=20
20+0 records in
20+0 records out
2097152000 bytes (2.1 GB) copied, 42.9902 s, 48.8 MB/s
[root@localhost ~]# mkswap /root/test
Setting up swapspace version 1, size = 2047996 KiB
no label, UUID=13db4d1a-eb96-49fc-8e29-33e51c660ea5
[root@localhost ~]# free -hm
total used free shared buff/cache available
Mem: 976M 113M 170M 6.7M 692M 686M
Swap: 2.0G 0B 2.0G
[root@localhost ~]# swapon /root/test
swapon: /root/test: insecure permissions 0644, 0600 suggested.
[root@localhost ~]# free -hm
total used free shared buff/cache available
Mem: 976M 115M 168M 6.7M 692M 684M
Swap: 4.0G 0B 4.0G
[root@localhost ~]#
[root@localhost ~]# swapoff /root/test
[root@localhost ~]#
[root@localhost ~]# free -m
total used free shared buff/cache available
Mem: 976 114 168 6 693 685
Swap: 2047 0 2047
Centos7中的Swap分区的扩展
最新推荐文章于 2023-09-08 15:41:59 发布