Related Questions
- How to save disk space for raw disk images
- How to shrink raw disk image to actual space used
- How to compress raw disk image to actual space used
Note: This method is only for Linux Users
Step 1 (Clone or Download bash Script)
https://github.com/Drewsif/PiShrinkMake your pi images smaller!
ssp@ssp-pc:~/Downloads$
=> git clone https://github.com/Drewsif/PiShrink.git
Cloning into 'PiShrink'...
remote: Counting objects: 72, done.
remote: Total 72 (delta 0), reused 0 (delta 0), pack-reused 72
Unpacking objects: 100% (72/72), done.
Checking connectivity... done.
Lets Check Syntax of Command pishrink.sh
ssp@ssp-pc:~/Downloads$
=> cd PiShrink/
ssp@ssp-pc:~/Downloads/PiShrink$
=> ls
LICENSE pishrink.sh README.md
ssp@ssp-pc:~/Downloads/PiShrink$
=> ./pishrink.sh
Usage: ./pishrink.sh [-s] imagefile.img [newimagefile.img]
You need sudo
permission to Use this Script
ssp@ssp-pc:~/Downloads/PiShrink$
=> ./pishrink.sh -s /media/ssp/Linux_DATA/raspberry-pi.img /media/ssp/Linux_DATA/raspberry-pi.min.img
ERROR: You need to be running as root.
ssp@ssp-pc:~/Downloads/PiShrink$
=> sudo ./pishrink.sh -s /media/ssp/Linux_DATA/raspberry-pi.img /media/ssp/Linux_DATA/raspberry-pi.min.img
Copying /media/ssp/Linux_DATA/raspberry-pi.img to /media/ssp/Linux_DATA/raspberry-pi.min.img...
Skipping autoexpanding process...
e2fsck 1.42.9 (4-Feb-2014)
/dev/loop0: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/loop0: 152923/480496 files (0.1% non-contiguous), 1059531/1924096 blocks
resize2fs 1.42.9 (4-Feb-2014)
resize2fs 1.42.9 (4-Feb-2014)
Resizing the filesystem on /dev/loop0 to 1066992 (4k) blocks.
Begin pass 2 (max = 98529)
Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 59)
Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 13514)
Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop0 is now 1066992 blocks long.
Shrunk /media/ssp/Linux_DATA/raspberry-pi.min.img from 7.5G to 4.2G
Result
As you can see that Actual Size of Disk Image was about8 GB
and now it is about 4 GB
, So this script is really useful When you want to save disk space and now you can easily restore raw disk image fatster (in short time). After that You can expand file system to use all available disk space.
No comments :
Post a Comment