Skip to main content
added 27 characters in body
Source Link

I have been successfully using a script called pishrink by Drew Bonasera ('Drewsif') to back up a headless Raspberry Pi 4 (it works for all models). It is useful because after using dd to make the image it optionally shrinks the image with resize2fs to a little above the data size, and also can optionally insert a run-once command into the image to make Raspbian expand the file system when the image is flashed to a card and used for the first time to boot a Pi. I have been making 8 GB images from a 32 GB card.

This means you could flash a smaller card than the original, provided the shrunk image size is smaller than the new card.

https://github.com/Drewsif/PiShrink

It is nice to compress the image to a zip archive (Balena Etcher can use these) but... it is painfully slow if you let the Pi hardware do the compression. As the finished image ends up in a Windows shared folder mounted on the Pi, after PiShrink has finished I usemy script uses sshpass on the Pi to command Windows (OpenSSH enabled) to run pigz (a fast command line parallel Zip tool) and can get the zip archive down to around 5.5 to 6 GB. Or you could use other methods (WinRar, Winzip, 7-zip etc).

I have been successfully using a script called pishrink by Drew Bonasera ('Drewsif') to back up a headless Raspberry Pi 4 (it works for all models). It is useful because after using dd to make the image it optionally shrinks the image with resize2fs to a little above the data size, and also can optionally insert a run-once command into the image to make Raspbian expand the file system when the image is flashed to a card and used for the first time to boot a Pi.

This means you could flash a smaller card than the original, provided the shrunk image size is smaller than the new card.

https://github.com/Drewsif/PiShrink

It is nice to compress the image to a zip archive (Balena Etcher can use these) but... it is painfully slow if you let the Pi hardware do the compression. As the finished image ends up in a Windows shared folder mounted on the Pi, after PiShrink has finished I use sshpass on the Pi to command Windows to run pigz (a fast command line parallel Zip tool) and can get the zip archive down to around 5.5 to 6 GB. Or you could use other methods.

I have been successfully using a script called pishrink by Drew Bonasera ('Drewsif') to back up a headless Raspberry Pi 4 (it works for all models). It is useful because after using dd to make the image it optionally shrinks the image with resize2fs to a little above the data size, and also can optionally insert a run-once command into the image to make Raspbian expand the file system when the image is flashed to a card and used for the first time to boot a Pi. I have been making 8 GB images from a 32 GB card.

This means you could flash a smaller card than the original, provided the shrunk image size is smaller than the new card.

https://github.com/Drewsif/PiShrink

It is nice to compress the image to a zip archive (Balena Etcher can use these) but... it is painfully slow if you let the Pi hardware do the compression. As the finished image ends up in a Windows shared folder mounted on the Pi, after PiShrink has finished my script uses sshpass on the Pi to command Windows (OpenSSH enabled) to run pigz (a fast command line parallel Zip tool) and can get the zip archive down to around 5.5 to 6 GB. Or you could use other methods (WinRar, Winzip, 7-zip etc).

Source Link

I have been successfully using a script called pishrink by Drew Bonasera ('Drewsif') to back up a headless Raspberry Pi 4 (it works for all models). It is useful because after using dd to make the image it optionally shrinks the image with resize2fs to a little above the data size, and also can optionally insert a run-once command into the image to make Raspbian expand the file system when the image is flashed to a card and used for the first time to boot a Pi.

This means you could flash a smaller card than the original, provided the shrunk image size is smaller than the new card.

https://github.com/Drewsif/PiShrink

It is nice to compress the image to a zip archive (Balena Etcher can use these) but... it is painfully slow if you let the Pi hardware do the compression. As the finished image ends up in a Windows shared folder mounted on the Pi, after PiShrink has finished I use sshpass on the Pi to command Windows to run pigz (a fast command line parallel Zip tool) and can get the zip archive down to around 5.5 to 6 GB. Or you could use other methods.