Shrink .img file of PI SD Card for Feeders

Hello, need a bit of help. I installed my feeders on a 32gb card and imaged it with win32diskimager, but have trouble with the size on new SD cards I have due to the size not fitting.

So I have been following this Shrink guide, but the img file is not mounting in gparted for some reason.

Has anyone had experience in shrinking .img files to a smaller size to ensure that any SD card (over the image size) wont be a problem with writing the image to it should the need arise.

I did resizing by GParted of Debian-10 amd64 installed on my Windows 10 computer through Oracle Virtual Machine.

I insert the microSD card into USB card reader, slip card reader into USB posrt of Windows PC, fire up Debian 10, start GParted, and resize the micoSD card’s root partition.

However shrinking microSD partition using GParted is NOT recommended. Please see @obj 's post quoted below

Continuing the discussion from How I created a 4Gb backup from a 16Gb microSD card:

Thanks @abcd567 I may have to redo the feeder from scratch on a 16gb card I have and save that as an image, least that way it should fit on any 32gb card.

I was hoping to avoid that and some how resize the img file I have stored on my pc, as I have tried 4 different 32gb cards I have and it won’t fit on any of them as it’s 31.2gb and win32 came up with sector size error on all of them.

You may try Windows Graphical tool to shrink the partion by plugging into Windows PC, the USB card reader with your 32 GB card with RaspberryPi OS.

Are you sure they’re not fakes… fake cards report larger size than they are. Standard windows f32 use won’t notice until its full. Writing sector by sector will.

Only way to confirm is run something that does sector counts. Like h2test

Or are they a different class/layout… Larger should go on fine I’d have expected

Well they range from 28.9gb to 31.1gb

2 are Kingston, 1 is PNY and one SanDisk. 3 are class 10 and the PNY is a class 4

I’ve seen a 2Gb USB drive inside a rather empty ‘ssd’ caddy, with firmware flash to report 300Gb. Until you tried to write more than 2Gb.

The reported size doesn’t mean a lot these days without a sector recount. Especially if they’re ‘too cheap to be competitive’ :slight_smile:

Anyway I misread as if you were writing a 32 image onto new 64s. Not that you are trying 32 to 32. So yes, redoing on something smaller would be ideal. Expanding to fit is easy. Locking partitions in the base image, not so much.

You might want to take a look at rpi-clone. First hit when I searched with duckduckgo. It’s on github from billw2/rpi-clone. Not sure if the direct link will post here: GitHub - billw2/rpi-clone: A shell script to clone a booted disk.

I’ve used it quite a bit. Allows you to make a new image of the running pi onto a thumb drive. I routinely copy my 8 or 16 GB SD card onto a 4 GB thumb drive. It will warn you if there is too much data to fit on the thumb drive you have inserted. Saves me a lot of space on the external hard drive where I store images.

When you create a new sd card, first thing to do once it’s running on the pi, is to go to the raspi-config and under Advanced, Expand File system so you then have all the space on the SD card available. Otherwise your 32 GB card is running like it only has the 4 GB that the image was.

I used to be frustrated with the same problem, where the original SD card was just slightly too big for the “same” size card I tried to copy the image onto. This should help.

1 Like

 

JULY 2020

Cloning Booted RPi’s microSD card on Windows PC through Network

 

 

 

I managed to find a post on a website where you boot up the image you want to clone then use gparted to reduce the partition size and dd to copy image to a usb drive, then pi shrink to reduce it into a img.gz file so now have 2 images that are 850mb each compressed and work perfect when imaging to SD using the RPI image writing app in Windows.

It will be very kind of you, and helpful to other members if you post the link to the post you have found.

Yeah @abcd567 this is the one I followed back up raspberry SD as Image

Only works I think if you have raspberry installed, lite or full OS. Not to sure about piaware standalone image though.

:+1: :+1: :+1:

Thank you!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.