ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux下添加SWAP

linux下添加SWAP

原创 Linux操作系统 作者:crpp0902 时间:2019-05-29 07:48:06 0 删除 编辑

今天RMAN备份的时候,报SWAP空间不够,添加SWAP方式如下:
1.查看系统Swap空间使用
[root@localhost data]# free
             total       used       free     shared    buffers     cached
Mem:       2070204    2050096      20108          0       1724    1065180
-/+ buffers/cache:     983192    1087012
Swap:      2070204    0    0
2.在空间合适处创建swap文件

# mkdir var

# mkdir swap
# cd swap
# dd if=/dev/zero f=swapfile bs=1024 count=2634000
2634000+0 records in
2634000+0 records out
# ls -al
total 10024
drwxr-xr-x    2 root     root         4096  7月 28 14:58 .
drwxr-xr-x   19 root     root         4096  7月 28 14:57 ..
-rw-r--r--    1 root     root     2634000000  7月 28 14:58 swapfile


# mkswap swapfile
Setting up swapspace version 1, size = 9996 KiB

3.激活swap文件
# swapon swapfile
# ls -l
total 10016
-rw-r--r--    1 root     root     10240000  7月 28 14:58 swapfile
[root@localhost data]# free
             total       used       free     shared    buffers     cached
Mem:       2070204    2050096      20108          0       1724    1065180
-/+ buffers/cache:     983192    1087012
Swap:      4730432    2877016    1853416

[root@localhost data]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda7                               partition       2096440 2096440 -1
/var/swap/swapfile                      file            2633992 778628  -2

加到fstab文件中让系统引导时自动启动
#vi  /etc/fstab
/var/swap/swapfile    swap    swap    defaults    0 0

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28419/viewspace-663909/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: RAC的TAF配置
请登录后发表评论 登录
全部评论

注册时间:2002-11-14

  • 博文量
    59
  • 访问量
    54496