Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3546

Raspberry Pi OS • Re: Pishrink don't work on Bookworm ?!

$
0
0
If pishrink isn't working for you, sdm can also shrink IMG files.

Here's some output comparing sdm --shrink and pishrink.sh on copies of the same IMG:

Code:

# Shrink the IMG using sdmpw/ssdy/work$ sudo sdm --shrink 2024-11-19-raspios-bookworm-arm64-lite.img * Start shrink on IMG '2024-11-19-raspios-bookworm-arm64-lite.img'> Check the file systemrootfs: 112715/326032 files (0.2% non-contiguous), 1085369/1327104 blocksresize2fs 1.47.0 (5-Feb-2023)> Shrink the root file system from 1327104 (5.4GB, 5.1GiB) to 1118056 4096-byte blocks (4.6GB, 4.3GiB)resize2fs 1.47.0 (5-Feb-2023)Resizing the filesystem on /dev/loop0 to 1118056 (4k) blocks.Begin pass 2 (max = 116422)Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBegin pass 3 (max = 41)Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXThe filesystem on /dev/loop0 is now 1118056 (4k) blocks long.% Ignore Warning about shrinking a partition may cause data lossWarning: Shrinking a partition can cause data loss, are you sure you want to continue?Yes/No? Yes                                                               > Shrink the image by truncating to 5120622592 (5.1GB, 4.8GiB)* Shrink complete  IMG '2024-11-19-raspios-bookworm-arm64-lite.img' was (6.0GB, 5.6GiB) now (5.1GB, 4.8GiB)-rw-r--r-- 1 root root 5120622592 Mar 15 12:10 2024-11-19-raspios-bookworm-arm64-lite.img# Shrink the IMG using pishrink.shpw/ssdy/work$ rm -f 2024-11-19-raspios-bookworm-arm64-lite.img pw/ssdy/work$ cp wlite/2024-11-19-raspios-bookworm-arm64-lite.img .pw/ssdy/work$ sudo pishrink.sh -n 2024-11-19-raspios-bookworm-arm64-lite.img PiShrink v24.10.23 - https://github.com/Drewsif/PiShrinkpishrink.sh: Gathering datapishrink.sh: An existing /etc/rc.local was not found, autoexpand may fail...grep: /tmp/tmp.BwLzInL2Fm/etc/rc.local: No such file or directoryCreating new /etc/rc.localpishrink.sh: Checking filesystemrootfs: 112716/326032 files (0.2% non-contiguous), 1085370/1327104 blocksresize2fs 1.47.0 (5-Feb-2023)pishrink.sh: Shrinking filesystemresize2fs 1.47.0 (5-Feb-2023)Resizing the filesystem on /dev/loop0 to 1123057 (4k) blocks.Begin pass 2 (max = 114372)Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBegin pass 3 (max = 41)Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXThe filesystem on /dev/loop0 is now 1123057 (4k) blocks long.pishrink.sh: Zeroing any free space leftpishrink.sh: Zeroed 143Mpishrink.sh: Shrinking partitionpishrink.sh: Truncating imagepishrink.sh: Shrunk 2024-11-19-raspios-bookworm-arm64-lite.img from 5.6G to 4.8G-rw-r--r-- 1 root root 5141107200 Mar 15 12:12 2024-11-19-raspios-bookworm-arm64-lite.img
sdm does not enable autoexpand nor zero freed space, but these would be considered on request.

Statistics: Posted by bls — Sat Mar 15, 2025 8:00 pm



Viewing all articles
Browse latest Browse all 3546

Trending Articles