zoukankan      html  css  js  c++  java
  • 创建swap虚拟内存分区

    1、查看当前内存

    [root@root ~]# free -h
                  total        used        free      shared  buff/cache   available
    Mem:           1.8G        405M        193M        552K        1.2G        1.2G
    Swap:            0B          0B          0B

    2、创建用于交换分区的文件:增加8G大小的交换分区,count等于想要的块大小

    [root@root ~]# dd if=/dev/zero of=/home/swap bs=1024 count=8192000
    8192000+0 records in
    8192000+0 records out
    8388608000 bytes (8.4 GB) copied, 57.4412 s, 146 MB/s

    3、设置交换分区文件

    [root@root ~]# mkswap /home/swap
    Setting up swapspace version 1, size = 8191996 KiB
    no label, UUID=f29f996d-b575-46b1-96fa-8acf07aa7d49

    4、立即启用交换分区文件

    [root@root ~]# mkswap /home/swap
    Setting up swapspace version 1, size = 8191996 KiB
    no label, UUID=f29f996d-b575-46b1-96fa-8acf07aa7d49

    5、设置开机启动

    vim /etc/fstab
    
    /home/swap   swap                    swap    defaults        0 0  # 添加这一行

    6、再查看内存情况,swap就出来了

    [root@root ~]# free -h
                  total        used        free      shared  buff/cache   available
    Mem:           1.8G        410M         70M        552K        1.3G        1.2G
    Swap:          7.8G          0B        7.8G
    

      

  • 相关阅读:
    vue 实现左侧分类列表,右侧文档列表
    C# string数组与list< string >的相互转换
    c# List<string>的用法
    类数组 数组
    事件
    js封装方法和浏览器内核
    dom
    try...catch es5
    data对象 定时器
    call apply 原型 原型链
  • 原文地址:https://www.cnblogs.com/yoyo1216/p/13815419.html
Copyright © 2011-2022 走看看