Update docs

This commit is contained in:
Drew Bonasera 2019-08-27 04:15:31 -04:00
parent 20ae97d2bc
commit 17346f5d02
2 changed files with 28 additions and 13 deletions

View File

@ -1,13 +1,24 @@
# PiShrink # # 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. 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 ## ## 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 ## ## 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. 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.

View File

@ -63,9 +63,12 @@ fi
help() { help() {
local help local help
read -r -d '' help << EOM read -r -d '' help << EOM
-s: Don't expand filesystem when image is booted the first time Usage: $0 [-sdrpzh] imagefile.img [newimagefile.img]
-d: Write debug messages in a debug log file
-r: Use advanced repair option -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 EOM
echo "$help" echo "$help"
exit -1 exit -1
@ -73,11 +76,12 @@ EOM
usage() { usage() {
echo "Usage: $0 [-sdrpzh] imagefile.img [newimagefile.img]" echo "Usage: $0 [-sdrpzh] imagefile.img [newimagefile.img]"
echo "-s: Skip autoexpand" echo ""
echo "-d: Debug mode on" echo " -s: Skip autoexpand"
echo "-r: Use advanced repair options" echo " -d: Debug mode on"
echo "-z: Gzip compress image after shrinking" echo " -r: Use advanced repair options"
echo "-h: display help text" echo " -z: Gzip compress image after shrinking"
echo " -h: display help text"
exit -1 exit -1
} }