I have a Debian Squeeze install. The boot partition seems to have corrupted (rainbow screen of death), and I'd like to replace the boot partition, but I don't want to reflash. I have a lot of data and settings on the SD card which I don't want to wipe.
Is it possible to replace the boot partition on the SD card without reflashing?
If so, please can you give instructions?
Edit: I use a Mac.
-
- Posts: 67
- Joined: Wed May 30, 2012 7:56 am
Re: Replacing boot partition without reimaging SD
The easiest way is with a second SD card. Flash that one with the image, then open it on the Mac, copy all of the files out of the boot partition -- the small one. Then insert the old card and copy all the files onto its boot partition.
-
- Posts: 58
- Joined: Thu May 24, 2012 6:47 pm
Re: Replacing boot partition without reimaging SD
Alternatively I think and I'm not promising this to work, but if you copy the contents of the larger partition across to a folder on your Mac, re-flash the SD card and then copy the contents back, that should restore all your settings and files.
- nick.mccloud
- Posts: 1280
- Joined: Sat Feb 04, 2012 4:18 pm
Re: Replacing boot partition without reimaging SD
Mac's are good, but they ain't quite clever enough to see an ext4 partition's files without some serious hacking. Go with rurwin's suggestion.sharpapotheosis wrote:Alternatively I think and I'm not promising this to work, but if you copy the contents of the larger partition across to a folder on your Mac, re-flash the SD card and then copy the contents back, that should restore all your settings and files.
Pico/RP2040 ≠ Arduino
Pico = hot rod kit car, Arduino = hot rod kit car wrapped in cotton wool with buoyancy aids & parachute
Pico = hot rod kit car, Arduino = hot rod kit car wrapped in cotton wool with buoyancy aids & parachute
-
- Posts: 67
- Joined: Wed May 30, 2012 7:56 am
Re: Replacing boot partition without reimaging SD
I had the same idea as sharp and it seems to have worked.
I used MacFuse to read and write to the ext formatted partition and it worked well. I backed up, reflashed and restored and copied the files back.
No permissions problems, I hope, as I used sftp with the appropriate user to copy the files.
Only downside - this took a very long time!
I used MacFuse to read and write to the ext formatted partition and it worked well. I backed up, reflashed and restored and copied the files back.
No permissions problems, I hope, as I used sftp with the appropriate user to copy the files.
Only downside - this took a very long time!
Re: Replacing boot partition without reimaging SD
You could always use dd to do it - I believe Macs have dd ? correct me if I'm wrong though.
But you need to mount the img file first so you can take an image of the boot partition of the image...if that makes sense.
I'm about to test this method now...so I'll report back with results soon.
But you need to mount the img file first so you can take an image of the boot partition of the image...if that makes sense.
I'm about to test this method now...so I'll report back with results soon.
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
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
Re: Replacing boot partition without reimaging SD
If you can mess around with images of part of the drive and stuff, then you can do it the proper way: mount the image on the Mac as a loopback mount, and copy the files off that onto the card.
I've never got into loopback mounts myself, but I understand they are easy and powerful. Doing it on a Mac may be more difficult, but it is BSD under the covers.
I've never got into loopback mounts myself, but I understand they are easy and powerful. Doing it on a Mac may be more difficult, but it is BSD under the covers.
Re: Replacing boot partition without reimaging SD
I don't have a Mac myself, but I can imagine it would be easy enough.
Here's a post on how to do it in Linux
http://rackerhacker.com/2010/12/14/moun ... -in-linux/
Here's a post on how to do it in Linux
http://rackerhacker.com/2010/12/14/moun ... -in-linux/
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
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
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: Replacing boot partition without reimaging SD
Comments:SirLagz wrote:I don't have a Mac myself, but I can imagine it would be easy enough.
Here's a post on how to do it in Linux
http://rackerhacker.com/2010/12/14/moun ... -in-linux/
1) That URL is along the lines of what I had figured out myself earlier - but note that he does it with "file" and multiplies by 512, while I did it with "fdisk" and multiplied by 65536 (after subtracting 1).
2) "kpartx" looks interesting, but it seems to me that all kpartx does for you is avoids having to fiddle with offsets - i.e., it does that part for you, including the multiplication. You still do the mounting (with -o loop) yourself.
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
Re: Replacing boot partition without reimaging SD
You can use either file or fdisk to find the information you need. The link shows both ways.
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
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
Re: Replacing boot partition without reimaging SD
I've just finished a script to mount img files locally if anyone is interested in it.
My webhost is currently being moved so I don't have my hosting to put it up anywhere otherwise I would.
My webhost is currently being moved so I don't have my hosting to put it up anywhere otherwise I would.
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
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