How to Backup your SDcard


40 posts   Page 1 of 2   1, 2
by OldMarty » Sat Dec 22, 2012 2:52 am
Hi All,

I've created a newbies version of "How to backup your R-Pi SD card", to make it clear & simple for all of us ;-).
For my example, I'm using Windows7 & "Win32DiskImager" for this example, but i'm sure it's basically the same for the linux version.


Ok, so you have your Raspberry Pi distro running, Appz are installed and everything configured EXACTLY how you want it.
Now you should backup your SDcard for future use, in case it dies one day (believe me, it WILL die), and i personally hate re-installing everything over & over again ;-(
So, lets create a backup image of your R-pi system....

Plug your SDcard into your laptop/pc/card-reader and wait until Windows finds it etc etc
( For this example, my SDcard appears as E:\ )

Step 1:
Startup the "Win32DiskImager" program, Here's the opening screen:
Notice you will need to select which drive is your SDcard. in this case my SDcard is E:\
then click the NAVIGATE icon just next to the E:\ pulldown box, this will open a file-explorer window.
(Also note that the "read" button is not available to use just yet).
Image

Step 2:
Select a folder on your hard-drive where you want to SAVE the image file of your SDcard. In my example, i have a folder named "rpi_backups".
Also type in a filename of the image you're about to create, and click SAVE to continue to next step.
Note:
I prefer to always include the SIZE of the SDcard somewhere in the filename, which is handy later on when you have odd sized SDcards that may require partition-resizing after being restored.
( e.g. burning your 8Gb image onto a 32Gb card, you'll need to resize, so you can use the entire 32Gb )
Image

Step 3:
Confirm the folder/filename are correct, and now you can click the READ button to start reading your SDcard into your (about-to-be-created) image file.
Image

Step 4:
Here's my image file being written, almost complete at 95% ....
Image

Step 5:
It will indicate "Done" when the image has finished writing.
Image


....and that's it !
Now can play with multiple Pi-distro's, try new Appz and always be able to revert back to your original (preferred) Pi images ;-)

I hope this helps ;-)
Marty.
Posts: 7
Joined: Wed Dec 19, 2012 12:34 pm
by Pytlicek » Sun Dec 23, 2012 12:18 pm
Yes :) Thanks
Sorry for my English :)
User avatar
Posts: 13
Joined: Sun Jul 01, 2012 4:11 pm
Location: Slovakia
by thsBavR10 » Sun Dec 23, 2012 1:02 pm
Now can play with multiple Pi-distro's, try new Appz and always be able to revert back to your original (preferred) Pi images ;-)
I hope this helps ;-)
Marty.

Hi Marty,

If you are limited in space on harddisk, you may add "Step 6" (like i'm doing):
Compress the SD card image with 7-Zip or alike,
it saves you about 80%-90% of space, if you are choosing 7z as destination type.
clipboard.jpg
screenshot 7-Zip
clipboard.jpg (44.73 KiB) Viewed 38337 times


Thomas
Posts: 219
Joined: Sat Jul 21, 2012 3:11 pm
by Andy123 » Tue Dec 25, 2012 6:08 pm
OldMarty wrote:Note:
I prefer to always include the SIZE of the SDcard somewhere in the filename, which is handy later on when you have odd sized SDcards that may require partition-resizing after being restored.
( e.g. burning your 8Gb image onto a 32Gb card, you'll need to resize, so you can use the entire 32Gb )

Please explain the partition-resizing thing & how it should be done if your example does in fact come true (8GB image to 32 GB).
Thanks.
Posts: 1
Joined: Tue Dec 25, 2012 5:54 pm
by Toby Branfoot » Wed Jan 02, 2013 1:21 am
Thanks OldMarty for this ... I am following your (and a few others) guides to backing up my SD card ... it's one thing flashing a new OS ... but then adding/updating libraries like pygame, timidity, numpy, gnash, etc ... and then installing more significant software like LibreOffice and IceWeasel ... and further updating everything ... as well as downloading source-code and the like for for Python and Scratch books that I have got hold of. NOT something I want to do repeatedly ... but I have ... developing a set-up for a few Xmas presents for children.

But the RPi seems "fragile" ... a power cable pulled out "accidentally" ... and the card seems to need re-flashing ... booting to LXDE directly seems user-friendly ... but if they then forget to, or can't shutdown (because the system has locked up in some fashion) ... again ... dead to restarting ...

I have just used Win32DiskImager (up until now just used successfully to flash the latest version of Wheezy to an SD card) to copy the currently working SD card back to my Windows PC ... am I right that doing this regularly will "back-up" the whole system ... and enable a relatively swift "restore" of the whole set-up? And if I e-mail this on, my nieces/nephews/friends systems can be re-flashed to restore things if their's get messed up? So ideally, they should save/back-up their own files to another USB card or the like (in addition?) so if/when the primary system SD card needs re-flashing from the "main" backup to restore the "system" their personal files can also be restored?

Maybe this is "obvious" ... but can you confirm I am thinking straight and doing it right?

Cheers

Toby
Posts: 21
Joined: Thu Nov 15, 2012 8:59 am
by athome42 » Tue Jan 08, 2013 7:09 pm
Hi
tried this using Win32diskimager to back-up the "system" but Windows 7 reported insufficient space i.e. disk full but Windows 7 also reports that there is 149Gb free.

Am I doing something wrong?
Al - http://athome42.com
Posts: 10
Joined: Tue Dec 25, 2012 7:02 pm
Location: Reading UK
by Jim JKla » Tue Jan 08, 2013 7:13 pm
That could just be Windows7 playing hard to get. ;)

Look at all that run as administrator rubbish. I am verry pleased I am still running on a combo of XP Pro and Ubuntu/RaspberryPi :D

Look at where you are saving the file.
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick
User avatar
Posts: 2199
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK
by athome42 » Tue Jan 08, 2013 9:05 pm
Successfully backed up as adminstrator to my master 500Gb with 440Gb free space and NTFS file format. Repeated process to my secondary drive with 66Gb free space (correction from originaly stated 149Gb) and backup failed, then I noticed the secondary drive is FAT32 format.

Could this be the reason???
Al - http://athome42.com
Posts: 10
Joined: Tue Dec 25, 2012 7:02 pm
Location: Reading UK
by Jim JKla » Tue Jan 08, 2013 9:30 pm
Make it with NTFS then copy the file to the Fat32 space. ;)
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick
User avatar
Posts: 2199
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK
by PiSi » Sun Jan 20, 2013 2:40 pm
Done the backup but when I look at my SD card in Windows Explorer it only seems to show the system files using only around 15MB and cannot see the user folders and .py files I have created.

Is this just Windows only showing 1 partition on the card?

Will the backup image via Win32DiskImager have copied everything off the SD card, including my user files, or just what Windows can see?

Thanks,

Simon
Posts: 37
Joined: Mon Jan 14, 2013 9:41 am
by Dilligaf » Sun Jan 20, 2013 3:31 pm
If you use Usbit in device mode rather than win32imager it will create a compressed .img.gz which will save a lot of space, it will also write the compressed image back to the card. Just uncheck check file size >4G in options (will not work if saving to a fat filesystem)
Posts: 283
Joined: Wed May 23, 2012 6:48 pm
by Jim JKla » Sun Jan 20, 2013 4:30 pm
If you used Win35DiskImage you will have everything.

But as PiSi says its uncompressed, Win32DiskImage is quick dirty but it does the job. ;)
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick
User avatar
Posts: 2199
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK
by FourthDr » Thu May 23, 2013 8:32 pm
I recently ran apt-get update and apt-get upgrade install. After which I noticed my vnc session had hung. I saw that the last thing on the screen was a firmware upgrade. I tried reconnecting only to discover the rpi had lost it's IP. So I restated the rpi by removing power. It will now not boot up. I get power led solid and the act led blinking in groups of three. But no lan leds are lit so can't talk to the rpi. It seem to be hosed.

As a result of this failure I wanted to backup my images. So I landed here. However there is a big problem with using Win32DiskImager. It's fine if you have a 4-8gb SD card. But in my case I am using a 32GB SD card but the card is only using <5gb. I expanded the SD card once I put the standard image on it. When I try to backup the SD, instead of the image file being ~5gb it is 32GB! How can I make a backup image that is only the size of actually use space??? This a is a problem as it takes forever to write an SD image to the hard drive and I don't have 32gb of free disk.

Symantec ghost disk imaging utility compresses the data and free space down making really small images. For example: if you have a 100GB drive and only have 20GB of data including the partition free space, the image usually comes out ~20GB or less. Is there a cross platform SD card imager that compresses the empty space making a smaller image?

The short version:

Anyway to recover my rpi install? I spent hours customizing, removing junk, compiling, installing software and don't really want to have to do that all over again.

Is there an imaging software that works like ghost? I don't have room for 32GB SD images. I stated with standard image and expanded the FS. I don't actually have 32GB of stuff on the SD!

Is there a way to automate all the stuff I customized, compiled, removed, installed for the next disaster? As well as an automated data backup to windows/linux via lan?

I know that a lot of stuff. But I'm hoping someone has had these problems and has a do-able system/solution.
Posts: 2
Joined: Thu May 23, 2013 7:55 pm
by fdboer » Fri May 24, 2013 6:57 am
Dear FourthDr,

I've run into this issue with every firmware upgrade sofar.
It's still annoying but I now know the workaround, just make sure you're at home when doing the upgrade. ;)

If you take the SD card out of the Pi and stick it into a PC you will find the boot partition is a regular FAT filesystem and accessible by the PC. Most likely you miss a number of files there that you can fetch from https://github.com/Hexxeh/rpi-firmware.

After putting these files back on the SD card you should be able to boot again.

Good luck.
Posts: 3
Joined: Fri Oct 05, 2012 7:14 am
by FourthDr » Mon May 27, 2013 12:37 am
Thanks MagPi that fixed it + several more apt-get commands. But so far no luck on an improved SD card imager that works more like ghost and compresses on the fly when reading an SD to an image file on my hard drive. Also nothing for file backups over then lan either. Any recommendations?? Maybe an issue of MagPi covered this?? I don't remember seeing anything.
Posts: 2
Joined: Thu May 23, 2013 7:55 pm
by Dilligaf » Mon May 27, 2013 1:35 am
Usbit will make compressed backups (*.img.gz), just go into options and check ignore size checks for over 4GB and make sure you're not backing up to a fat formatted drive
Posts: 283
Joined: Wed May 23, 2012 6:48 pm
by Somebody » Thu Jun 06, 2013 7:43 am
I'm sorry, perhaps I'm a little stupid, but I can't save my file in the step 2.
Step 1 is OK, but when
then click the NAVIGATE icon just next to the E:\ pulldown box, this will open a file-explorer window.
(Also note that the "read" button is not available to use just yet).

The only choice I have is "open" or "cancel".

Better use HDD Raw copy from HDD Guru !
Posts: 3
Joined: Wed Jun 05, 2013 9:24 pm
by MaDoGK » Wed Jun 12, 2013 9:18 am
I had problems following the tutorial as did "Somebody", Win32DiskImager wouldn't let me choose the folder and file name, as it told me that the file couldn't be found. (as I got an "open" button)

So for all my fellow n00bs: With notepad save a file as you want your image to be called, eg. "raspbian4gb11062013.img". Remembering to add the .img and of course setting notepad save box to "all files *.*" and agree to overwrite the file when prompted by Win32DiskImage :P
Posts: 16
Joined: Wed Jul 11, 2012 6:25 pm
by KCE » Sun Jun 23, 2013 1:58 pm
For those noobs (I was one yesterday!) who may not know, the download address for Win32diskimager is http://sourceforge.net/projects/win32di ... =directory
Yes, I found the same as by MaDoGK. As I didn’t want to overwrite an existing (good) image, I copied it in the same folder then renamed it (I wanted a similar filename but including today’s date) before selecting it and starting the Read. Much better to create a small .TXT file and rename!
Also, I can’t stop it from defaulting to a file path of its choice, rather than the last one I used, even after I set the environment variable “DiskImagesDir” to my chosen path.

Rather more fundamentally, I’ve just tried to save an image 8 times unsuccessfully with various errors, the most prevalent of which is:
“An error has occurred when attempting to read data from handle. Error 121: The semaphore timeout period has expired.”
As I’ve tried using three different SD card readers, all of which work fine on my various cameras’ SD cards, I conclude that an 8GB partition is too much for Win32diskimage.
(For those amongst you to whom these things matter:
I’m running Win32diskimager v0.8 under Windows Vista on an AMD Athlon 64×2 Dual Core 4600 2.40GHz with 205GB free on my HDD, a Kingston C4 8GB SDHC card in an Integral USB 2.0 SD card reader (have had the same result with another Integral USB 2.0 multicard reader and a LogiLink 5.25 inch Multifunction Front Panel). Yes the R-Pi boots up fine when the SD card is reinserted. The card had last been flashed with Win32diskimager yesterday.
The read failure I’m getting generally follows this path:
start the Read;
see the target file timestamped and its size knocked down to 0KB;
see half a dozen flickers of the data LED on my SD card reader;
see the target file size go up to ca 122Kb;
wait ca 2 minutes;
get the Read error.
However, the latest attempt saw 5-6 instances of the LED flashing episode, while Windows said Win32diskimager was ‘not responding’, followed by the Read error after about 10 minutes and a 122Kb target file …)
As yesterday’s re-flash cost me about half a day in apt-get installs, upgrades and reconfigures (of CUPS, SAMBA, etc.) I’d like a foolproof method of backing up my hard work. Any helpful suggestions, please
Posts: 5
Joined: Fri Jun 21, 2013 9:40 am
by SlimShadySkip » Thu Jul 18, 2013 7:04 am
Can you Explain how to Expand the File System to Match a Larger Card Size

ie: If, after saving my Card Image, I were to want to Copy Image to a Larger 16gb or 32gb SD Card so as to have more room for Incidental Files ???

Thanks so much.

Also, IF there is also a tutorial on how to do this Please just point me toward it by posting link here...

Thanks again,
Scott Richardson
(SlimShadySkip)
Posts: 1
Joined: Thu Jul 18, 2013 6:50 am
by wotid » Fri Jul 26, 2013 3:42 pm
Thanks for that.

I had the same problem, but it was solved by creating a dummy *.img file to write to. :)


MaDoGK wrote:I had problems following the tutorial as did "Somebody", Win32DiskImager wouldn't let me choose the folder and file name, as it told me that the file couldn't be found. (as I got an "open" button)

So for all my fellow n00bs: With notepad save a file as you want your image to be called, eg. "raspbian4gb11062013.img". Remembering to add the .img and of course setting notepad save box to "all files *.*" and agree to overwrite the file when prompted by Win32DiskImage :P
- Steve.
User avatar
Posts: 2
Joined: Tue Jul 02, 2013 1:01 pm
by wotid » Fri Jul 26, 2013 4:24 pm
I just discovered another way of doing it.

You can enter a path and file name into the Image File box i.e. "c:\temp\test.img" and it will create and write the img rather than having to create a dummy file with notepad etc and then pointing the program to it.

wotid wrote:Thanks for that.

I had the same problem, but it was solved by creating a dummy *.img file to write to. :)


MaDoGK wrote:I had problems following the tutorial as did "Somebody", Win32DiskImager wouldn't let me choose the folder and file name, as it told me that the file couldn't be found. (as I got an "open" button)

So for all my fellow n00bs: With notepad save a file as you want your image to be called, eg. "raspbian4gb11062013.img". Remembering to add the .img and of course setting notepad save box to "all files *.*" and agree to overwrite the file when prompted by Win32DiskImage :P
- Steve.
User avatar
Posts: 2
Joined: Tue Jul 02, 2013 1:01 pm
by Twizzard » Sat Jul 27, 2013 2:56 am
SlimShadySkip wrote:Can you Explain how to Expand the File System to Match a Larger Card Size

ie: If, after saving my Card Image, I were to want to Copy Image to a Larger 16gb or 32gb SD Card so as to have more room for Incidental Files ???
...


Try copying the smaller image to the larger card, and then after you've booted the Raspberry Pi with the larger card, run
raspi-config
- there should be an option to expand the filesystem to fill the entire card. After it completes and the Raspberry Pi reboots, the entire SD card should be available for use.
Posts: 4
Joined: Sat Jul 27, 2013 2:00 am
by davidbradford » Sat Jul 27, 2013 11:31 pm
I am using Win32DiskImager version 0.8 and it will not let me perform a "Save" after selecting my SD card in the pull down menu then clicking on the adjacent folder icon. It will only let me perform an "Open".
Posts: 2
Joined: Sat Jul 27, 2013 11:27 pm
by davidbradford » Sun Jul 28, 2013 12:45 am
I found the answer in replies to this post. But, I do not have to perform a "Write", only a "Read". If I perform a "Write" after the "Read", it will write to my "Device" - the SD Card.
Posts: 2
Joined: Sat Jul 27, 2013 11:27 pm