MultiPartition SDCard Backup

Asked by Paul Fitton

Apologies if this has been covered many times before, but I am unable to find specific help.

I am a Linux/Ubuntu newbie, coming from a Windoze background (Mainframe/DOS is my REAL background actually)

I have prepared a micro SD card with 3 Partitions in order to run 'UrukDroid' on my Archos 70 Tablet, and I would like to be able to back up all the data for subsequent restore of copy to a different card. Obviously Windows won't help as it can only see 1 partition! Partition 1 contains my own data, but partitions 2 & 3 contain all the System stuff for the Android system, so I feel these will need more careful handling. I don't want to miss any of the critical stuff through my ignorance.

 When I plug in the micro SD card it mounts as 3 file systems (sdc1,2 and 3 - 1.5GB, 500MB and 1GB approx). When preparing the card (on Ubuntu 10.10) the process was to umount the partitions and mkfs on each in turn. It seems as if it should be easy to use tar (is there a better way?) on each partition in turn to copy the whole lot into Ubuntu then when I insert a different card, restoring should be simple (I wish).

Can anyone give me a few pointers please? Is tar the thing to use? I am a little nervous here as I understand that I need to do this as root, so want to tread lightly. I ultimately would like to do the whole thing with a bash script and am happy to do much of it myself, but a few guidelines would be most welcome.

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu util-linux Edit question
Assignee:
No assignee Edit question
Solved by:
mycae
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Best mycae (mycae) said :
#1

Use DD to simply create a binary image of the card

dd if=/dev/sdX of=/home/YOURNAME/cardimage.img

you can even pass this through "pipeview" to get progress, then put it into gzip to get compression

dd if=/dev/sdX | pv | gzip > cardimage.img.gz

Have a look in the dd manpage (command: man dd), or here:
http://elevenislouder.blogspot.com/2010/10/manual-backups-in-linux-dd.html

Revision history for this message
mycae (mycae) said :
#2

of course sdX is to be replaced by the actual name of your card. You also probably want to unmount the filesystem before doing the imaging

Revision history for this message
Paul Fitton (paul-fitton16220) said :
#3

Wow! What a super and quick response. I will check it out later to see if it works (more likely, if I can follow it!) Many thanks mycae!

Revision history for this message
Paul Fitton (paul-fitton16220) said :
#4

Thanks mycae, that solved my question.

Revision history for this message
Paul Fitton (paul-fitton16220) said :
#5

Fabulous thanks! It worked just as you said. I think the addition of 'pv' is worthwhile, or else you wonder if its just stuck, rather than getting on with it.

As so often, it raises more questions though. I guess I must restore to the same or an identical card? If I wanted to change from say a 2GB card to an 8GB card would I need to use something different?

Whilst this is absolutely what I originally asked, is there a file-based backup to use, so that I can get at the files from the backup? Also so I can restore the partitions selectively?

I really love Linux as I am slowly learning about it, and Ubuntu especially. But I wish it didn't feel as if I am moving swiftly with no brakes - and whilst wearing a blindfold!

Thanks again.

Revision history for this message
mycae (mycae) said :
#6

>I guess I must restore to the same or an identical card? If I wanted to change from say a 2GB
>card to an 8GB card would I need to use something different?

No, you can image a 2GB card to an 8GB one, though you will not be able to access the full 8GB of your card without repartitioning.

>Whilst this is absolutely what I originally asked, is there a file-based backup to use, so that I can
>get at the files from the backup? Also so I can restore the partitions selectively?

I'm afraid I cannot fully answer this. It is possible to mount the image using the "loopback" method, but this only works if you know where in your image the partition starts, and will only work with uncompressed images.

If you extract each partition separately, then this is trivial, otherwise it is a bit more complex. This guide shows this method, but also mentions a tool which I am not familiar with "multi-path tools", which may be a better way of doing things.

http://wiki.edseek.com/guide:mount_loopback

Revision history for this message
Paul Fitton (paul-fitton16220) said :
#7

Hi once more and thanks again. As you suggest, extracting each partition in turn is (fairly) trivial, but scripting it may well give me more control of things generally, so I may well work on that method using tar on each partition.

I've never heard of the loopback method so I will take a look.

Many thanks.i

Revision history for this message
Paul Fitton (paul-fitton16220) said :
#8

Thanks mycae, that solved my question.