5 ms·
First advice is to enable journaling mode on FS. First advice must be to mount FS in read only mode, mount /var in memory and forward al logs to one nide, whic
by blacklion 3y ago
First advice is to enable journaling mode on FS.
First advice must be to mount FS in read only mode, mount /var in memory and forward al logs to one nide, which may be not RPi but something with proper UPS and nut running. Power loss becomes absolutely bening if your FSes RO or temporary.
It is overkill if you have one RPi but author claims that he uses multiple RPis all around a house.
Also, good idea to have A/B system partitions and upgrade system with full partition rewrite and changing active one. Thus way your system will have one good system partition in any case, even if new version has fatal bugs, and recovery become trivial.
I'm using several small/single board PCs im different roles in such way for 20+ years with great success.
- Avamander 3y agoIn addition to /var, tmpfs should also be used for /tmp and similar. That should lengthen the SD card's lifetime immensely.
- diggan 3y agoIsn't this (tmpfs for /tmp) the default setup for most OSes, and surely raspberry's homegrown OS too?
- tyingq 3y agoIt seems it is not the default for Raspbian.
- iforgotpassword 3y agoI think all the usual desktop distros don't use tmpfs for either by default. I don't see the benefit in this with modern hardware.
- gkbrk 3y agoArch uses tmpfs for /tmp.
- Macha 3y agoArch has you set up your own fstab so pushes the choice to the user?
- GrumpySloth 3y agoDuring installation the guide tells you to run a program, which generates an fstab based on current mounts. So by default it will configure /tmp the same way it’s configured in the live cd.
- gabrielhidasy 3y agoActually the installation guide for arch asks you to use `genfstab -U /mnt >> /mnt/etc/fstab` which basically copies over whatever was mounted at the live environment (taking off the /mnt), I'm pretty sure tmpfs for /tmp was there by default last time I installed.
- lillecarl 3y agoI ran out of space on NixOS with tmpfs, they run all builds in /tmp so my swap ran out.
- bonzini 3y agoThey should use /var/tmp instead.
- zitsarethecure 3y agoFedora uses tmpfs for /tmp. I think it still makes a lot of sense to use tmpfs for a heavily written-to transient file system.
- marcosdumay 3y agoA long time ago, it used to be. It doesn't seem to be now, and I don't have any idea why the distros changed. (Maybe it's due to the mv semantics? But I though people considered the idea of creating a file in /tmp and then renaming it to be bad instead.) In fact, I didn't notice the change until now.
- adrian_b 3y agoCopying or moving through tmpfs loses silently some file metadata, e.g. extended attributes or high-resolution filestamps. Copying through /tmp is a frequently used method for transferring files between users on a multi-user computer. It is said that the Linux kernel will include soon an improved version of tmpfs, which will allow user extended attributes, within certain limitations. When this will happen, one of the most annoying misfeatures of tmpfs that has persisted for much too many years will finally be gone away.
- LtWorf 3y agoNot the default in debian, because of low memory devices such as rpi.
- rootbear 3y agoIf I had to guess, I would assume they chose not to use tmpfs because the earlier Pis had very limited RAM. With a 4GB or 8GB pi 4 or 5 this should not be a problem.
- Too 3y agoSurprisingly often not! Be careful to check inside your docker containers also. It can end up different. Here is a good article btw, with someone advocating for moving to tmpfs https://ubuntu.com/blog/data-driven-analysis-tmp-on-tmpfs https://ubuntu.com/blog/data-driven-analysis-tmp-on-tmpfs
- blacklion 3y agoAnything transient writable must be in memfs/tmpfs/how it is mamre im your OS, of course. Logs to log server, if system needs non-volatile writable storage — NFS or second storage device, depending on requirements. Of course, it is too much hassle for single such system (but I started to use it from very beginning out of curiosity) but uf you have many single-task small devices it is very convenient.
- e12e 3y agoMight be worth considering a different journaling fs, like nilfs2 for filesystems you need r/w.
- Eduard 3y ago> First advice must be to mount FS in read only mode How then do you update the system or install new software?
- LtWorf 3y agoThere is no need to mount read only if you forward the logs somewhere else.
- hcfman 3y agoMaybe. Maybe not. Years and years ago I was getting corrupt file systems even if the system was always shutdown correctly.
- sokoloff 3y agoRemount in read-write mode when you specifically want to make changes. sudo mount -o remount,rw .....
- blacklion 3y agoAs you update any embedded device: preparing new system image («firmware») and «re-flash» it. Of course, devices don't build their own systems.
- pama 3y agoThe author links to read only advice a couple of lines down. https://www.dzombak.com/blog/2021/11/Reducing-SD-Card-Wear-on-a-Raspberry-Pi-or-Armbian-Device.html https://www.dzombak.com/blog/2021/11/Reducing-SD-Card-Wear-o...
- joshuanapoli 3y ago> have A/B system partitions and upgrade system with full partition rewrite and changing active one What’s your upgrade process like? How do you make the new disk image? Do you log into each device to upgrade it, or do you have automation?
- blacklion 3y agoI have one «beefy» server/NAS (now it is EPYC2 on SuperMicro platform becuse they are cheap used on AliExpress, before it was Intel E3 12xx-badsed systems, two ir three generation old, always bought used). It is not my router, but NAS for all my data, NFS and build server. I'm using FreeBSD, and here is script for preparing such installations named NanoBSD. To be honest, it is nothing special — build system with provided config (to strip it down, for example full FreeBSD installation includes toolchain and it is waste of space on «embedded» systems), mount file as loop device, create FS, install system to this FS by standard system means, add needed packages. I'm building system once, make several images (as each device needs its own set of packages, of course), login to each device via ssh and run simple sh script which detects current active partition (by simply looking at output of mount command — from whic root is mounted) and then «dd if=/net/images/$hostname.img of=/dev/da0p$otherpart bs=128k», set this updated partition as «bootonce» in bootmanager and reboots. Last startup script in boot sequence check availability of network and liveleness of sshd, and if these simple checks are Ok, set this partition as alwaysboot (it is all UEFI features, mostly). If something goes wrong — one power cycle and device will boot from previous partition. I don't have enough devices to automate «login and call script» part :-)
- bdemirkir 3y ago> have A/B system partitions and upgrade system with full partition rewrite and changing active one Are there any solutions available for this?
- akdev1l 3y agoAbroot and OSTree
- blacklion 3y agoI'm using FreeBSD, not Linux for all my headless systems, and FreeBSD has NanoBSD script for such installations like forever.
- nsteel 3y agoThere appears to be new support for A/B partitions in the bootloader that might help: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#tryboot_a_b-mode https://www.raspberrypi.com/documentation/computers/raspberr... and https://www.raspberrypi.com/documentation/computers/config_txt.html#example-update-flow-for-ab-booting https://www.raspberrypi.com/documentation/computers/config_t...
- heavyset_go 3y agoNote that mounting /var in memory might exceed your device's memory if you're using something like Docker. You might have to move /var/lib/docker to secondary storage.