Drewsif / PiShrink

Make your pi images smaller!
MIT License
3.51k stars 645 forks source link

resulting img file not divisible by 512bytes #195

Closed ghost closed 1 month ago

ghost commented 3 years ago

After I run pishink, the resulting img file can not be used in the Raspberry Pi Imager. The error is that the img is not in 512 byte increments. I can use the image in BalenaEtcher. I guess that program is not as picky. How do I fix this so the image works in the Raspberry Pi Imager application?

Drewsif commented 3 years ago

I've never run into that issue actually. You can pad the file with anything to get it to a nice 512 byte block and that should fix it.

I'm going to leave this open to try and add it as a feature.

ghost commented 3 years ago

Dumb question, how would I pad it?

Sent from my iPad

On Jun 10, 2021, at 10:09 PM, Drew Bonasera @.***> wrote:

 I've never run into that issue actually. You can pad the file with anything to get it to a nice 512 byte block and that should fix it.

I'm going to leave this open to try and add it as a feature.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jcard0na commented 1 year ago

this worked for me:

size=$(stat -f '%z' test.img)                   
pad_size=$(( 512 - $size % 512 ))               
dd if=/dev/zero of=test.img bs=1 count=$pad_size seek=$size