July 5, 201016 yr Continued from prior post. 2. BUG: Allowing the possibility of a runaway syslog to completly use up all RAM and crash the server. Such train wrecks can be so easily prevented by mounting /var/log/ into its own limited-size ramdisk. I've actually done this on my custom bzroot build by adding this single line to /etc/fstab none /var/log tmpfs size=128m 0 0 That ramdisk doesn't set apart any RAM. It will only start using up RAM when stuff starts filing it up, up to the set limit. That's a really good idea & I will incorporate in the next release. I think this is worthy of it;s own feature request so that it's clearer. This has been suggested a few times over the past couple years, but might have been lost. I did the same thing for some directories to prevent crashes. The beauty of tmpfs is it "can" be swapped out if needed. If a size is not given, it will assume half of all memory but will not use the memory until requested. If push comes to shove, that tmpfs "can" be swapped out without ill effect on kernel memory. I suppose it might be wiser to use busybox's switchroot command to move the whole root to a tmpfs, but that may involve more testing. In the past I used switch_root so that I could use tmpfs and finally a unionfs on root. In the meantime something in the go script may work too.
July 5, 201016 yr In the meantime something in the go script may work too. That how I first did it a few months ago, but that's not very elegant. That's why I modified my bzroot to add the line I mentioned above. It's been working rock-solid. Can't crash it even if you try.
July 5, 201016 yr I tried this a long time ago, and IIRC, I ran into an issue regarding the difference between an initrd versus initramfs.... that the latter had problems with root switching.
July 5, 201016 yr Author I tried this a long time ago, and IIRC, I ran into an issue regarding the difference between an initrd versus initramfs.... that the latter had problems with root switching. I had problems with root switching too. Thereis pivot_root and switch_root. I did get switch_root working. I did have to modify it a bit. I know it worked because I had unionfs and aufs working at one point. I had a custom filesystem from the boot flash unioned with / In any case, this post is in regards to tmpfs for /var or /var/log. I prefer /var so that people can use programs which need to write/read /var without interfering with the root filesystem. I had prior issues with getting exim working without creating a tmpfs.
July 5, 201016 yr In the meantime something in the go script may work too. That how I first did it a few months ago, but that's not very elegant. That's why I modified my bzroot to add the line I mentioned above. It's been working rock-solid. Can't crash it even if you try. Did you also modify /etc/logrotate.d/syslog? Or did you leave it as is? I like your solution a LOT, and, apparently, so does Tom @ lime-tech.
July 5, 201016 yr Author Can't crash it even if you try. Oh I can get it to crash easy without filling up the log. My unraid use to crash all the time just from running updatedb or a massive rsync. I had to change the default vfs_cache_pressure. After setting it to 200 it has been stable.
July 5, 201016 yr Did you also modify /etc/logrotate.d/syslog? Or did you leave it as is? No, I didn't touch anything else. Although I think it may now be good to increase the filesize setting for the rotation.
July 5, 201016 yr Can't crash it even if you try. Oh I can get it to crash easy without filling up the log. LOL! True!
Archived
This topic is now archived and is closed to further replies.