问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

如何增加swap空间大小

发布网友 发布时间:2022-04-21 22:57

我来回答

2个回答

懂视网 时间:2022-04-12 04:16

查看当前swap大小,是2G root@vzwc1:~# zfs listNAME USED AVAIL REFER MOUNTPOINTrpool 8.68G 40.0G 4.90M /rpoolrpool/ROOT 4.03G 40.0G 31K legacyrpool/ROOT/solaris 4.03G 40.0G 3.72G /rpool/ROOT/solaris/var 265M 40.0G 202M /varrpool/VARSHARE 43K

查看当前swap大小,是2G

root@vzwc1:~# zfs list
NAME   USED AVAIL REFER MOUNTPOINT
rpool   8.68G 40.0G 4.90M /rpool
rpool/ROOT   4.03G 40.0G 31K legacy
rpool/ROOT/solaris  4.03G 40.0G 3.72G /
rpool/ROOT/solaris/var 265M 40.0G 202M /var
rpool/VARSHARE  43K 40.0G 43K /var/share
rpool/dump   2.58G 40.1G 2.50G -
rpool/export  900K 40.0G 32K /export
rpool/export/home  868K 40.0G 34K /export/home
rpool/export/home/grid 36.5K 40.0G 36.5K /export/home/grid
rpool/export/home/oracle 45K 40.0G 45K /export/home/oracle
rpool/export/home/zhongwc 752K 40.0G 752K /export/home/zhongwc
rpool/swap   2.06G 40.1G 2.00G -
root@vzwc1:~# swap -l -h
swapfile  dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 285,2 4K 2.0G 2.0G
ZFS不支持mkfile的方式添加swap
root@vzwc1:~# mkfile 5g /var/swapfile
root@vzwc1:~# swap -a /var/swapfile 
/var/swapfile: Invalid operation for this filesystem type
可以使用zfs set的方式添加swap
root@vzwc1:~# zfs set volsize=5G rpool/swap
再次查看swap
root@vzwc1:~# zfs list
NAME   USED AVAIL REFER MOUNTPOINT
rpool   11.8G 36.9G 4.90M /rpool
rpool/ROOT   4.03G 36.9G 31K legacy
rpool/ROOT/solaris  4.03G 36.9G 3.72G /
rpool/ROOT/solaris/var 265M 36.9G 202M /var
rpool/VARSHARE  43K 36.9G 43K /var/share
rpool/dump   2.58G 37.0G 2.50G -
rpool/export  900K 36.9G 32K /export
rpool/export/home  868K 36.9G 34K /export/home
rpool/export/home/grid 36.5K 36.9G 36.5K /export/home/grid
rpool/export/home/oracle 45K 36.9G 45K /export/home/oracle
rpool/export/home/zhongwc 752K 36.9G 752K /export/home/zhongwc
rpool/swap   5.16G 37.1G 5.00G -
root@vzwc1:~# swap -l -h
swapfile  dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 285,2 4K 2.0G 2.0G
/dev/zvol/dsk/rpool/swap 285,2 2.0G 3.0G 3.0G
关闭和启动图形界面也有所变化

关闭图形界面

svcadm disable svc:/application/graphical-login/gdm:default

启动图形界面
svcadm enable svc:/application/graphical-login/gdm:default

grid@vzwc1:~/grid$ ./runcluvfy.sh stage -pre crsinst -n vzwc1,vzwc2 -fixup -verbose                   

Performing pre-checks for cluster services setup 

Checking node reachability...

Check: Node reachability from node "vzwc1"
 Destination Node   Reachable?  
 ------------------------------------ ------------------------
 vzwc1     yes   
 vzwc2     yes   
Result: Node reachability check passed from node "vzwc1"

Checking user equivalence...

Check: User equivalence for user "grid"
 Node Name    Status   
 ------------------------------------ ------------------------
 vzwc2     passed   
 vzwc1     passed   
Result: User equivalence check passed for user "grid"

Checking node connectivity...

Checking hosts config file...
 Node Name    Status   
 ------------------------------------ ------------------------
 vzwc2     passed   
 vzwc1     passed   

Verification of the hosts config file successful

Interface information for node "vzwc2"
 Name IP Address Subnet  Gateway  Def. Gateway HW Address MTU 
 ------ --------------- --------------- --------------- --------------- ----------------- ------
 net0 192.168.1.62 192.168.1.0 192.168.1.62 192.168.1.1 08:00:27:FB:18:44 1500 
 net1 172.168.1.62 172.168.1.0 172.168.1.62 192.168.1.1 08:00:27:AE:EC:AC 1500 

Interface information for node "vzwc1"
 Name IP Address Subnet  Gateway  Def. Gateway HW Address MTU 
 ------ --------------- --------------- --------------- --------------- ----------------- ------
 net0 192.168.1.61 192.168.1.0 192.168.1.61 192.168.1.1 08:00:27:43:92:4C 1500 
 net1 172.168.1.61 172.168.1.0 172.168.1.61 192.168.1.1 08:00:27:DC:D1:AE 1500 

Check: Node connectivity of subnet "192.168.1.0"
 Source    Destination   Connected? 
 ------------------------------ ------------------------------ ----------------
 vzwc2[192.168.1.62]  vzwc1[192.168.1.61]  yes  
Result: Node connectivity passed for subnet "192.168.1.0" with node(s) vzwc2,vzwc1

Check: TCP connectivity of subnet "192.168.1.0"
 Source    Destination   Connected? 
 ------------------------------ ------------------------------ ----------------
 vzwc1:192.168.1.61  vzwc2:192.168.1.62  passed  
Result: TCP connectivity check passed for subnet "192.168.1.0"

Check: Node connectivity of subnet "172.168.1.0"
 Source    Destination   Connected? 
 ------------------------------ ------------------------------ ----------------
 vzwc2[172.168.1.62]  vzwc1[172.168.1.61]  yes  
Result: Node connectivity passed for subnet "172.168.1.0" with node(s) vzwc2,vzwc1

Check: TCP connectivity of subnet "172.168.1.0"
 Source    Destination   Connected? 
 ------------------------------ ------------------------------ ----------------
 vzwc1:172.168.1.61  vzwc2:172.168.1.62  passed  
Result: TCP connectivity check passed for subnet "172.168.1.0"

Interfaces found on subnet "192.168.1.0" that are likely candidates for VIP are:
vzwc2 net0:192.168.1.62
vzwc1 net0:192.168.1.61

Interfaces found on subnet "172.168.1.0" that are likely candidates for VIP are:
vzwc2 net1:172.168.1.62
vzwc1 net1:172.168.1.61

WARNING: 
Could not find a suitable set of interfaces for the private interconnect
Checking subnet mask consistency...
Subnet mask consistency check passed for subnet "192.168.1.0".
Subnet mask consistency check passed for subnet "172.168.1.0".
Subnet mask consistency check passed.

Result: Node connectivity check passed

Checking multicast communication...

Checking subnet "192.168.1.0" for multicast communication with multicast group "230.0.1.0"...
Check of subnet "192.168.1.0" for multicast communication with multicast group "230.0.1.0" passed.

Checking subnet "172.168.1.0" for multicast communication with multicast group "230.0.1.0"...
Check of subnet "172.168.1.0" for multicast communication with multicast group "230.0.1.0" passed.

Check of multicast communication passed.

Check: Total memory 
 Node Name Available   Required   Status 
 ------------ ------------------------ ------------------------ ----------
 vzwc2  5GB (5242880.0KB)  2GB (2097152.0KB)  passed 
 vzwc1  5GB (5242880.0KB)  2GB (2097152.0KB)  passed 
Result: Total memory check passed

Check: Available memory 
 Node Name Available   Required   Status 
 ------------ ------------------------ ------------------------ ----------
 vzwc2  4.0248GB (4220352.0KB) 50MB (51200.0KB)  passed 
 vzwc1  3.5546GB (3727320.0KB) 50MB (51200.0KB)  passed 
Result: Available memory check passed

Check: Swap space 
 Node Name Available   Required   Status 
 ------------ ------------------------ ------------------------ ----------
 vzwc2  6GB (6291452.0KB)  5GB (5242880.0KB)  passed 
 vzwc1  6GB (6291452.0KB)  5GB (5242880.0KB)  passed 
Result: Swap space check passed

Check: Free disk space for "vzwc2:/var/tmp/" 
 Path  Node Name Mount point Available Required Status 
 ---------------- ------------ ------------ ------------ ------------ ------------
 /var/tmp/  vzwc2  /var  35.8776GB 1GB  passed 
Result: Free disk space check passed for "vzwc2:/var/tmp/"

Check: Free disk space for "vzwc1:/var/tmp/" 
 Path  Node Name Mount point Available Required Status 
 ---------------- ------------ ------------ ------------ ------------ ------------
 /var/tmp/  vzwc1  /var  32.7638GB 1GB  passed 
Result: Free disk space check passed for "vzwc1:/var/tmp/"

Check: User existence for "grid" 
 Node Name Status   Comment   
 ------------ ------------------------ ------------------------
 vzwc2  passed   exists(1100)  
 vzwc1  passed   exists(1100)  

Checking for multiple users with UID value 1100
Result: Check for multiple users with UID value 1100 passed 
Result: User existence check passed for "grid"

Check: Group existence for "oinstall" 
 Node Name Status   Comment   
 ------------ ------------------------ ------------------------
 vzwc2  passed   exists   
 vzwc1  passed   exists   
Result: Group existence check passed for "oinstall"

Check: Group existence for "dba" 
 Node Name Status   Comment   
 ------------ ------------------------ ------------------------
 vzwc2  passed   exists   
 vzwc1  passed   exists   
Result: Group existence check passed for "dba"

Check: Membership of user "grid" in group "oinstall" [as Primary]
 Node Name  User Exists Group Exists User in Group Primary Status 
 ---------------- ------------ ------------ ------------ ------------ ------------
 vzwc2  yes  yes  yes  yes  passed 
 vzwc1  yes  yes  yes  yes  passed 
Result: Membership check for user "grid" in group "oinstall" [as Primary] passed

Check: Membership of user "grid" in group "dba" 
 Node Name  User Exists Group Exists User in Group Status  
 ---------------- ------------ ------------ ------------ ----------------
 vzwc2  yes  yes  yes  passed  
 vzwc1  yes  yes  yes  passed  
Result: Membership check for user "grid" in group "dba" passed

Check: Run level 
 Node Name run level   Required   Status 
 ------------ ------------------------ ------------------------ ----------
 vzwc2  3    3    passed 
 vzwc1  3    3    passed 
Result: Run level check passed

Check: Hard limits for "maximum open file descriptors" 
 Node Name  Type  Available Required Status  
 ---------------- ------------ ------------ ------------ ----------------
 vzwc2  hard  65536  65536  passed  
 vzwc1  hard  65536  65536  passed  
Result: Hard limits check passed for "maximum open file descriptors"

Check: Soft limits for "maximum open file descriptors" 
 Node Name  Type  Available Required Status  
 ---------------- ------------ ------------ ------------ ----------------
 vzwc2  soft  65536  1024  passed  
 vzwc1  soft  65536  1024  passed  
Result: Soft limits check passed for "maximum open file descriptors"

Check: Hard limits for "maximum user processes" 
 Node Name  Type  Available Required Status  
 ---------------- ------------ ------------ ------------ ----------------
 vzwc2  hard  29995  16384  passed  
 vzwc1  hard  29995  16384  passed  
Result: Hard limits check passed for "maximum user processes"

Check: Soft limits for "maximum user processes" 
 Node Name  Type  Available Required Status  
 ---------------- ------------ ------------ ------------ ----------------
 vzwc2  soft  29995  2047  passed  
 vzwc1  soft  29995  2047  passed  
Result: Soft limits check passed for "maximum user processes"

Check: System architecture 
 Node Name Available   Required   Status 
 ------------ ------------------------ ------------------------ ----------
 vzwc2  64-bit amd64 kernel modules 64-bit amd64 kernel modules passed 
 vzwc1  64-bit amd64 kernel modules 64-bit amd64 kernel modules passed 
Result: System architecture check passed

Check: Kernel version 
 Node Name Available   Required   Status 
 ------------ ------------------------ ------------------------ ----------
 vzwc2  5.11   5.11   passed 
 vzwc1  5.11   5.11   passed 
Result: Kernel version check passed

Checking for multiple users with UID value 0
Result: Check for multiple users with UID value 0 passed 

Check: Current group ID 
Result: Current group ID check passed

Starting check for consistency of primary group of root user
 Node Name    Status   
 ------------------------------------ ------------------------
 vzwc2     passed   
 vzwc1     passed   

Check for consistency of root user's primary group passed

Starting Clock synchronization checks using Network Time Protocol(NTP)...

NTP Configuration file check started...
Network Time Protocol(NTP) configuration file not found on any of the nodes. Oracle Cluster Time Synchronization Service(CTSS) can be used instead of NTP for time synchronization on the cluster nodes
No NTP Daemons or Services were found to be running

Result: Clock synchronization check using Network Time Protocol(NTP) passed

Checking Core file name pattern consistency...
Core file name pattern consistency check passed.

Checking to make sure user "grid" is not in "root" group
 Node Name Status   Comment   
 ------------ ------------------------ ------------------------
 vzwc2  passed   does not exist  
 vzwc1  passed   does not exist  
Result: User "grid" is not part of "root" group. Check passed

Check default user file creation mask
 Node Name Available   Required   Comment 
 ------------ ------------------------ ------------------------ ----------
 vzwc2  0022   0022   passed 
 vzwc1  0022   0022   passed 
Result: Default user file creation mask check passed
Checking consistency of file "/etc/resolv.conf" across nodes

Checking the file "/etc/resolv.conf" to make sure only one of domain and search entries is defined
File "/etc/resolv.conf" does not have both domain and search entries defined
Checking if domain entry in file "/etc/resolv.conf" is consistent across the nodes...
domain entry in file "/etc/resolv.conf" is consistent across nodes
Checking if search entry in file "/etc/resolv.conf" is consistent across the nodes...
search entry in file "/etc/resolv.conf" is consistent across nodes
Checking DNS response time for an unreachable node
 Node Name    Status   
 ------------------------------------ ------------------------
 vzwc2     passed   
 vzwc1     passed   
The DNS response time for an unreachable node is within acceptable limit on all nodes

File "/etc/resolv.conf" is consistent across nodes

Check: Time zone consistency 
Result: Time zone consistency check passed

Pre-check for cluster services setup was successful. 
grid@vzwc1:~/grid$ 

热心网友 时间:2022-04-12 01:24

想在虚拟机里面安装oracle10g,发现默认的swap交换空间不满足最低要求,因为我分配的物理内存是1G,那么就按照要求需要2G的swap交换空间,默认只有1G的交换空间。添加swap交换空间的步骤如下:

第一步:确保系统中有足够的空间来用做swap交换空间,我使用的是KVM,准备在一个独立的文件系统中添加一个swap交换文件,在/opt/image中添加2G的swap交换文件
第二步:添加交换文件并设置其大小为2G,使用如下命令

[root@sense image]# dd if=/dev/zero of=/opt/image/swapbs=1024 count=2048000

过段时间就返回如下结果:
2048000+0 records in
2048000+0 records out
2097152000 bytes (2.1 GB) copied, 272.867 seconds, 7.7MB/s

第三步:创建(设置)交换空间,使用命令mkswap

[root@sense image]# mkswap /opt/image/swap
Setting up swapspace version 1, size = 2097147 kB
第四步:检查现有的交换空间大小,使用命令free

[root@sense image]# free -m
total used free shared buffers cached
Mem: 1011 989 21 0 1 875
-/+buffers/cache: 112 898
Swap: 1027 0 1027

或者检查meminfo文件
grep SwapTotal /proc/meminfo

第五步:启动新增加的2G的交换空间,使用命令swapon

[root@sense image]# swapon /opt/image/swap
第六步:确认新增加的2G交换空间已经生效,使用命令free

[[root@sense image]# free -m
total used free shared buffers cached
Mem: 1011 995 15 0 4 877
-/+buffers/cache: 113 897
Swap: 3027 0 3027

或者检查meminfo文件
grep SwapTotal /proc/meminfo
第七步:修改/etc/fstab文件,使得新加的2G交换空间在系统重新启动后自动生效

在文件最后加入:
/opt/image/swap swap swap defaults 0 0
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
邪灯是什么意思? 趣头条怎么解绑微信 趣头条APP解绑微信教程 趣头条怎么解绑微信号 趣头条怎样解除微信绑定 魔兽世界7.0古龙之陨怎么做 咸阳男子欲带孩子轻生被救回,成年人的生活有多不易? 陕西咸阳,一男子欲带孩子轻生被救回,轻生带孩子是什么操作? 我是帅哥,为什么还没有人追? 为什么我这么漂亮就是没有一个男人来追我 气死了? 人不在本地,怎么实名制 这些是什么字 ie11 网页显示不全怎么办 安卓手机swap文件位置怎么设置呀 错 措 .睹 覩 .置 寘.沽 酤 哪俩是古今字. 覩字的减化字是什么字 如何启用linux swap 这两个字的读音 如何调节swap的大小? 覩字的草书写法 REDHAT LINUX 9.0 SWAP问题 覩与睹是异体字吗 Ubuntu中如何修改swap大小 覩字简写?? 安卓系统怎么修改swap的使用率? 左边一个“者”右边一个“见”是什么字? 如何设置/修改centos上的swap交换分区 . 睹字怎么组词 如何设置/修改centos上的swap交换分区 睹的字义是什么 为什么蛇会有毒? IE11浏览器网页显示不全怎么解决?百度浏览器能显... 你好,你的: Ubuntu中如何修改swap大小 悬赏分:5... ie11与久其不兼容,网页显示不完整 大内存服务器swap分区应该多大,红帽7系统 怎样修复ie浏览器 页面无法显示 w10系统ie11浏览器打开湖北省电子税务局里面的一些... win7 64位 IE11网页显示错位 网页在IE11无法正常显示 IE11无法显示此页 IE11浏览器出了问题,所有网页都无法显示 新买的华为nova 7 pro自带的应用有哪些怎么能知道? IE11浏览器开久了突然无法显示网页关闭后重新打开... ie11打不开网页或者打开空白怎么办 华为nova7怎么卸载手机自带软件 IE11打开OA页面显示不完整 华为nova7 软件更新后怎么恢复之前的软件 win7 IE11 网页对话框无内容 nova7pro手机里为什么有2018年的软件? 华为nova6se自带软件有哪些? 我上个月刚买的华为nova7pro为什么有两年前的便签...