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…

發表評論