Yes, losing your changes can be a royal pita
rych. Been there, done that, and I don't use the /changes folder, I use a save.dat file.
So, a couple of things to take into account for changes. 1. Backup, 2. Use different approaches.
I use a save.dat file with the changes=EXIT cheatcode. In the early days it would unexpectedly overflow and corrupt the save.dat file.

But over the years changes have been made to Porteus that minimize that from occurring. When shutting down a msg is displayed indicating how full the saved changes are. If too full you can abort the save.dat being updated.

In addition a method to tweak what files are being saved has been added also.
My current save.dat is 524MB and I am about 42 full.
To save a backup of your save.dat file you can copy it to a new file name like you were thinking, although unless you plan on keeping multiple copies a simple save.bkup.dat is sufficient. In addition to saving it as save.bkup.dat you can save it as save.dat.xzm.

Yes, .xzm and it can be read in your /modules folder. The advantage of this is you can run Porteus, with your changes, in a safe, non-updatable, mode.

Great if you have visitors who access your pc on occasion.
And yes you can create a script to backup your changes, if you know what has changed when you saved a bookmark to your browser or added a add-on to your browser to block ads, or changed your power setting, etc.....

I've used that approach also and my mychanges.xzm file is 12MB.
My /etc/changes-exit.conf file.
Code: Select all
# Folders listed in this config file will be saved during reboot and shutdown when 'changes=EXIT:' cheatcode is used.
# Folders starting with '!' are omitted. This is useful if you want to save whole folder except for particular subfolder(s).
# An example is inclued in default config below: Porteus will save whole /var folder except for /var/run and /var/tmp subfolders.
# Other example: "!/home/guest/.mozilla/firefox/c3pp43bg.default/Cache" will skip saving of Firefox caches from guest account.
# Thanks to Rava for suggesting implementation of '!' exceptions in /etc/changes-exit.conf.
/bin
/etc
/home
/lib
/lib64
/opt
/root
/sbin
/usr
/var
!/var/run
!/var/tmp
!/root/.local/share/Trash/
!/root/.cache/thumbnails/normal
!/home/guest/.local/share/Trash/
!/home/guest/.cache/thumbnails/normal
!/home/guest/.cache/mozilla/firefox/ple67xm3.default-release/thumbnails/
!/home/guest/.cache/mozilla/firefox/ple67xm3.default-release/cache2/
!/home/guest/.mozilla/firefox/Crash?Reports/pending/
#/home/guest/.mozilla/firefox/ple67xm3.default-release/storage/default/
!/home/guest/.mozilla/firefox/ple67xm3.default-release/datareporting/archived
!/home/guest/.java/deployment/cache/6.0/
My save.dat backup script.
Code: Select all
#!/bin/sh
# https://forum.porteus.org/viewtopic.php?f=81&t=2866&p=20331#p20292
# https://forum.porteus.org/viewtopic.php?f=53&t=3801&start=30#p28472
# awk 'c-->0;/Booting device:/{c=1}' /var/log/porteus-livedbg
BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
FOLDER=
GUEST="$BOOTDEV/GUEST"
MODULES="$BOOTDEV/Modules"
CHANGES="$BOOTDEV/porteus/changes"
#MODSAVEDAT="$BOOTDEV/modsavedat"
if [ ! -d $CHANGES ]; then
CHANGES="$BOOTDEV/changes"
fi
if [ "$BOOTDEV" == "/mnt/isoloop" ]; then
BOOTDEV=`grep -A1 "ISO=" /var/log/porteus-livedbg`
if [ ${BOOTDEV:4:9} == "/mnt/nvme" ]; then
BOOTDEV=${BOOTDEV:4:14}
else
BOOTDEV=${BOOTDEV:4:9}
fi
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}
GUEST="$BOOTDEV/$FOLDER/Guest"
MODULES="$BOOTDEV/$FOLDER/Modules"
CHANGES="$BOOTDEV/$FOLDER/changes"
# MODSAVEDAT="$BOOTDEV/$FOLDER/modsavedat"
fi
SAVEDAT=50rc3save
DIR () {
echo "$1"
# ls -ghlst --full-time $1 | awk '{print $1 " " $2 " "$6 " " $7 " " $8 " " $9}' | more
ls -lgh --time-style long-iso $1 | awk '{print $5,$6,$4,$7}'
# http://forum.porteus.org/viewtopic.php?f=81&t=3965#p29205
}
if [ -d "/mnt/loop/home" ]; then
uloop
fi
DIR "$MODULES"
echo
DIR "$CHANGES/"
echo
echo -en "Press 1 to copy .dat to .xzm, 2 to backup the .dat file, Ctrl+C to end.\n"
read answer
if [ "$answer" == "" ]; then
echo No option selected. Bye.
sleep 3
exit
fi
if [ $answer == 1 ]; then
echo "Pls wait, copying in progress"
cp $CHANGES/$SAVEDAT.dat $MODULES/$SAVEDAT.dat.xzm
DIR "$MODULES"
fi
if [ $answer == 2 ]; then
echo "Pls wait, copying in progress"
cp $CHANGES/$SAVEDAT.dat $CHANGES/${SAVEDAT}Bkup.dat
DIR "$CHANGES"
fi
sleep 8
exit
Modify to fit your needs.
My script to check my save.dat space usage.
Code: Select all
#!/bin/sh
# Add to /etc/rc.d/rc.local_shutdown. And make rc.local_shutdown executable.
# sudo chmod +x /etc/rc.d/rc.local_shutdown
# Bogomips help: https://forum.porteus.org/viewtopic.php?f=140&t=6069&p=47591#p47589
# https://forum.porteus.org/viewtopic.php?f=140&t=6069&p=47614#p47598
# du -BM -d3 /mnt/live/memory/images/changes
# Color definitions
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Red
rst=$(tput sgr0) # Reset
function redwarning() {
echo -e $txtred "$1" $rst
}
BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
if [ "$BOOTDEV" == "/mnt/isoloop" ]; then
BOOTDEV=`grep -A1 "ISO=" /var/log/porteus-livedbg`
BOOTDEV=${BOOTDEV:4:9}
fi
if [ "$BOOTDEV" == "/mnt/nvme" ]; then
BOOTDEV=`grep -A1 "ISO=" /var/log/porteus-livedbg`
BOOTDEV=${BOOTDEV:4:14}
fi
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}
Changes=$BOOTDEV/$FOLDER/changes
if [ ! -d $Changes ]; then
Changes="$BOOTDEV/changes"
fi
#set -x;
#SAVEDAT=$(ls -g --sort=time $Changes/ | grep -A1 "^total " | tail -n1)
#SaveDat=${SAVEDAT:41}
SAVEDAT=$(ls --time=use $Changes/ | head -n1)
SaveDat=$SAVEDAT #SaveDat=50rc3save.dat # porteussave.dat
if [ -n "$1" ]; then
SaveDat=$1
fi
#set -x;
if [ -a /mnt/live/memory/images/changes ]; then
SDspace=$(df -BM --output=size,used,avail,pcent /mnt/live/memory/images/changes | tail -n1)
Changes=/mnt/live/memory/images/changes
else
if [ ! -f $Changes/$SaveDat ]; then
echo "No $Changes/$SaveDat file."
read && exit
fi
echo toor | sudo -S -u root mloop $Changes/$SaveDat &>/dev/null
SDspace=$(df -BM --output=size,used,avail,pcent /mnt/loop | tail -n1)
Changes=$Changes/$SaveDat
echo toor | sudo -S -u root uloop &>/dev/null
fi
# echo $SDspace
read size used avail percent <<< $SDspace
if [ ${percent%\%} -ge 85 ]; then
/usr/share/porteus/gtkdialog.py -p "Warning! $SaveDat file $percent full" -s "Used: $used - Free: $avail" -d err
exit
else
# https://forum.porteus.org/viewtopic.php?p=78822#p78822 - ncmprhnsbl - '/usr/share/porteus/gtkdialog.py -h' to see the usage..
/usr/share/porteus/gtkdialog.py -p "$Changes" -s "$SaveDat file $percent full - Used: $used - Free: $avail" -d info
exit
fi
# if no dialog option.
if [ ${percent%\%} -ge 85 ]; then
echo
redwarning "Warning! save.dat file $percent full. Used: $used Free: $avail"
echo
else
echo "save.dat file $percent full. Used: $used Free: $avail"
fi
sleep 5
exit
BTW I boot Porteus ISOs not installs. As such my folders are outside the ISO and on my hardrive. Such as /porteus5.0/Modules/ and /porteus5.0/Optional/.
hth