Restore Backup

Ask questions about Arch Linux ARM. Please search before making a new topic.

Restore Backup

Postby mbauhardt2 » Sun Dec 27, 2015 10:28 am

hi,
i have a raspberry pi 2 with archlinux arm installed and i want to backup my system while this system is running. I found this article https://wiki.archlinux.org/index.php/Fu ... with_rsync which describes how to backup via rsync. I have a couple of questions about this method

1) I assume the destination filesystem must be also a ext4 filesystem to keep permissions acl’s?
2) How can i rollback this backup? With a simple cp command or rsync vice versa? Chroot?
3) Is this backup bootable? I mean when my system crash’s and i can not boot my system how can i rollback my backup into a system which i can not start?

Thanks
Marko
mbauhardt2
 
Posts: 4
Joined: Sun Dec 27, 2015 8:33 am

Re: Restore Backup

Postby Neand1980 » Tue Jan 12, 2016 8:08 am

As i understand the Article, the Destination of the rsync could be any Linux Filesystem as long it can hold the Userrights. So it can be also ext2 or ext3 or maybe ReiserFS. In Fact, as i know ext3 and ext4 add only some Journaling Functions to ext2, so for Backup Purposes, ext2 does the Job.

The Restore is in case for a Raspberry Pi unclear for me to. For my understanding rsync in the other direction should do the Job. But since the Main System on the PI is always the SD Card and you cant boot from it, you should first copy back the initial Image to the SD, boot from it and after this, you can rsync in the other direction. I don't know if this could work really. If You can boot from SD, you can skip the step, copying back the original Image. Again, i don't know if this could work. Since i have started a similar Question, maybe someone has done this before and could tell us his Experience with the process.

The Backup itself i think its not bootable as long your target disk isn't bootable. If you keep this in mind, maybe adding a separate SD Card Reader to USB could solve the Problem. If you add such a device, copy a initial Arch Image to a SD Card and insert this additional SD Card to the Reader and use this SD Card as a target for your rsync process, should end up in a bootable SD Card. I don't if this is right. I hope so.

PS: Backup. After setting up my System in the last Days for the first time, all is now running and works like a charm. I have shutdown the PI and made a Backup to a Image with a Windows Program called "Roadkil’s Disk Image" since "Win32 Disk Imager" does not List any Device in the Dropdown Box (i don't know why). I could successfully write this Backup Image to my Windows HDD. But i had no success to restore the Image. Maybe some needs a better way to make such a Backup and restore it to a new SD Card. I don't know, if i have done a wrong Backup, since the SD Card is 8GB in Size and i use only 3GB of it, the Image is also 8GB in Size. I don't know if there is a way to Backup only the 3GB to a *.img File and restore it to a 4GB SD Card...
Neand1980
 
Posts: 7
Joined: Tue Jan 12, 2016 7:27 am

Re: Restore Backup

Postby mbauhardt2 » Tue Jan 12, 2016 8:23 am

Hey Neand1980,
thx a lot for your very detailed answer.

I'm also unsure if i can rsync/copy back my backup to a running archlinux system (raspberry pi). Anyway, i will try that out in the next days and let you know.

Another idea is to use a third machine where i mount my two sd cards. A) raspberry image and B) the backup. And sync the data from B) -> A).

Marko
mbauhardt2
 
Posts: 4
Joined: Sun Dec 27, 2015 8:33 am

Re: Restore Backup

Postby Neand1980 » Tue Jan 12, 2016 8:33 am

At this time i plan to use a Backup with rsync to a HDD added via USB. On this device, i have at this time only /var/lib (with symlink to the original place) and a SMB Share to hold my Mediamonkey DB and Files. Specially Zarafa use the HDD a lot. In case of Crash, i hope, i could mount this HDD to my VMWare Image where i build some new Freetz Images and could rsync back all the needed files. If you find a better way, please let me know. Im really interested since i need a always running Pi with Zarafa on it.
Neand1980
 
Posts: 7
Joined: Tue Jan 12, 2016 7:27 am

Re: Restore Backup

Postby mbauhardt2 » Fri Jan 22, 2016 11:13 am

Hey,
i found a solution which works at least for me pretty well. I’m using two sd cards. One is for my running system and the another one is for my backup.

Installation
1) Sd-Card-B (backup system): Create 2 Partitions (boot and root) on it and install arch linux as described here http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2#qt-platform_tabs-ui-tabs2

2) Sd-Card-A (my running system): Create 2 Partitions (boot and root) on it as described here (do not install arch on it) http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2#qt-platform_tabs-ui-tabs2

3) Boot my backup Sd-Card-B and mount the boot partition from running system Sd-Card-A to /mnt/boot. Using rsync to sync this partition.
$this->bbcode_second_pass_code('', 'mount /dev/sda1 /mnt/boot')
$this->bbcode_second_pass_code('', 'rsync -aAXv --delete /boot /mnt/boot')
$this->bbcode_second_pass_code('', 'umount /mnt/boot')

4) Mount the root partition from Card-A to /mnt/root. Using rsync to sync this partition.
$this->bbcode_second_pass_code('', 'mount /dev/sda2 /mnt/root')
$this->bbcode_second_pass_code('', 'rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/boot"} --delete')
$this->bbcode_second_pass_code('', 'umount /mnt/root')

5) shutdown my backup system and start my running system Sd-Card-A


Backup
I do it like the installation vice/versa
1) Boot my running system Sd-Card-A and mount the boot partition from my Backup Sd-Card-B to /mnt/boot. Using rsync to sync this partition.
$this->bbcode_second_pass_code('', 'mount /dev/sda1 /mnt/boot')
$this->bbcode_second_pass_code('', 'rsync -aAXv --delete /boot /mnt/boot')
$this->bbcode_second_pass_code('', 'umount /mnt/boot')

2) Mount the root partition from my backup Sd-Card-B to /mnt/root. Using rsync to sync this partition.

$this->bbcode_second_pass_code('', 'mount /dev/sda2 /mnt/root')
$this->bbcode_second_pass_code('', 'rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/boot"} --delete')
$this->bbcode_second_pass_code('', 'umount /mnt/root')


Thats it. It t works very well. Ok, i have only one backup of my system and not a whole history like with ZFS-Snapshots or with TimeMachine. But this is ok for me in this case.

Marko
mbauhardt2
 
Posts: 4
Joined: Sun Dec 27, 2015 8:33 am

Re: Restore Backup

Postby Neand1980 » Sat Jan 23, 2016 12:03 pm

Why do you exclude the direcory /boot? Do you have any reason for this?
Neand1980
 
Posts: 7
Joined: Tue Jan 12, 2016 7:27 am

Re: Restore Backup

Postby mbauhardt2 » Sat Jan 23, 2016 12:08 pm

Sure. Because i sync the /boot folder separately to my /boot partition (sda1). I don't want to sync the content of /boot to my /root partition (sda2).

Marko
mbauhardt2
 
Posts: 4
Joined: Sun Dec 27, 2015 8:33 am

Re: Restore Backup

Postby Neand1980 » Sat Jan 23, 2016 12:11 pm

Ahh ok, i see. I will try a similar method in the next days. Many thx for your infos.
Neand1980
 
Posts: 7
Joined: Tue Jan 12, 2016 7:27 am

Re: Restore Backup

Postby andiling » Sun Mar 06, 2016 8:43 pm

Here's how I do it:

I create a container file on a remote share (or USB drive/disk), make it available as loop device, create a boot (vfat, bootable) and root (ext4) partition, format it and copy all necessary files with rsync. The file can be flashed with Win32DiskImager. If I need specific files I mount the container and copy the files I need with cp -p. If I want to update my backup I just mount it and run rsync.
andiling
 
Posts: 69
Joined: Sun Mar 06, 2016 8:34 pm


Return to User Questions

Who is online

Users browsing this forum: No registered users and 6 guests