Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Backup / Restore
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
shazeal
Tux's lil' helper
Tux's lil' helper


Joined: 03 May 2006
Posts: 140
Location: New Zealand

PostPosted: Tue Oct 29, 2013 7:35 pm    Post subject: Backup / Restore Reply with quote

Hi,

Short Version (TL;DR): Can anyone give me a solid backup / restore system for Gentoo that actually works.

Long Version ...

I have had hardware problems over the last year that required restoring Gentoo from backup. Every time my restore has failed to work.

Before I go onto what happened with the restores. I will list how I backed up the software.

The machine was running stable Gentoo with a custom kernel using a Pappy's seed. All hardware was configured correctly, and everything built-in not as modules.

Firstly I used a stage4 style backup, backing up the "essential" system files everything apart from home and system generated directories.
Code:
tar czpf $LOCAL_DIR/$BACKUP_NAME / -X $EXCLUDE


Then I did an rsync to a "live" backup which was updated much more regularly.
Code:
rsync -aAXv /* /mnt/backup --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}


All of these backups were done on an active system. I use idential scripts on another machine using Debian also preforming backups while the sytem was active.

Ok now back to the restore. In all cases the stage4 / home archives were successful with no errors. Restoring them also gave no errors. Upon boot the kernel would freeze. So I restored from rsync, same deal.
At this point I thought maybe I was backing up wrong so I went to my Debian box on which I am using exactly the same scripts to backup the machine. Did a test restore and everything works fine.

So I decided it must have been solar rays or some misconfiguration and reinstalled Gentoo from scratch and just restored /home. Several month later I had to restore again, and again the kernel refused to boot. So I tested the Debian machine just to be sure it was not a fluke the first time. Same results Debian works fine Gentoo was broken. So I chrooted into the Gentoo install and tried recompiling the kernel from scratch. Now the machine at least booted further but now it failed saying the boot device did not exist?!

At this point I have just reinstalled the machine with Debian since I am completely paranoid about backups and several days to restore my machine each time it dies isnt exactly appealing. Thing is I like Debian in the same way I like the dentist, its necessary but I really do not enjoy it.

So can anyone recommend a backup restore solution that works reliably on Gentoo.
_________________
CFLAGS="-OmgWTFR1CE --fun-lol-loops --march=asmx86go"
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3601
Location: USA

PostPosted: Tue Oct 29, 2013 8:00 pm    Post subject: Reply with quote

How far does the kernel get? I'd assume there's a problem with the kernel instead of tar or rsync (unless you have extraneous files lying around when restoring over a broken system versus a wiped disk... this is a different problem).

I personally have been doing system backups this way as well (except I do full system, including /home, /etc, and /var), which has been working mostly (Gnome tends to sometimes break but usually is OK). However I still have to handle the boot loader separately - whenever I do a restore, the boot loader needs to be reinstalled manually. The kernel tends to be in a different partition so that needs to be backed up separately.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
shazeal
Tux's lil' helper
Tux's lil' helper


Joined: 03 May 2006
Posts: 140
Location: New Zealand

PostPosted: Tue Oct 29, 2013 8:54 pm    Post subject: Reply with quote

Each time I have completely repartitioned the disk. The kernel just hangs after grub, then If I re-compile/re-install the kernel+grub via a bootcd/chroot it gets to detecting the "root" disk and fails. It never gets to passing off to Init. I believe the last time I did actually get it working by copying the kernel config from my debian box.
But even redownloading the source and recompiling the old built-in kernel resulted in non booting kernel, which tbh makes no sense. The partition numbers never changed, I wasnt using UUID, and like I said the AHCI controller stuff was built into the kernel.

I guess it could be how I am actually doing the restore / sequence I am doing things. Could you detail the steps you take when restoring?
_________________
CFLAGS="-OmgWTFR1CE --fun-lol-loops --march=asmx86go"
Back to top
View user's profile Send private message
shazeal
Tux's lil' helper
Tux's lil' helper


Joined: 03 May 2006
Posts: 140
Location: New Zealand

PostPosted: Tue Oct 29, 2013 8:55 pm    Post subject: Reply with quote

Also which kernel setup do you use?
_________________
CFLAGS="-OmgWTFR1CE --fun-lol-loops --march=asmx86go"
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3601
Location: USA

PostPosted: Tue Oct 29, 2013 10:17 pm    Post subject: Reply with quote

The theory is if you back up your kernel image, it should work as is - and I do save that binary. There should be no reason to recompile.

From what I'm seeing, if you're using grub, you are getting the grub boot menu. You select the kernel, and then the kernel does or does not start running? It seems you're implying it does get to disk detect...

So is it failing with "cannot find root disk" ?

Or is it hanging just before "Starting init"?

Can you set your init to /bin/bash?

One thing that you must get right is your /dev partition. Make sure you have /dev/null, /dev/console, and /dev/zero in your archive correctly. Many things will puke badly without these set, even with udev.

(Come to think of it I'm now pretty certain your /dev is probably what's causing your machine to not boot properly. On a udev system, especially if you copy/tar excluding /dev, it will of course not tar the contents of that directory - and leaving it empty will cause issues.)
Back to top
View user's profile Send private message
shazeal
Tux's lil' helper
Tux's lil' helper


Joined: 03 May 2006
Posts: 140
Location: New Zealand

PostPosted: Wed Oct 30, 2013 12:22 am    Post subject: Reply with quote

That makes perfect sense about the /dev stuff, it is booting upto cannot find root disk and not seeing /dev/sdx. How do I handle this with tar / rsync then? Or would it just be easier to extract /dev from a stage3 tarball?
_________________
CFLAGS="-OmgWTFR1CE --fun-lol-loops --march=asmx86go"
Back to top
View user's profile Send private message
shazeal
Tux's lil' helper
Tux's lil' helper


Joined: 03 May 2006
Posts: 140
Location: New Zealand

PostPosted: Wed Oct 30, 2013 12:32 am    Post subject: Reply with quote

Just to confirm unpacked /dev from a stage 3 and its packed with stuff. No wonder it never worked.

EDIT: Also noticed /run/openrc is a thing! So even if the kernel had recognised the dev stuff openrc would have failed I am guessing?
I think thats what happened with the debian kernel I put in the gentoo partition it got to Init but just bailed.
_________________
CFLAGS="-OmgWTFR1CE --fun-lol-loops --march=asmx86go"
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3601
Location: USA

PostPosted: Wed Oct 30, 2013 6:11 am    Post subject: Reply with quote

Udev/openrc should populate /dev with the correct entries as long as the three base entries are there (console, null, zero). However devtmpfs is needed now in the kernel for udev, but since you had a working machine, it should still work on restore...

I don't know what kernel Debian uses but if it does not have devtmpfs it will not work with Gentoo init.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum