-
-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DietPi-Software | Samba: Move logging to RAM #2396
Comments
Just for the sake of documentation in one single place, the write ops to the sdcard can be checked via For the Just needed Once in system prep:
Then in every boot, the symlink creation is automated via:
In order to allow smbd and nmbd services to be started in any order later on, I repeated the folder creation (if needed) for smbd unit:
I'll keep adding info if any additional findings. |
@WolfganP
/var/cache/samba/browse.dat
€: Ah you already found a similar solution, about this I would recommend:
/etc/fake-hwclock.data
|
Thx @MichaIng , we were writing at the same time with the findings. See my previous reply with a solution for Regarding |
@WolfganP To have fake-hwclock running daily is pretty simply: To have it run every 6 hours you need to create a custom crontab entry or systemd timer. |
I tested linking just the |
Many thanks for the info and resolution! 👍 Ok, we could move the whole sub directory to RAM:
Actually, might even be able to move everything in
|
The cache dir of APT can be moved without symlink:
But yeah the possible issue is the size, especially when many downloaded archives are cached:
So this can be only done, if it's verified that enough free RAM is available and still the risk remains, that downloading some very large APT package(s) might fail, when installing large packages or such, that require much dependencies. In general:
|
In
|
+ - General | Reduced disk write count: fake-hwclock.dat now stored in RAM. Many thanks to @WolfganP! https://github.com/Fourdee/DietPi/issues/2396
This does not work, since the file must be reboot persistent to do it's job. Even external drive is dangerous, if it is required before external drives are fully mounted, and of course, if the drive got detached. So this must stay on RootFS and I would also not touch the hourly safe to better prevent issues in case of power loss. Leave this to end user custom change, if really desired. But this file is tiny, and hourly disk touch should be really no issue, besides you are 105% enthusiast 😉. |
I agree on leaving As I said earlier, my motivation was to avoid SDcard excessive wearing for 24/7 servers when it can be avoided, and |
Ah good point 👍 we can do a service to save this to disk during shutdown and restore during boot. |
Simply removing the cron job |
(Fourdee@3c34712) Yep, so only issue now is if power loss, time will be reset to last boot time saved and/or from last shutdown save. Shame |
? Would be just overload, since the service does nothing else (on stop) then what the cron job does? As said, the current solution is a workaround for a result that we can achieve by simply removing the cron job, which will be (due to our apt.conf.d settings) not automatically re-created on APT upgrade. But I still do not like the workaround/solution. This is a very tiny file touch once an hour that prevents potentially large issues when the system starts with outdated clock due to crash/power loss or simply because SSH connection does not work on HDMI-less SBCs and users are forced to unplug power cable. I vote to revert all changes about fake-hwclock here. This is really no issue, but, as it is by default, a meaningful implementation. |
Totally agreed with @MichaIng on The samba solution however, is transparent to the user and bigger offender in terms of SDcard writing, so it may be worthy to tackle for all users. |
@Fourdee Having another look onto the |
Okay about the samba cache:
Me by chance found the tmpfile systemd feature: https://manpages.debian.org/stretch/systemd/tmpfiles.d.5.en.html
So the following should work well, at best BEFORE samba APT install:
Actually on Debian, PR: https://github.com/Fourdee/DietPi/pull/2397 @WolfganP So, would be great if you could report back, if there are any issues, since samba looses it's cache on every reboot. It seems to be really just a "cache", but a real-world test is always great to be sure 🙂. |
+ Reinstall samba during patch: https://github.com/Fourdee/DietPi/issues/2396#issuecomment-451701569
|
Required Information:
Steps to reproduce:
So, as my RasPi acts as a 24/7 media / file / IoT server, I started a mission to reduce power usage (ie disconnect HDD while media/file server is not needed) and avoid unnecessary write ops to the SD card to improve the component life and system stability.
So, using
fnotifystat
I was relocating files to tmpfs / ext HDD and dynamically taking down unneeded processes, but there are a couple of functions that still keep writing to the SD card unnecessarily:For
/var/cache/samba/browse.dat
(rewritten every 5' or so) I found this patch at https://lists.samba.org/archive/samba-technical/2015-May/107144.html and I'm still investigating the issue (I'll report back if found more info / a solution)For
/etc/fake-hwclock.data
being re-written regularly (every hour), I found https://github.com/Fourdee/DietPi/issues/2041 relevant, but all the discussion centers on needing it at boot time because the clock is not yet updated by ntp.So, is there any way to avoid that file write after the system is completely up and running?
Thx as always for any tip.
The text was updated successfully, but these errors were encountered: