This is a tool for shrinking disk images and partitions.
291
This tool will take a disk image and shrink the last partition in the image (assuming it is ext2-ish) as small as it can go, and resize the partition (and image file) accordingly. This is useful on embedded systems, especially if they have a start script to resize the last partition to the maximum size. This way you can store a smaller image, and then use it no matter what the target disk size winds up being.
Usage:
docker run --privileged -v .:/app johnnyb61820/diskshrinker YOURIMAGE.img
This assumes that you are running this from the folder which contains YOURIMAGE.img (the disk image you want to shrink). The command line has to run in privileged mode in order to manipulate the filesystem within the partition table (hence the --privileged). It maps the current directory to /app which is the working directory for the image. It then gives the argument YOURIMAGE.img as the disk image to shrink. Note that this is a DESTRUCTIVE operation, so you should only do this on a copy of your disk image.
If you are interested in the script, the actual script being run is /usr/bin/diskshrinker.sh.
Content type
Image
Digest
sha256:ef8db161d…
Size
56.5 MB
Last updated
about 2 years ago
docker pull johnnyb61820/diskshrinker