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
    

      

  • 相关阅读:
    js验证身份证号,超准确
    C#对象序列化与反序列化
    寒冰王座[HDU1248]
    A C[HDU1570]
    循环多少次?[HDU1799]
    Play on Words[HDU1116]
    Fengshui-[SZU_B40]
    Travel Problem[SZU_K28]
    Big Event in HDU[HDU1171]
    Count the Trees[HDU1131]
  • 原文地址:https://www.cnblogs.com/yoyo1216/p/13815419.html
Copyright © 2011-2022 走看看