Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Advanced: Clone a working Moabian image (step 2)

Scott Stanfield (MSFT) edited this page Sep 5, 2022 · 5 revisions

High-level

  1. clear bash history.
  2. eject card; block copy the SD card (20 min. for 16 GB microSD).
  3. use pishrink.sh on the raw image in Linux to create the final, burnable img.

First step, setup Moabian per Install Moabian v3.0 from scratch.

Then log in to remove history and shut down.

first two lines from https://github.com/Drewsif/PiShrink/blob/master/pishrink.sh#L319 but skipping /var/log/nginx folder and sshd keys

sudo rm -rvf /var/cache/apt/archives/* /var/lib/dhcpcd5/* /var/tmp/* /tmp/*
sudo rm -vf /var/log/*
rm -f $HISTFILE && unset HISTFILE && 
cat /dev/null > ~/.bash_history && history -c && sudo shutdown now

DEPRECATED

https://github.com/Drewsif/PiShrink

brew install dcfldd pigz
diskutil list                              # locate the microSD /dev/disk4 
sudo dcfldd if=/dev/disk2 of=moabian.img bs=4k  # binary copy of the microSD card to local file
pigz moabian.img                           # parallel compression of a 16GB or 32GB file
scp moabian.img moana:sdcard               # move to a Linux machine for pishrink.sh
ssh moana
sudo ./pishrink.sh -v -a -p -Z moabian.img

USE THIS (using Docker for pishrink)

diskutil list
sudo dcfldd if=/dev/disk4 of=moabian.img bs=4k
docker run --platform=linux/amd64 --privileged=true --rm --volume $(pwd):/workdir:rw mgomesborges/pishrink pishrink -v moabian.img v3.img
pigz v3.img

helpful raspbian / debian commands

lsmod       # show installed linux modules
uname -r    # show linux version (5.4.51-v7l+ GNU?Linux)