Linux 系统下 /dev/shm 大小调整 实用方法

今天,在弄linux 下的oracle12c RAC环境时,在调整/dev/shm 大小调整时,遇到一些麻烦,幸好,最后都能解决问题,下面为解决过程:

[root@node01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_node01-lv_root
36G 759M 33G 3% /
tmpfs 932M 0 932M 0% /dev/shm
/dev/sda1 485M 32M 428M 7% /boot

/dev/shm默认只有932m,也就是差不多1G,担心在ORACLE安装配置过程文件系统大小,不够用,就想着调大一些:

[root@node01 ~]# vi /etc/fstab

dev/mapper/vg_node01-lv_root / ext4 defaults 1 1
UUID=f1c91395-7698-4bf3-954a-adc8862fbe9b /boot ext4 defaults 1 2
tmpfs /dev/shm tdevpts /dev/pts dsysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
tmpfs /dev/shm t[root@node01 ~]# vi /etc/fstab Used Available Use% Mounted on

调整tmpfs /dev/shm 的大小,如下所示:

/dev/mapper/vg_node01-lv_root / ext4 defaults 1 1
UUID=f1c91395-7698-4bf3-954a-adc8862fbe9b /boot ext4 defaults 1 2
/dev/mapper/vg_node01-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults.size=1140850688 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0

然后保存退出,并执行如下命令:

[root@node01 ~]# mount -o remount /dev/shm
mount: /dev/shm not mounted already, or bad option

有如上报错:

再尝试:

[root@node01 ~]# mount -o remount,rw /dev/shm
mount: /dev/shm not mounted already, or bad option

仍然有如上报错:

[root@node01 ~]# umount /dev/shm
[root@node01 ~]# mount /dev/shm
mount: wrong fs type, bad option, bad superblock on tmpfs,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog – try
dmesg | tail or so

[root@node01 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_node01-lv_root
36744792 777004 34101244 3% /
/dev/sda1 495844 32411 437833 7% /boot
[root@node01 ~]# mount -o remount /dev/shm
mount: /dev/shm not mounted already, or bad option
[root@node01 ~]# mount -o remount /dev/shm
mount: /dev/shm not mounted already, or bad option

还是报错,并且,umount /dev/shm后,再mount 还是会报同样的错,

最好,通过以下命令来解决问题:

[root@node01 ~]# mount -o size=1500M -o nr_inodes=1000000 -o noatime,nodiratime -o remount /dev/shm
[root@node01 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_node01-lv_root
36744792 777132 34101116 3% /
tmpfs 1536000 0 1536000 0% /dev/shm
/dev/sda1 495844 32411 437833 7% /boot

最后,终于,将/dev/shm 大小调整到1500M,即是1.5G.

 

 

以下文章点击率最高

Loading…

     

如果这文章对你有帮助,请扫左上角微信支付-支付宝,给于打赏,以助博客运营

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注