annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

How to make an exact image of my raspberry pi system?

Fri Jan 01, 2016 3:39 pm

Hi, let's say I have a full Dietpi system with Grovepi+ and sensors, and want to save the whole image status to simply clone to any other exact systems

so once the image is copied, just copy it into another microsd, insert in the new system and will work exactly like the other, is this possible? how?

ty~

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13009
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: How to make an exact image of my raspberry pi system?

Fri Jan 01, 2016 3:48 pm

you can make an image from your setup with the DD image writer, which can also read and SD card and turn it into an image.
Unfortunately when writing this image back you risk the chance that DD will complain the SD card is too small! that is because no two "8GB" cards have exactly the same capacity.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Fri Jan 01, 2016 4:10 pm

mahjongg wrote:you can make an image from your setup with the DD image writer, which can also read and SD card and turn it into an image.
Unfortunately when writing this image back you risk the chance that DD will complain the SD card is too small! that is because no two "8GB" cards have exactly the same capacity.
dietpi does not have DD image writer, will do under windows software then

Thanks, this is my microsd card (8GB): http://www.amazon.es/gp/product/B009HPF ... ge_o00_s00

so does it need to be the exact microSD card model then for sure to avoid problems?

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

Re: How to make an exact image of my raspberry pi system?

Fri Jan 01, 2016 4:35 pm

I am not a Diet-Pi user, but doesn't it have its own Backup/Restore tool called dietpi-backup?

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Fri Jan 01, 2016 4:36 pm

B.Goode wrote:I am not a Diet-Pi user, but doesn't it have its own Backup/Restore tool called dietpi-backup?
uhmm thanks, will contact their support and see if that does the function

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to make an exact image of my raspberry pi system?

Fri Jan 01, 2016 4:51 pm

mahjongg wrote:you can make an image from your setup with the DD image writer, which can also read and SD card and turn it into an image.
Unfortunately when writing this image back you risk the chance that DD will complain the SD card is too small! that is because no two "8GB" cards have exactly the same capacity.
The way I avoid that problem is to trim 1.5GB off the root fs partition (resize2fs can make filesystems smaller) so that my dd'd images come out at 6.5GB. That will fit any 8GB card. Once it's written back to a SDCard I'll use sudo raspi-config to expand it back to full size. Doing it with a USB reader and parted or gparted is trivial, I guess it's one benefit of having so many raspberries.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 8:11 am

thanks guys, @doug thanks too but it seems a bit too advanced for my knowledge

here I found a lot of choices: http://elinux.org/RPi_Easy_SD_Card_Setup

like this PiWriter? http://sourceforge.net/projects/piwriter/

which one would you suggest for a DietPi system and a linux newbie like this?

regarding the size issues, I think buying a 16GB microSD when copying a 8BG will solve the issue, right?

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 9:26 am

With a 8GB current card and a 16GB target card and a NON-NOOBS system
Mount the 16GB card in a USB reader, plug that into your RPi

It should appear as /dev/sda (check with the dmesg | grep sd command).

sudo dd if=/dev/mmcblk0 of=/dev/sdb bs=100M &

When that completes you have a bootable copy on the SDCard in your reader, boot it and use sudo raspi-config to expand the filesystem to use the full card.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 9:39 am

DougieLawson wrote:With a 8GB current card and a 16GB target card and a NON-NOOBS system
Mount the 16GB card in a USB reader, plug that into your RPi

It should appear as /dev/sda (check with the dmesg | grep sd command).

sudo dd if=/dev/mmcblk0 of=/dev/sdb bs=100M &

When that completes you have a bootable copy on the SDCard in your reader, boot it and use sudo raspi-config to expand the filesystem to use the full card.
ok thanks, plz try to have a look to this other post
When that completes you have a bootable copy on the SDCard in your reader, boot it and use sudo raspi-config to expand the filesystem to use the full card.
so when I insert this microSD into another Rpi will have kind of menu to choose with raspi-config to expand? (dietpi does not have this command), and any USB reader in particular?

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 10:12 am

one last question, how do I extract the image as a .img or .gz if I want to save it online like in dropbox or gdrive? :ugeek:

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 10:52 am

You can gzip it to an img.gz if you choose, but the output from dd is a straight byte-for-byte copy.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 11:29 am

DougieLawson wrote:You can gzip it to an img.gz if you choose, but the output from dd is a straight byte-for-byte copy.
ok so then

1º) will choose to gzip it, but how?? (which commands)

then mount a sandik pendrive (kingston gives me troubles) and copy to it, then umount

2º) will make a bit to bit copy via usb microsd reader as Doug said

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 11:40 am

dd if=/dev/mmcblk0 | gzip /media/somewhere/sdcard.copy.img.gz
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

QuietZone
Posts: 89
Joined: Sat Dec 05, 2015 7:13 pm

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 11:50 am

DougieLawson wrote:dd if=/dev/mmcblk0 | gzip /media/somewhere/sdcard.copy.img.gz
(UUODd and OUOGz)

bzip2 < /dev/mmcblk0 > /media/somewhere/sdcard.copy.img.bz2

Or, even use 'xz', which is even better than bzip2...
"If you haven't got anything nice to say about anybody come sit next to me." — Alice Roosevelt Longworth

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 11:53 am

DougieLawson wrote:dd if=/dev/mmcblk0 | gzip /media/somewhere/sdcard.copy.img.gz
wonderful :P

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 12:09 pm

finally, the last step to recover the image (I am dietpi user)

is extract the gzip in windows, with the resulting .img file use the software Download Win32DiskImager and burn it into the same model of 8gb card or one with 16gb

cheers!

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 12:21 pm

7-zip will work with gzipped files. Win32DiskImager is horrible but it will write a dd'd image to a SDCard.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Tue Jan 05, 2016 12:25 pm

DougieLawson wrote:7-zip will work with gzipped files. Win32DiskImager is horrible but it will write a dd'd image to a SDCard.
hehe I am a 7zip user :) and the other will make the job 8-)

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Fri Jan 15, 2016 4:11 pm

DougieLawson wrote:dd if=/dev/mmcblk0 | gzip /media/somewhere/sdcard.copy.img.gz
dear Doug, I did that command and got no such file or directory, the sda1 drive was mounted (could even list its files), and look at the content of /dev/ and the error msg mentioned:

Image

can you please help? ty~

User avatar
rpdom
Posts: 17029
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How to make an exact image of my raspberry pi system?

Fri Jan 15, 2016 4:27 pm

annlee wrote:
DougieLawson wrote:dd if=/dev/mmcblk0 | gzip /media/somewhere/sdcard.copy.img.gz
dear Doug, I did that command and got no such file or directory
There's a very important bit missing in the command you were given. Try this instead:

Code: Select all

dd if=/dev/mmcblk0 | gzip > /mnt/pendrive/backupv0.img.gz
The ">" means "Send output to this file". By missing it out it is looking for a file called "/mnt/pendrive/backupv0.img.gz" to use as input and compress.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Fri Jan 15, 2016 4:36 pm

rpdom wrote:
annlee wrote:
DougieLawson wrote:dd if=/dev/mmcblk0 | gzip /media/somewhere/sdcard.copy.img.gz
dear Doug, I did that command and got no such file or directory
There's a very important bit missing in the command you were given. Try this instead:

Code: Select all

dd if=/dev/mmcblk0 | gzip > /mnt/pendrive/backupv0.img.gz
The ">" means "Send output to this file". By missing it out it is looking for a file called "/mnt/pendrive/backupv0.img.gz" to use as input and compress.
thanks! it is taking like 5 minutes and continue, pendrive has 4GB free and filesystem weight is less than 2GB, not sure if will be trouble with size cuz microsd is 8GB :oops:

QuietZone
Posts: 89
Joined: Sat Dec 05, 2015 7:13 pm

Re: How to make an exact image of my raspberry pi system?

Fri Jan 15, 2016 4:48 pm

Note that this qualifies as "useless use of dd".
"If you haven't got anything nice to say about anybody come sit next to me." — Alice Roosevelt Longworth

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Fri Jan 15, 2016 5:04 pm

apparently it finished (msg is shown) but when I try to umount pendrive it says it is busy, what can I do? :oops:

User avatar
rpdom
Posts: 17029
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How to make an exact image of my raspberry pi system?

Fri Jan 15, 2016 5:12 pm

Is your current directory on the pendrive? If so, cd somewhere else, then try the unmount again.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to make an exact image of my raspberry pi system?

Fri Jan 15, 2016 5:15 pm

rpdom wrote:Is your current directory on the pendrive? If so, cd somewhere else, then try the unmount again.
nope, I am at "/"

it is not working to umount /dev/sda1 nor umount /mnt/pendrive (says it is busy)

I just dont wanna make corrupt the backup, perhaps a "shutdown now" may umount everything?

Return to “Beginners”