From 17346f5d02b40def15ad8fccb1a7c8c166e26f4c Mon Sep 17 00:00:00 2001 From: Drew Bonasera Date: Tue, 27 Aug 2019 04:15:31 -0400 Subject: [PATCH] Update docs --- README.md | 21 ++++++++++++++++----- pishrink.sh | 20 ++++++++++++-------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index aae2ec6..3d7956d 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,24 @@ + # PiShrink # PiShrink is a bash script that automatically shrink a pi image that will then resize to the max size of the SD card on boot. This will make putting the image back onto the SD card faster and the shrunk images will compress better. ## Usage ## -`sudo pishrink.sh [-sdrp] imagefile.img [newimagefile.img]` +``` +sudo pishrink.sh [-sdrpzh] imagefile.img [newimagefile.img] + -s: Skip autoexpand + -d: Debug mode on + -r: Use advanced repair options + -z: Gzip compress image after shrinking + -h: display help text +``` + +If you specify the `newimagefile.img` parameter, the script will make a copy of `imagefile.img` and work off that. You will need enough space to make a full copy of the image to use that option. + +* `-s` will skip the autoexpanding part of the process. +* `-d` will create a logfile `pishrink.log` which may help for problem analysis. +* `-r` will attempt to repair the filesystem if regular repairs fail +* `-z` will Gzip compress the image after shrinking. The `.gz` extension will be added to the filename. -If the `-s` option is given the script will skip the autoexpanding part of the process. If you specify the `newimagefile.img` parameter, the script will make a copy of `imagefile.img` and work off that. You will need enough space to make a full copy of the image to use that option. -Option `-d` will create a logfile `pishrink.log` which may help for problem analysis. -Option `-r` will try to recover a corrupted filesystem. You have to specify the `newimagefile.img` parameter and a recovery is done on a copy of the image. -Option `-p` will try to recover a corrupted filesystem in paranoia mode. You have to specify the `newimagefile.img` parameter and a recovery is done on a copy of the image. ## Prerequisites ## If you are trying to shrink a [NOOBS](https://github.com/raspberrypi/noobs) image it will likely fail. This is due to [NOOBS partitioning](https://github.com/raspberrypi/noobs/wiki/NOOBS-partitioning-explained) being significantly different than Raspbian's. Hopefully PiShrink will be able to support NOOBS in the near future. diff --git a/pishrink.sh b/pishrink.sh index 74c7fe4..ab77201 100755 --- a/pishrink.sh +++ b/pishrink.sh @@ -63,9 +63,12 @@ fi help() { local help read -r -d '' help << EOM --s: Don't expand filesystem when image is booted the first time --d: Write debug messages in a debug log file --r: Use advanced repair option +Usage: $0 [-sdrpzh] imagefile.img [newimagefile.img] + + -s: Don't expand filesystem when image is booted the first time + -d: Write debug messages in a debug log file + -r: Use advanced filesystem repair option if the normal one fails + -z: Gzip compress image after shrinking EOM echo "$help" exit -1 @@ -73,11 +76,12 @@ EOM usage() { echo "Usage: $0 [-sdrpzh] imagefile.img [newimagefile.img]" - echo "-s: Skip autoexpand" - echo "-d: Debug mode on" - echo "-r: Use advanced repair options" - echo "-z: Gzip compress image after shrinking" - echo "-h: display help text" + echo "" + echo " -s: Skip autoexpand" + echo " -d: Debug mode on" + echo " -r: Use advanced repair options" + echo " -z: Gzip compress image after shrinking" + echo " -h: display help text" exit -1 }