- RBERRYPI ---------------- < Пред. | След. > -- < @ > -- < Сообщ. > -- < Эхи > --
 Nп/п : 23 из 100
 От   : Ian                                 3:633/10          05 авг 26 10:30:01
 К    : All                                                   05 авг 26 14:45:05
 Тема : Re: Are Pi Zeros more fussy about SD cards than other Pis?
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 3:633/10 88843049
@REPLY: 3:633/10 57905458
@PID: PyGate 1.5.19
@TID: PyGate/Linux 1.5.19
@NOTE: slrn/1.0.3 (Linux)
@CHRS: ASCII 1
@TZUTC: 1100
${send-direct-email-to-news1021-at-jusme-dot-com-if-you-must}@jusme.com
n> @REPLYTO: 3:633/10 UUCP
send-direct-email-to-news1021-at-jusme-dot-com-i@vm46.home.ju
sme.com>
On 2026-08-04, Chris Green <cl@isbd.net> 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.

Wot I do:

Replace /sbin/init with a shell script that sets up the minimal necessary
for the application. That script runs with the root filesystem mounted
read-only, so the SD card is never written to in noral operation. To
modify the config:

  mount -o remount,rw /dev/root /

It also means you can safely "pull the plug" at any time without risk of
corruption (useful for PoE devices).


Here`s an example for debian 9.4 (stretch):

-----------------------------------------------------------------------
#!/bin/bash

clear
echo "Running ${0}..."


#
# Config...
#

source /etc/ro-config

export OUR_BC="${OUR_IP%.*}.255"
export OUR_GW="${OUR_IP%.*}.1"


#
# Need to set these so we can prime PS1 for bash...
# (see nonsense in /etc/bash.bashrc)...
#

export SUDO_USER=0
export SUDO_PS1="-"


#
# Mount tmpfs filesystems on /run and /tmp,
# as these need to be rw...
#

mount -t tmpfs -o size=256m tmpfs /run
mount -t tmpfs -o size=10m tmpfs /tmp

mkdir /run/lock
mkdir /run/log


#
# Need /dev/pts for ssh...
#

mkdir /dev/pts
mount -t devpts devpts /dev/pts


#
# Need loopback...
#

ifconfig lo up


#
# Need /proc...
#

mount -t proc none /proc


#
# Pop a shell here while we set up the network...
#

#PS1="TEMP-SHELL% " /bin/bash 


#
# Set host name and domain name...
#

hostname "${OUR_HOSTNAME}"
domainname "${OUR_HOSTNAME#*.}"


#
# If wifi, set up the wireless interface...
#

[ "${WIRED}" != "1" ] && /ro/init-wifi


#
# Wait for interface to appear before
# configuring it...
#

while [ ! -d "/proc/sys/net/ipv4/conf/${OUR_IF}/" ]
do
  echo "Waiting for interface "${OUR_IF}"..."
  sleep 1
done


#
# Bring the interface up...
#

ip link set "${OUR_IF}" up


#
# Check if the MAC address matches the config. If not, don`t
# bring up the network, just pop up a shell to allow the config
# to be updated (allows cloning of the image)...
#

real_eth="$(ip addr list ${OUR_IF} | awk `/link/ether/ {print $2}`)"

if [ "${real_eth^^}" != "${OUR_ETH^^}" ]
then
    echo "This MAC address (${real_eth^^}) doesn`t match config (${OUR_ETH^^})"
    echo ""
    echo "Please edit config and reboot..."
    echo ""

    cd /ro
    ./rw

   PS1="RW-SHELL \\h:\\w# " /bin/bash 

   reboot -f
fi


#
# Set the IP address and default route...
#

echo "Setting IP address for ${OUR_IF}: ${OUR_IP}/24, gw: ${OUR_GW}"

ip addr add "${OUR_IP}/24" brd "${OUR_BC}" dev "${OUR_IF}"
ip route add 0/0 via "${OUR_GW}"


#
# Wait for network, check by pinging our default gateway...
#

while ! ping -c 1 -q -w 1 "${OUR_GW}" > /dev/null 2>&1
do
    echo "Waiting for network, ping gw (${OUR_GW})..."
    sleep 1
done


#
# Pop up a shell here before we start the applications
# while debugging...
#

#PS1="TEMP-SHELL% " /bin/bash


#
# Start ntpd to get the time...
#

echo "Starting ntpd..."

/usr/sbin/ntpd -g

echo "Waiting for time sync..."
ntp-wait -n 30 -s 1
date


#
# Start sshd
#

echo "Starting sshd..."

mkdir /run/sshd
/usr/sbin/sshd


#
# Now start application screen sessions...
#

echo "Starting applications..."

cd /ro

./start-screens


#
# Shell for testing...
#

while true
do
    PS1="RO-SHELL \\h:\\w# " /bin/bash
done


#
 # We can`t exit from init (causes kernel panic), so force a reboot
if we get here...
#

reboot -f

-----------------------------------------------------------------------


Wifi requires some kernel modules, this is init-wifi:

-----------------------------------------------------------------------
#!/bin/bash

#
# Start wifi...
#

echo "Loading modules for WiFi..."

kernel="$(uname -r)"

for module in   net/rfkill/rfkill.ko 
                net/wireless/cfg80211.ko 
                drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko 
                drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko 
                drivers/input/touchscreen/rpi-ft5406.ko 
                drivers/input/evdev.ko
do
    insmod /lib/modules/${kernel}/kernel/${module}
done 

echo "Starting wpa_supplicant..."

find /usr > /dev/null  # Generate some entropy

/sbin/wpa_supplicant -B -dd -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 

-----------------------------------------------------------------------



-- 
Ian

"Tamahome!!!" - "Miaka!!!"

--- 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    
                                                                                
В этой области больше нет сообщений.

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