Notes on setting up Porteus v5.0

Aim: install a lightweight Linux onto a bootable USB. Boot Linux computer using Porteus USB (sdb1) instead of the Ubuntu server on the HDD (sda1,sda2). When in Porteus, use tools to completely backup the Linux computer's Ubuntu installation (sda1,sda2).
Requirements: Linux must boot from USB, be able to access the existing partitions (/dev/sda1,/dev/sda2), must have utilities installed: dd, gzip. Must be able to save the copied partition information to either (a) the USB, or (b) a cifs (SMB) or nfs network share.

##################
### PuTTY
# Windows app to connect to your server via secure sockets SSH
# https://www.putty.org

# Download Ubuntu ISO
# Make a bootable USB stick using Rufus on a windows computer
# When installing Ubuntu don't tick everything, you can apt install it later
### Porteus
# Portable Linux
# http://www.porteus.org
# Porteus-XFCE-v5.0rc1-x86_64.iso

# Negatives:
# NFS not properly working (v5.0)
# nano/pico not installed
# no apt-get
# stopping / starting services?
# not peristent without moderate effort

### Rufus
# Write the ISO to a USB for booting
# https://rufus.ie/

### username password:
# guest guest
# root toor

### Persistence
# By default, Porteus will boot fresh, no changes you made will be saved,
# including no files, no system, no installs, etc. Absolutely nothing is saved.
# save files = files remain after bootup
####
# Create a file to save persistent data file
# Applications > System > Porteus Save File Manager
# - max 4Gig changes data file
####
# Update config to make use of the file created by above process
vi /mnt/sdb1/boot/syslinux/porteus.cfg
#--- File: /mnt/sdb1/boot/syslinux/porteus.cfg
LABEL GRAPHICAL
MENU LABEL Graphics mode
KERNEL /boot/syslinux/vmlinuz
INITRD /boot/syslinux/initrd.xz
APPEND changes=EXIT:/mnt/sdb1/porteussave.dat
TEXT HELP
    Run Porteus the best way we can.
    Changes saved on exit - Persist!
ENDTEXT
#--- END File

### CIFS
# Connect to SMB shares
mkdir /mnt/nuc
mount -t cifs //192.168.0.222/nuc /mnt/nuc -o username=simon

### Backup
# Src linux drives (Ubuntu) on sda1 and sda2
dd if=/dev/sda1 bs=64M | gzip --fast | dd bs=32M of=/mnt/nuc/porteus/backup-sda1.gz
dd if=/dev/sda2 bs=64M | gzip --fast | dd bs=32M of=/mnt/nuc/porteus/backup-sda2.gz
# Note my 240Gig SSD claims to have used 20Gig, generates 3.85Gig .gz file

### Restore
dd /mnt/nuc/porteus/backup-sda1.gz bs=32M | gzip --decompress | dd bs=64M of=/dev/sda1
dd /mnt/nuc/porteus/backup-sda2.gz bs=32M | gzip --decompress | dd bs=64M of=/dev/sda2

# Other
# Porteus Linux: A portable Linux with a difference
# The 8 Smallest Linux Distros That Are Lightweight and Need Almost No Space