- RBERRYPI ---------------- < Пред. | След. > -- < @ > -- < Сообщ. > -- < Эхи > --
 Nп/п : 27 из 100
 От   : The Natural Philosopher             3:633/10          04 авг 26 11:10:07
 К    : All                                                   04 авг 26 14:45:05
 Тема : Re: Are Pi Zeros more fussy about SD cards than other Pis?
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 3:633/10 afad2a25
@REPLY: 3:633/10 57905458
@PID: PyGate 1.5.19
@TID: PyGate/Linux 1.5.19
@NOTE: Mozilla Thunderbird
@CHRS: ASCII 1
@TZUTC: 0100
@REPLYADDR: tnp@invalid.invalid
@REPLYTO: 3:633/10 UUCP
@RFC-Message-ID: <114sdpv$21l1h$1@dont-email.me>
On 04/08/2026 10:15, Chris Green wrote:
> s|b <me@privacy.invalid> wrote:
>> On Mon, 3 Aug 2026 18:29:55 +0100, The Natural Philosopher wrote:
>>
>>> in the true `if i wanted to go there i wouldn`t be starting from here`
>>> tradition if its a 2W why not send its data to somewhere more
>>> interesting  and secure?
>>>
>>> My Pi zero W never writes to its SD car at all unless i change
>>> configurations,. Everything that writes is either stopped from writing
>>> or writes to ram discs.
>>>
>>> Some SD cards are better than others, I am not interested in finding out
>>> which
>>
>> This is helpful.
>>
> What would be more helpful would be some guidance on how to implement
> it! :-)
> 
> E.g.  how do you stop systemd`s logging from writing to `hard` disk?
> It would need a **lot** of reconfiguration before it would use a
> reasonable amount of space such as is available on a RAM drive.
> 
> Maybe there are versions of the OS that are optimised for minimal disk
> writing, if so I`d like to know about them.
> 
Here is my `if I ever have to reproduce this` cheat file
HEATING CONTROLLER
==================
user: admin
password: fuckU
file /etc/dhcpcd.conf
---------------------
set static IP address 192.168.0.201
set gateway 192.168.0.254
set name-server 192.168.0.100

apt-get update
apt-get upgrade -y

# web server
#============
apt-get install apache2
chown -R www-data /var/www
chgrp -R www-data /var/www
chmod -R 775 /var/www/
chmod g+s /var/www
usermod -aG www-data me
usermod -aG www-data admin
mkdir /var/www/data
chmod 775 /var/www/data
# create an area to share data between processes...
mkdir /var/www/data/volatile
chmod 777 /var/www/data/volatile
# create ram disks
echo  "tmpfs /var/www/data/volatile tmpfs 
nodev,nosuid,noexec,nodiratime,size=1M   0 0" >> /etc/fstab
echo  "tmpfs /var/ramlog tmpfs 
nodev,nosuid,noexec,nodiratime,size=25M,mode=0755   0 0" >> /etc/fstab




## fuck with shitsemd
sed -i "s/#Storage=auto/Storage=volatile/" /etc/systemd/journald.conf
sed -i "s/#RuntimeMaxUse=/RuntimeMaxUse=25M/" /etc/systemd/journald.conf
sed -i "s/#ForwardToConsole=yes/ForwardToConsole=no/" 
/etc/systemd/journald.conf
sed -i "s/#ForwardToWall=yes/ForwardToWall=no/" //etc/systemd/journald.conf


Then it is a question of making sure the SD card filesystem is mounted 
with minimal write
more /etc/fstab

proc            /proc           proc    defaults          0       0
PARTUUID=b8c9fbb7-01  /boot           vfat    defaults          0       2
PARTUUID=b8c9fbb7-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
tmpfs /var/www/data/volatile tmpfs 
nodev,nosuid,noexec,nodiratime,size=1M   0 0
tmpfs /var/ramlog tmpfs 
nodev,nosuid,noexec,nodiratime,size=25M,mode=0755   0 0

and picking through everything that might write to the logs to make it 
send data to the ramdisk...I though that I had included that in this 
guide, but looks like I didnt,. E.g. Apache log files go to the ram disk


ls -l /var/ramlog
total 944
-rw-r----- 1 root adm  119044 Aug  4 10:55 auth.log
-rw-r----- 1 root adm   55711 Aug  1 23:59 auth.log.1
-rw-r----- 1 root adm  118243 Aug  4 10:47 daemon.log
-rw-r----- 1 root adm   86611 Aug  2 00:00 daemon.log.1
-rw-r----- 1 root adm       0 Aug  2 00:00 debug
-rw-r----- 1 root adm    3111 Jul 31 20:41 debug.1
-rw-r----- 1 root adm     241 Aug  4 00:00 error.log
-rw-r----- 1 root adm     528 Aug  4 00:00 error.log.1
-rw-r----- 1 root adm   81192 Aug  3 00:00 error.log.2.gz
-rw-r----- 1 root adm     446 Aug  2 00:00 error.log.3.gz
-rw-r--r-- 1 root root    347 Aug  1 00:00 error.log.4.gz
-rw-r----- 1 root adm       0 Aug  2 00:00 kern.log
-rw-r----- 1 root adm   31371 Jul 31 20:40 kern.log.1
-rw-r----- 1 root adm    5111 Aug  2 13:02 mail.info
-rw-r----- 1 root adm   14189 Aug  1 23:02 mail.info.1
-rw-r----- 1 root adm    5111 Aug  2 13:02 mail.log
-rw-r----- 1 root adm   14189 Aug  1 23:02 mail.log.1
-rw-r----- 1 root adm     159 Aug  2 00:10 messages
-rw-r----- 1 root adm   30557 Jul 31 20:40 messages.1
-rw-r----- 1 root adm  190719 Aug  4 10:55 syslog
-rw-r----- 1 root adm  163421 Aug  2 00:00 syslog.1


Its not 100% complete, but its very close

I`ve still got data going to /var/log that I ought to symlink to files 
in /var/ramlog

ls -l /var/log
total 288
-rw-r--r-- 1 root root    653 Sep  6  2023 alternatives.log
drwxr-xr-x 2 root root   4096 Nov 18  2025 apt
-rw-rw---- 1 root utmp   8832 Jun 10 12:00 btmp
-rw-r--r-- 1 root root      0 Nov 19  2025 dpkg.log
-rw-r--r-- 1 root root   2400 Nov 18  2025 dpkg.log.1
-rw-r--r-- 1 root root    464 Oct 16  2025 dpkg.log.2.gz
-rw-r--r-- 1 root root    778 Sep  6  2023 dpkg.log.3.gz
-rw-r--r-- 1 root root    584 Aug 11  2023 dpkg.log.4.gz
-rw-rw-r-- 1 root utmp 292292 Aug  4 10:47 lastlog
drwx------ 2 root root   4096 May  3  2023 private
drwxr-xr-x 4 root root   4096 Aug  4  2023 runit
drwxr-xr-x 2 root root   4096 Feb  2  2021 sysstat
-rw-rw-r-- 1 root utmp 230016 Aug  4 10:47 wtmp


... lastlog and wtmp. I dont mind upgrade history being there tho
A lazy way might be to just mount the ramdisk on /var/log, but I wasn`t 
sure what I wanted volatile and what needed to be written to the SD card

To date this has been utterly reliable for nearly 3 years now. Always 
reboots after a power cut.

In practice various (Pi PICO W) units talk to it via its wifi TCP/IP 
connection - thermostats, the oil sensor.. and it controls the central 
heating system via some mains relays. Information and configuration is 
via a custom web interface.

If I wanted to store a lot of changing data I would (probably) NFS mount 
the house server and stream data to that instead of locally. Or write 
some proprietary network code.



-- 
Microsoft : the best reason to go to Linux that ever existed.


--- PyGate Linux v1.5.19
 * Origin: Dragon`s Lair, PyGate NNTP<>Fido Gate (3:633/10)
SEEN-BY: 19/10 50/109 153/757 218/840 840 220/70
221/1 6 360 226/17 100
SEEN-BY: 229/426 240/1120 267/800 301/1 113 812
310/31 335/364 341/66 463/68
SEEN-BY: 550/278 633/10 20 280 281 416 418 420
422 509 2744 712/848 770/1 3
SEEN-BY: 770/100 340 772/210 220 230 5001/100
5019/40 5020/715 848 1042 1146
SEEN-BY: 5020/4441 12000 5023/24 5030/49 722 1081
1474 5051/44 5075/128
@PATH: 633/10 280 770/1 218/840 221/6 301/1
5020/1042 4441 715



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх