vinylash
Posts: 14
Joined: Wed Jan 06, 2016 12:24 am

Problem restoring backup image

Mon Apr 23, 2018 7:09 am

Hi everyone I'm in a bit of a pickle. I have an issue in regards to a backup image made with win32 disk imager last year.
I had a corrupt card a week ago meaning I had to reformat and reload my os. I was running retropie 4.3 on a pi3. (Not the 3b+)
Last year when I used win32 to 'read' my card to produce a backup for safety, it all went ok and told me it was successful. So I went and stored on my external HDD for when I needed it again.
Ok so after my corruption it came the time when I needed it. I went to use win32 disk imager to write the image to the card and it's says it's successful, but when the card is put into the pi, there is no boot at all, absolutely nothing. Windows will not detect the boot partition either and tells me the card needs formatting before use (even just after writing the image). The things I've tried are using a new fresh image and wrote to the same card Which worked and booted fine (so I can rule out a duff card). I've written my backup image to other cards with the same no boot effect. I've formatted the card using windows and fat32 SD formatter. So what I was wondering, there anyway of checking the integrity of my backup image? And being able to fix it for boot? As it seems to be the image at fault but I'm sure as to why? I'm gutted that I can't get all my games, saves and configs back. I don't know if it helps but the card I used to make my backup is a SanDisk ultra 32gb.
Can somebody help? Thanks in advance guys

Ernst
Posts: 1334
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Problem writing backup image

Mon Apr 23, 2018 8:29 am

I can understand your current situation because I have just gone through a similar problem and I am still looking how to prevent the problem in the future. You must ignore whatever Windows tells you because that is "normal", to look at the contents of the card you need to mount the card on a linux (=raspberry) using a card reader. It is most likely that the image has been corrupted when it was created with Win32DiskImager, writing to several cards will not change that.

I do regular backups using Win32DiskImager, last week I wanted to upgrade one "difficult" system to the latest official kernel, normally I would do a backup but I noticed that there was a one week backup already so I left it.
The upgrade failed, I used the backup to recover the image, on boot the Pi crashed, used different cards without success, after spending a few hours I used an older backup to recover.

My advice in your case is that in the future it might be helpful, after doing an image backup, to restore the image on a second card and boot from this card, keep the original card for after the next backup.
The road to insanity is paved with static ip addresses

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Problem restoring backup image

Mon Apr 23, 2018 9:40 am

WIn32DiskImager makes an image file of the complete card - every single byte whether used or not. Not all cards of the same nominal size are exactly the same size, even from the same manufacturer's batch. You need a card of at least the same exact size as the one the backup was made from.

Try using Etcher to write the backup to a card. It will tell you if the card is too small for the image. If it is you can try a 64 Gbyte card or try to reduce the image size. There are posts about that, mostly using gparted on a Linux machine. That could be a PC booted from a live LInux CD or USB stick or your RPi booting Raspbian from another card.

If the problem really is that the backup image is corrupt, boot your RPi with a working card, put a card with the backup image in a card reader and plug into a USB port on the RPi and see what you can copy off it.

vinylash
Posts: 14
Joined: Wed Jan 06, 2016 12:24 am

Re: Problem restoring backup image

Mon Apr 23, 2018 2:20 pm

Thanks for the response guys.
Ernst- yeh it is incredibly annoying when this happens. I've learnt from this and will start using a usb stick to store my ROMs, saves and configs on to in case my SD card goes again. That way I'll only lose the core system and not all my content on retropie. Is there any reason to think that a the pi would be able to read the partition even if windows can't?

drgeoff- thanks for that advice. Would you recommend etcher over win32? And I will try using the pi to read anything off it. Will be tomorrow now as I'm working tonight. The thing that's puzzling me is that the IMG file is written and then windows won't recognise anything (as I know that you can access the small boot partition and everything else is ext after that) but it just says it needs formatting?

If the IMG when written to the card is completely unreadable using Linux also, is there a way of accessing the IMG file itself to extract any data? I'm not even too concerned about ROMs. It's just the saves and configs files I want to get my hands on.

Thanks again for your time guys

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Problem restoring backup image

Mon Apr 23, 2018 6:40 pm

vinylash wrote:
Mon Apr 23, 2018 2:20 pm
Thanks for the response guys.
Ernst- yeh it is incredibly annoying when this happens. I've learnt from this and will start using a usb stick to store my ROMs, saves and configs on to in case my SD card goes again. That way I'll only lose the core system and not all my content on retropie. Is there any reason to think that a the pi would be able to read the partition even if windows can't?

drgeoff- thanks for that advice. Would you recommend etcher over win32? And I will try using the pi to read anything off it. Will be tomorrow now as I'm working tonight. The thing that's puzzling me is that the IMG file is written and then windows won't recognise anything (as I know that you can access the small boot partition and everything else is ext after that) but it just says it needs formatting?

If the IMG when written to the card is completely unreadable using Linux also, is there a way of accessing the IMG file itself to extract any data? I'm not even too concerned about ROMs. It's just the saves and configs files I want to get my hands on.

Thanks again for your time guys
I only suggested Etcher because I think it will check if the card is large enough for the image and advise you if it is not.

Just ignore the Windows suggestion to reformat the card.

The img file is just a "raw" copy, byte by byte at the physical layer, of what was on the card. There are ways to mount an image and access the files inside but I've never done that myself. https://www.google.co.uk/search?q=mount ... mage+linux

vinylash
Posts: 14
Joined: Wed Jan 06, 2016 12:24 am

Re: Problem restoring backup image

Mon Apr 23, 2018 6:54 pm

Thanks for that advice. It will take me a bit of playing about with the command line in Linux as I'm pretty new to it all apart from basics in retropie. I was thinking of reviving my Samsung netbook with a copy of lubuntu to play with as it's supposed to be quicker than windows on an atom powered netbook. Would lubuntu be able to do this for me?
Thanks

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

Re: Problem restoring backup image

Mon Apr 23, 2018 8:26 pm

Your RPi running the Raspbian Operating System is also a platform on which you would be able to learn about the Linux shell (command line.)

If you have a 'Wintel' (x86-based) pc or laptop that you can repurpose you might be interested in Debian Stretch with Raspberry Pi Desktop : the Raspberry Pi Foundation’s operating system for PC and Mac. You can create a live disc, run it in a virtual machine, or even install it on your computer.

https://www.raspberrypi.org/downloads/r ... i-desktop/

vinylash
Posts: 14
Joined: Wed Jan 06, 2016 12:24 am

Re: Problem restoring backup image

Mon Apr 23, 2018 9:12 pm

Thanks for that link. I will give that a try. I was unaware they made a version usable for non ARM devices. In this case, what sort of commands would I need to enter to mount my IMG file to access my data? I've had a look over the net and seen some examples but it is very daunting to be honest. It would just be very useful to be able to access my 'corrup/ damaged' IMG file to copy the bits I need and then copy over to a fresh retropie install. Sorry but I'm a noob in Linux.

Thanks again

User avatar
HawaiianPi
Posts: 5838
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Problem restoring backup image

Tue Apr 24, 2018 2:09 am

Win32DiskImager is a terrible way to make backups. It's basically a "dumb" copier with no error checking or correction. It doesn't know or care what it's copying, and it also doesn't know or care if it's even making a valid copy. And if that's not bad enough, it also makes no checks during the restore, so there is no way to know if you even got valid data back. There are multiple links in the chain that could get broken, and not a single one of them is checked.

Even if your card had booted you could have ended up with corrupt data. People really need to stop using that crappy program.

The simplest, if not the fastest way to make a backup, is to use the SD Card Copier utility in Raspbian. Copy your running SD card to another card (in a USB card reader), then shut down, switch cards and boot back up. This spreads the wear out over 2 cards so they will last longer, and the cards don't even have to be the same size (you can even go from a larger card to a smaller one).

But there are a number of other ways to make backups in Linux, and there are loads of tutorials on how to make proper backups in Linux. Take an hour off from gaming to learn how to do it. http://bfy.tw/Hnew
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

k-pi
Posts: 930
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: Problem restoring backup image

Tue Apr 24, 2018 9:47 am

Usually one backs up ones own data to external media, that is, you don't need to back up the whole system. ;)

The system can be imaged to another card, & then you copy over your backed up data to it; or you could even change OS, & still have your data safe & sound on that external media. :)

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

Re: Problem restoring backup image

Tue Apr 24, 2018 9:57 am

Probably the image writing went fine, so your data should be on the card, even when its not boot able (there can be several reasons that would explain that).
I would attach an external card reader to your PI, and try to read your backed up card with that.
After mounting your card you should be able to see the whole second filing system.

Ignore windows, its suffering from the "not invented here" problem. It is simply not capable of seeing there is a linux file system on the card.

and yes, there are better backup mechanisms than using WIN32Diskimager.

vinylash
Posts: 14
Joined: Wed Jan 06, 2016 12:24 am

Re: Problem restoring backup image

Wed May 23, 2018 2:28 am

Well thought I would update you all finally. It turns out that win32 had copied absolutely nothing. After all your suggestions on how to read the card it came up with nothing at all. I even went to the extreme of using data recovery software to scan the card which came up with nothing! Either I've been a complete plonker and backed up a blank card, or win32 didn't copy the image properly. So I've had to write it off and start my retropie build from scratch. I will definitely be using different backup methods from now on and keeping well away from win32.
But thank you all for your help and time in trying to help me.

Ash

Return to “Troubleshooting”