tampe125
Posts: 10
Joined: Sun Jan 20, 2013 10:21 am

Backup image doesn't fit the new SD card

Tue Apr 30, 2019 8:20 am

Hello everyone,

I have a problem that is really bugging me.
I have made a backup of my SD card (16Gb) using dd. Then I wanted to copy the same exact setup to a new Raspberry.
So I got a new SD card (16Gb) and dumped data back using dd

and...

No space left on device

sigh, I knew it could happen, so I decided to resize the image chopping few bytes (there's plenty of free space).
I mounted the image on dev/loop and used gparted to shrink the filesystem, so I have about 200-300Mb of unallocated space.
Finally I chopped off those bytes using truncate:

truncate -s -100Mb myimage.img

I put everything back but, my Pi complains about the inode count. The GUI starts (I added a touchscreen), but it seems the Wi-Fi is not found and several services I created with systemd are not firing. So basically it's borked.

Any suggestions on how I can create small images (let's say 10Gb), so I can easily restore them in any card?

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Backup image doesn't fit the new SD card

Tue Apr 30, 2019 8:33 am

Any suggestions on how I can create small images (let's say 10Gb), so I can easily restore them in any card?
If you are using the Raspberry Pi Foundation Raspbian Operating System, consider using their SDCardCopier utility.

(It doesn't work with images, but it does produce the smallest backup possible without using compression.)

tampe125
Posts: 10
Joined: Sun Jan 20, 2013 10:21 am

Re: Backup image doesn't fit the new SD card

Tue Apr 30, 2019 8:39 am

I just owe you a truckload of beer!

Return to “Advanced users”