Altin
Posts: 21
Joined: Fri Aug 24, 2012 10:52 pm

dd 8Gb image onto 4Gb SD

Fri May 31, 2013 10:58 am

I have Raspbian installed on an 8Gb SD card & it only uses about 2 - 3 Gb of size on the card. I have created an image of this card using 'dd' which is obviously 8Gb in size. Is it possible for me to dd this image onto a 4Gb card now as there is less than 4Gb of actual data, the rest being empty space? I want to use the 8Gb card to test other distros but still be able to simply plug back in my main OS when done.

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: dd 8Gb image onto 4Gb SD

Fri May 31, 2013 11:08 am

a couple of ways
ether shrink the partition 1st then dd the partition and not the drive
or
setup another SD card like you want and

Code: Select all

rsync
the large image to the smaller one
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Altin
Posts: 21
Joined: Fri Aug 24, 2012 10:52 pm

Re: dd 8Gb image onto 4Gb SD

Mon Jun 03, 2013 10:27 pm

What arguments do I use if using rsync? There seems to be tons of options in the man page.

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

Re: dd 8Gb image onto 4Gb SD

Tue Jun 04, 2013 4:26 am

Did you resize the second partition on the 8gb SD card ?
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

Altin
Posts: 21
Joined: Fri Aug 24, 2012 10:52 pm

Re: dd 8Gb image onto 4Gb SD

Tue Jun 04, 2013 7:42 am

I expanded it using raspi-config to use the whole 8Gb card.

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: dd 8Gb image onto 4Gb SD

Tue Jun 04, 2013 8:18 am

rsync -ax / user@destmachine:/path/to/basic/image
meaning
do everything and don't cross filesystem boundaries
if you put the new SD card into the existing RPi with an USB sd card adapter you can
sudo mount /dev/sda1 /mnt
sudo rsync -vax / /mnt
[v is verbose]
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Altin
Posts: 21
Joined: Fri Aug 24, 2012 10:52 pm

Re: dd 8Gb image onto 4Gb SD

Tue Jun 04, 2013 12:21 pm

Can this be run from the Raspi itself, i.e. to create an image on an external USB HDD, from the Raspi, would I run rsync -ax / /media/usb0/raspbian.img? I can use a linux live cd on my laptop & plug the SD card into it if not.

Also Raspbian creates 2 partitions on the SD card, /dev/mmcblkp01 & /dev/mmcblkp02 (from fdisk -l). If the -x flag doesnt cross the partition boundary does this mean you dont need both partitions, just the larger one with all the data?

Return to “Raspberry Pi OS”