Help on saving sdcard image?

6 posts
by AdrianH » Thu Jun 28, 2012 10:23 pm
I have been using linux for a little while but only as a desktop user to do away with Windows. Hope to use the raspberry pi to learn more about linux and get my 10 year old into thinking more of PC's then just games.

Anyway. I bought a new Ultra SD Scandisk card 8 GB etc. Picked Debian Squeeze, went through the install and resize procedure as listed on the wiki, booted up the device then enabled ssh and installed xrdp, provided a root password. I ran apt-get update and also tried to use apt-get to install fswebcam and aptitude-gtk. I started to notice errors such as missing paths and other messages I should have saved or written down.

So once again to ensure I have a good working system I have just re-installed the SD card and got back to the stage before using 'apt-get update'.

What I would like to know is how can I save the image from the card on to my desktop PC as pi8gb.img. That way I could save time to get back to a good install when ever I screw it up?

Posts: 32
Joined: Wed Jun 27, 2012 7:43 pm
by grumpyoldgit » Thu Jun 28, 2012 10:40 pm
You effectively reverse the dd commands.

Assuming your SD card is recognised as SDD, here is one I did earlier after I expanded my Debian image and made a few changes.

sudo dd if=/home/bob/pi/debian_exp.img of=/dev/sdd bs=1M

To reverse the command and give it a new name

sudo dd if=/dev/sdd of=/home/bob/pi/newimage.img bs=1M

Obviously it is important to get the location of that SD card correctly identified.
User avatar
Posts: 1458
Joined: Thu Jan 05, 2012 12:20 pm
by AdrianH » Thu Jun 28, 2012 10:57 pm
Thanks Bob if that is your name, better then grumpyoldgit!

I should have thought of that myself, duh.

Just going through the process and will check with sha1sum of both the sd card which on my pc is /dev/sdb and my generated .img file that they both match and will then compress to save some space.


Posts: 32
Joined: Wed Jun 27, 2012 7:43 pm
by summers » Fri Jun 29, 2012 9:22 am
One the size of the partiation has been increased on the SD card, a DD of the raw image will give rather a large file. If you want to save some space, instead just take a copy of the files, so something like:

cd /path/to/root
tar cf ../debian.tar .

then probably compress the result

bzip2 debian.tar

To extract do reverse:

cd /path/to/root
bunzip2 -c ../debian.tar.bz2 | tar xf -

That should save some space. also look at xz compression if you want very small images.
Posts: 58
Joined: Mon Jan 30, 2012 4:27 pm
by pjc123 » Fri Jun 29, 2012 11:31 am
Did you use Win32 Disk Imager per the Wiki?

Instead of doing a "Write" to write data in a 'Image File' to 'Device'

just do a "Read" to write data on 'Device' to 'Image File'
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm
by SN » Fri Jun 29, 2012 12:10 pm
the OP is on a Linux Desktop not Windoze
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?
User avatar
Posts: 1008
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK