群晖服务器里很多tmp文件,黑群晖 篇一:内存映射解决黑群晖休眠频繁唤醒问题…

黑群晖 篇一:内存映射解决黑群晖休眠频繁唤醒问题

2019-12-13 15:21:09

4点赞

40收藏

6评论

自己组装黑群晖休眠时,大约每1小时唤醒一次,已排除路由器smb问题。经查询发现,经常有logrotate写入logrotate. tmp文件导致的休眠被唤醒。

存在scemd问题,但按照网上教程把scemd写入到tmp无效,只是解决了可以唤醒,但仍存在频繁唤醒问题。

问题原因在于scemd出错日志仍会写入内存中的文件,当文件大于5m时,会出现logrotate截断,截断时写日志正好处在md0系统分区。

解决方法:

1、将scemd和postgresql写入到null。修改/etc.default/syslog-ng/patterndb.d中文件:

scene. conf和postgres.conf的file("/dev/null")

2、映射系统常用文件到内存

建立3个定时任务脚本,all2tmp在开机时运行,tmp2disk在关机时运行,tmpbackup在每天六点运行。

all2tmp

cp -a -f /usr/syno/etc/private/session/ /tmp/session/

mount -B /tmp/session/ /usr/syno/etc/private/session/

cp -a -f /var/log/ /tmp/log/

mount -B /tmp/log /var/log

mkdir /tmp/usr/

cp -a -f /usr/lib/ /tmp/usr/lib/

mount -B /tmp/usr/lib/ /usr/lib/

mkdir /tmp/var

cp -a -f /var/lib/ /tmp/var/lib/

mount -B /tmp/var/lib/ /var/lib/

cp -a -f /var/tmp/ /tmp/var/tmp/

mount -B /tmp/var/tmp/ /var/tmp/

cp -a -f /var/cache/ /tmp/var/cache/

mount -B /tmp/var/cache/ /var/cache/

cp -a -f /etc/ /tmp/etc/

mount -B /tmp/etc/ /etc/

cp -a -f /etc.defaults/ /tmp/etc.defaults/

mount -B /tmp/etc.defaults/ /etc.defaults/

tmp2disk

umount /tmp/session/

cp -a -f /tmp/session/ /usr/syno/etc/private/session/

umount /tmp/usr/lib/

cp -a -f /tmp/usr/lib/ /usr/lib/

umount /tmp/var/lib/

cp -a -f /tmp/var/lib/ /var/lib/

umount /tmp/log/

cp -a -f /tmp/log/ /var/log/

umount /tmp/etc.defaults/

cp -a -f /tmp/etc.defaults/ /etc.defaults/

umount /tmp/etc/

cp -a -f /tmp/etc/ /etc/

tmpbackup

umount /tmp/usr/lib/

cp -a -f /tmp/usr/lib/ /usr/lib/

mount -B /tmp/usr/lib/ /usr/lib/

umount /tmp/var/lib/

cp -a -f /tmp/var/lib/ /var/lib/

mount -B /tmp/var/lib/ /var/lib/

umount /tmp/log/

cp -a -f /tmp/log/ /var/log/

mount -B /tmp/log /var/log

umount /tmp/etc.defaults/

cp -a -f /tmp/etc.defaults/ /etc.defaults/

mount -B /tmp/etc.defaults/ /etc.defaults/

umount /tmp/etc/

cp -a -f /tmp/etc/ /etc/

mount -B /tmp/etc/ /etc/

此设置建议在系统软件安装完成后进行,否则会出现软件写入部分到内存情况引起错误,安装完程序重启也可将内容写入到硬盘。

b43b92e789ee5f3711be8d452d89c76d.png

c2ad9c123c4d84295e50d901fd065b58.png

原文链接:https://blog.csdn.net/weixin_36431145/article/details/119446134?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522167586359916782429780423%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=167586359916782429780423&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-26-119446134-null-null.blog_rank_default&utm_term=%E9%BB%91%E7%BE%A4%E6%99%96%2C%E7%BE%A4%E6%99%96%2Cnas%2C%E8%9C%97%E7%89%9B%E6%98%9F%E9%99%85%2CDSM%EF%BC%8C%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F%2Cipv6%2C%E8%BF%9C%E7%A8%8B%E8%AE%BF%E9%97%AE%2Cwordpress%EF%BC%8C%E5%BB%BA%E7%AB%99%2C%E9%98%BF%E9%87%8C%E4%BA%91%2C%E8%85%BE%E8%AE%AF%E4%BA%91%2C%E5%9F%9F%E5%90%8D%2C%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8%2C

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享