zoukankan      html  css  js  c++  java
  • Swap空间扩展

    查看现有的内存和swap

    [root@localhost home]# free -m
                  total        used        free      shared  buff/cache   available
    Mem:           1819         614         116          27        1088         965
    Swap:          2047           0        2047

    安装Oracle11g需要swap大概为内存2倍,需要扩展2G左右

    进行swap空间新增

    1.使用dd创建swapfile,bs单位默认为byte可手动指定为M或G,count为计数

    [root@localhost home]# dd if=/dev/zero of=swapfile bs=1M count=2048
    2048+0 records in
    2048+0 records out
    2147483648 bytes (2.1 GB) copied, 1.96745 s, 1.1 GB/s
    [root@localhost home]# ll -h
    -rw-r--r--   1 root root 2.0G Aug 10 15:58 swapfile

    2.使用mkswap创建交换文件

    [root@localhost home]# mkswap swapfile
    Setting up swapspace version 1, size = 2097148 KiB
    no label, UUID=aad23206-f04b-4122-b862-e489001ed6b4

    3.使用swapon激活

    [root@localhost home]# swapon swapfile
    swapon: /home/swapfile: insecure permissions 0644, 0600 suggested.
    #建议修改权限为0600
    [root@localhost home]# swapoff swapfile
    [root@localhost home]# chmod 0600 swapfile 
    [root@localhost home]# swapon swapfile

    4.在/etc/fstab下进行添加,使swap永久生效

    [root@localhost home]# vim /etc/fstab
    /home/swapfile          swap                    swap    defaults        0 0

    5.添加完成,查看swap分区,和总空间。

    [root@localhost home]# swapon
    NAME           TYPE      SIZE USED PRIO
    /dev/dm-1      partition   2G   0B   -2
    /home/swapfile file        2G   0B   -3
    [root@localhost home]# free -m | grep Swap
    Swap:          4095           0        4095




  • 相关阅读:
    如何实现一个串行promise
    单机,分布式和集群的区别
    ERP & CRM
    CDN working principle diagram
    公众平台服务号、订阅号、企业号的相关说明
    DMZ的原理与应用
    ICP备案接入商
    DMZ主机
    浅析localstorage、sessionstorage
    Repeater+AspNetPager+Ajax留言板
  • 原文地址:https://www.cnblogs.com/plutozzl/p/13470341.html
Copyright © 2011-2022 走看看