atux_null
Posts: 131
Joined: Thu Jun 21, 2012 1:58 pm

create image with dd

Wed May 27, 2015 1:54 pm

hello everyone. i do have raspberry and i do want to keep images of the SD cards with all the settings.
the problem is that dd creates files with the full size of the SD card eg 4GB. is there a way to get a full img backup but keep the file in small size?

troombatzia
Posts: 501
Joined: Fri Jun 29, 2012 4:27 pm

Re: create image with dd

Wed May 27, 2015 2:31 pm

In a thread in the forum I found this, but I never tried:

http://sirlagz.net/2013/03/10/script-au ... downsizer/
English isn’t my first language, so please excuse any mistakes.

troombatzia
Posts: 501
Joined: Fri Jun 29, 2012 4:27 pm

Re: create image with dd

Wed May 27, 2015 2:31 pm

Here's the entire thread:

viewtopic.php?f=91&t=58069
English isn’t my first language, so please excuse any mistakes.

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

Re: create image with dd

Wed May 27, 2015 4:31 pm

As with the previous suggestion, this is untried by me, but might be what you need:

viewtopic.php?f=66&t=107118

eltrasimaco
Posts: 20
Joined: Fri Apr 25, 2014 10:50 am

Re: create image with dd

Wed May 27, 2015 8:19 pm

I had a similar problem, one image and several SD with various sizes. After several unsuccesfull tries, I could accomplish it with a debian laptop with SD port and this script:

https://github.com/billw2/rpi-clone

I think its quite understandable and easy to custom, I made some minor mods in it

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2848
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: create image with dd

Wed May 27, 2015 9:11 pm

troombatzia wrote:In a thread in the forum I found this, but I never tried:

http://sirlagz.net/2013/03/10/script-au ... downsizer/

I have used it and still do (although not for a few months). I use it on a Ubuntu laptop and it works an absolute treat.
Highly recommended. It's a shell script so you can "pop the hood" and have a look at what it's doing too. :)
Alex Eames RasPi.TV, RasP.iO

shadowofdarkness
Posts: 35
Joined: Fri Jan 11, 2013 9:54 pm

Re: create image with dd

Thu May 28, 2015 12:44 am

You could just compress the image file. For best results fill the drive with a temporary zeroed out file (compresses great) to get rid of any deleted files data (since deleting a file doesn't get rid of the data)
then delete the temporary file.

You will end up with a full image file just the size of the data and all empty space compressed to near nothing.

dd if=/dev/zero of=tempfile
rm tempfile
dd if=/dev/XXX | bzip2 -9 > filename.img.bz2

You can do the tempfile on either the Pi or your Linux computer (I assume your using Linux since you're imaging with dd

Return to “General discussion”