zoukankan      html  css  js  c++  java
  • centos 7 添加swap

     

    添加一个8G 的swap

    cd /
    dd if=/dev/zero of=/swapfile bs=1k count=8192000
    mkswap /swapfile
    chmod 0600 /swapfile
    swapon /swapfile 
    echo "/swapfile swap swap defaults 0 0" >> /etc/fstab 

    详情见下面

    [root@lab01 /]# cd /
    [root@lab01 /]# dd if=/dev/zero of=/swapfile bs=1k count=2048000
    2048000+0 records in
    2048000+0 records out
    2097152000 bytes (2.1 GB) copied, 14.1909 s, 148 MB/s
    [root@lab01 /]# free -m
                  total        used        free      shared  buff/cache   available
    Mem:           1838          70          67           0        1699        1599
    Swap:             0           0           0
    [root@lab01 /]# mkswap /swapfile 
    Setting up swapspace version 1, size = 2047996 KiB
    no label, UUID=0cc4aeeb-a55d-430e-8671-297f33bde299
    [root@lab01 /]# chmod 0600 /swapfile 
    [root@lab01 /]# swapon /swapfile 
    [root@lab01 /]# free -m
                  total        used        free      shared  buff/cache   available
    Mem:           1838          72          81           0        1683        1597
    Swap:          1999           0        1999
    [root@lab01 /]# echo "/swapfile swap swap defaults 0 0" >> /etc/fstab 
    [root@lab01 /]# cat /etc/fstab 
    
    #
    # /etc/fstab
    # Created by anaconda on Thu Jul 11 02:52:01 2019
    #
    # Accessible filesystems, by reference, are maintained under '/dev/disk'
    # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
    #
    UUID=1114fe9e-2309-4580-b183-d778e6d97397 /                       ext4    defaults        1 1
    /swapfile swap swap defaults 0 0
     
  • 相关阅读:
    vue cli 3 构建vue项目
    hadoop综合大作业
    理解Mapreduce
    熟悉常用的HBase操作
    常用的HDFS操作
    爬虫大作业
    数据结构化与保存
    爬取新闻
    网络爬虫基础练习
    Hadoop综合大作业
  • 原文地址:https://www.cnblogs.com/faberbeta/p/linux-shell020.html
Copyright © 2011-2022 走看看