Re: Node Update/Upgrade


Nosey Nick VA3NNW
 

Not sure anyone answered this... Teton Amateur Radio Repeater
Association (TARRA) wrote:
Without a whole lot of trouble, can it be set up to copy the whole
IRLP program (and OS) to ram on start up and then just copy the files
that have been changed back to the SD card before shut down? Probably
a good idea to copy the log files to the SD card on a regular basis
while it running just to keep from losing them. There may be some
other files that need saved as well, but not sure which ones they
would be. Just trying to move operations away from running on the SD
card so much.
sdcard READS are not a problem, and will quickly be cached in RAM for
aaaaaaages after the first read anyway.

(That said, some filesystems also WRITE a "last accessed" date each time
you READ a file, but I see my own pirlp node has deliberately disabled
this with a "noatime" mount option, I think I have to assume that's the
default, feel free to check /etc/fstab for "[some device] /  ext4 
defaults,noatime")

sdcard WRITES can be a problem. Especially if you have a really old
sdcard that doesn't do wear-levelling (hard to find these days), and/or
if you have a swapfile on the sdcard (irlp doesn't) or something else
that's written A LOT, perhaps a frequently-sync'd database? I doubt it's
a problem, and 4GB (or bigger) sdcards are so cheap they pretty much
give 'em away with your breakfast cereal... but if you wanna find out:

sudo apt-get install inotify-tools
sudo inotifywait -e modify -mr /var/log ~repeater/
# feel free to add any other paths you think might be likely to have
writes, but "/" is probably too many files to watch, so be sensible.

The above will (install a tool to, and then) show you each time a file
is modified.

If you're honestly still worried, look up "Linux Overlay Filesystem"
and/or see https://yagrebu.net/unix/rpi-overlay.md for a real rpi
example. The important parts in the script are:

[arranging for your "real root" to be on /lower and then...]
mount -t tmpfs tmpfs /upper ;  mkdir /upper/data /upper/work
mount -t overlay
-olowerdir=/lower,upperdir=/upper/data,workdir=/upper/work overlay
${rootmnt}

This makes a RAM drive for a "top layer" to be mounted over the top of
your root filesystem. WRITES go to the top layer (IE the tmpfs in RAM),
READS (of files that aren't in the top layer) will pass through
(although will, as above, be cached for aaaaages after the first read).

I'll leave it as an exercise for the reader what files you want to keep,
how, and how often, but you should be able to see your changes written
to /upper/data/ and you'll want to get them into the right place in
/lower/, except /lower/ is (by design) mounted read-only and will need
to be made writeable just before you want to write to it. You'll also
have to think a bit about how to update your system (apt-get update ;
apt-get upgrade ; etc) if THOSE (infrequent but big) writes are now all
going to go to RAM.

Personally, I'm slightly surprised to find my /tmp/ isn't in tmpfs (WAT?
might fix that) and my /var/log/auth.log is hit a BIT more often than I
expected by (unsuccessful) SSH dictionary-attackers, but not enough that
I'd worry about the inconvenience of the overlayfs stuff.

Nick

--
"Nosey" Nick Waterman, VA3NNW/G7RZQ, K2 #5209.
use Std::Disclaimer; sig@...
Meets quality standards: It compiles without errors.

Join IRLP@irlp.groups.io to automatically receive all group messages.