omega1
Posts: 113
Joined: Mon Jul 02, 2012 3:10 pm
Location: UK
Contact: Website

SD card backup too big to restore?

Tue Mar 19, 2013 6:19 pm

Hi all,

I made a backup of my 4Gb SD card using Win32 Disk Imager and I tried to clone another 4Gb card by writing my .img to it, and it says that it wont fit!

It says 'Not enough space on disk: Size 7862272 sectors Available 7710720 sectors. Sector size:512

1) Could it be they are slightly different SD cards and have slightly less space available?
2) How can I make the .img file smaller as not all of the reported 3.9Gb of the backed yp file are used on my Pi.

Thanks in advance!
Get your Pi from here! http://bit.ly/18blVup

forumisto
Posts: 386
Joined: Fri Mar 16, 2012 8:41 am

Re: SD card backup too big to restore?

Tue Mar 19, 2013 7:04 pm

It is very possible that full capacity of two teorically equals card are a bite different.

maybe, you can resize the original partition with gparted

omega1
Posts: 113
Joined: Mon Jul 02, 2012 3:10 pm
Location: UK
Contact: Website

Re: SD card backup too big to restore?

Tue Mar 19, 2013 7:25 pm

Hi, thanks for the reply...

Good point... Thank you.

I think my ideal solution would be to find out how to reduce the .img file.

Is it possible to read/modify an .img file? If so, how?

Thanks
Get your Pi from here! http://bit.ly/18blVup

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: SD card backup too big to restore?

Fri Mar 22, 2013 2:04 am

If you're willing to try linux on your computer, you can use my script to automatically downsize the image so you can image it onto another SD card.
Script can be found here -> http://sirlagz.net/2013/03/10/script-au ... downsizer/
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

timmoore46
Posts: 266
Joined: Tue Jul 17, 2012 4:36 pm

Re: SD card backup too big to restore?

Fri Mar 22, 2013 5:26 am

Can I run this on the RPi ?

:D :D

Tim

TheQuestor
Posts: 80
Joined: Wed Nov 28, 2012 9:15 am

Re: SD card backup too big to restore?

Fri Mar 22, 2013 6:43 am

if you don't want to install Linux, just get VMware player and make a virtual machine, attach the sd card or image to it and work away.

timmoore46
Posts: 266
Joined: Tue Jul 17, 2012 4:36 pm

Re: SD card backup too big to restore?

Fri Mar 22, 2013 7:59 am

I have Ubuntu 12.04

Very stupid question:- how do I get into root ?
I tried

sudo passwd

sudo chmod a+x autosizer.sh

sudo ./autosizer 2013-02-09-wheezy-raspian.img

and got back Error: Not an image file , or file doesn't exist

I was in my 'Home' directory.

(I assume it knows all about SD cards and won't try and compress my 1TB hard drive and taking 2 days to fail ? *LOL* *LOL*)

:D :D

Tim

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: SD card backup too big to restore?

Fri Mar 22, 2013 1:55 pm

timmoore46 wrote:I have Ubuntu 12.04

Very stupid question:- how do I get into root ?
I tried

sudo passwd

sudo chmod a+x autosizer.sh

sudo ./autosizer 2013-02-09-wheezy-raspian.img

and got back Error: Not an image file , or file doesn't exist

I was in my 'Home' directory.

(I assume it knows all about SD cards and won't try and compress my 1TB hard drive and taking 2 days to fail ? *LOL* *LOL*)

:D :D

Tim
Is the 2013-02-09-wheezy-raspbian.img file in your home directory ?
This script will only resize image files themselves, so if you've backed up with dd into the image file, then you run the script on the image file itself.
It won't run itself on the running sd card just yet unfortunately.
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

timmoore46
Posts: 266
Joined: Tue Jul 17, 2012 4:36 pm

Re: SD card backup too big to restore?

Fri Mar 22, 2013 5:53 pm

Yes it was all in the home directory. I was resizing the img file I downloaded earlier today, just to test it.

The code was eactly as I wrote it in the last post.

:?

Tim

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: SD card backup too big to restore?

Fri Mar 22, 2013 6:39 pm

Easist way is to put the sd card into a linux machine and run gparted to shrink the partition by a bit. You can then re image the card. Use dd to put the image back onto the smaller card and ignore the error it gives at the end. Since the partition is within the bit it succesfully wrote it will work. If you want a 'clean solution' you could use the linux command 'truncate' to make the re partitioned image shorter and so it won't over run the size of the new card. Just don't shorten past the end of the second partition. The image is just full of null characters after the end of the second partition so losing a few doesn't matter. It not recommended you do it on a running Pi, unless you have a USB SD card reader and your'e working on the non running image in the card reader.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

omega1
Posts: 113
Joined: Mon Jul 02, 2012 3:10 pm
Location: UK
Contact: Website

Re: SD card backup too big to restore?

Sun Mar 24, 2013 9:38 am

I was actually able to resolve this bby a post I found.

My solution (as a Windows user) was to delete the latest version of Disk Imager and find (not that easy!) a previous version of Disk Imager which does not really care about sizes and quite happily just writes to the SD card regardless.

This solution worked for me.
Get your Pi from here! http://bit.ly/18blVup

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: SD card backup too big to restore?

Sun Mar 24, 2013 1:51 pm

timmoore46 wrote:Yes it was all in the home directory. I was resizing the img file I downloaded earlier today, just to test it.

The code was eactly as I wrote it in the last post.

:?

Tim
Hrm...odd.

I might have to investigate that. So that was just the default Raspbian image wasn't it ?
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

Morden
Posts: 1
Joined: Mon Feb 10, 2014 11:41 am

Re: SD card backup too big to restore?

Mon Feb 10, 2014 11:46 am

Which was the earlier version you used?

Return to “General discussion”