Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Backups with tar gone wrong
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
CloseYetFar
Tux's lil' helper
Tux's lil' helper


Joined: 17 Aug 2006
Posts: 102

PostPosted: Tue Jun 03, 2008 1:59 pm    Post subject: Backups with tar gone wrong Reply with quote

Hi, I tried to backup my system with tar and then restore it to another hard drive, and its not working out to well. Here is what I did to back it up. While the system was running and using a root account I ran this command:

tar -czvpf /home/tony/main/systemBackup_2008_Mar_27.tar.gz /bin /boot /etc /lib /media /mnt /opt /root /sbin /usr /var

I got a backup file of about 4 Gigs. Now with the new hard drive, I installed the boot loader, created the new partitions, which are about the same size, and set the disk up just like the original:

/dev/sda1 ext2 /boot
/dev/sda2 swap swap
/dev/sda3 reiserfs /
/dev/sda4 extended partition
/dev/sda5 reiserfs /usr
/dev/sda6 reiserfs /var
/dev/sda7 reiserfs /tmp
/dev/sda8 reiserfs /home

I then formated them as ext2 or reiserfs for whatever they are. I used the gentoo livecd, mounted them to the correct mount locations which was /mnt/gentoo for / and everything else to like /mnt/gentoo/usr or whatever. Untared the system with "tar -xzvpf systemBackup_2008_Mar_27.tar.gz -C /mnt/gentoo". I checked the filesystems and everything seemed to be in order, unmounted everything and rebooted.

When I powered on, the kernel came up fine and everything looked good. But when it went to mount /dev/sda3 the system crashed and tuned off and restarted. On the next reboot the kernel came up and said the / filesystem was corrupt. When I ran reiserfsck --check on sda3 it said that file system was corrupt.

I redid everything and checked /dev/sda3 and the filesystem was fine. When I started it up the same thing happened and sda3 was once again corrupt.

Any Ideas? Has anyone done this before? This should work, people have been doing this for years. Thanks
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Tue Jun 03, 2008 3:14 pm    Post subject: Reply with quote

Does "tar tf xxx.tar" give you the output you expect?
(Sorry, you'll need to add whichever compression flags
you used to that command).

Will
Back to top
View user's profile Send private message
CloseYetFar
Tux's lil' helper
Tux's lil' helper


Joined: 17 Aug 2006
Posts: 102

PostPosted: Tue Jun 03, 2008 4:03 pm    Post subject: Reply with quote

Yea its all there. The only thing I can think of is I did not back up /dev /sys /proc becaues the kernel is supposed to populate them on boot. I just create them with "mkdir /dev /sys /proc" manually after tar is finished. I'm thinking its permissions some how although everything looks right, I used -p on backup and restore with tar.
Back to top
View user's profile Send private message
ok
Guru
Guru


Joined: 11 Jul 2006
Posts: 390
Location: germany

PostPosted: Tue Jun 03, 2008 11:10 pm    Post subject: Reply with quote

Just a hint: You have to use -p when you extract the archive, while creating the tar it will be ignored (permissions are always stored).
And you could try this: http://www.gentoo.org/doc/en/udev-guide.xml#doc_chap3
Back to top
View user's profile Send private message
LesCoke
n00b
n00b


Joined: 02 Jun 2008
Posts: 48
Location: Denton, Tx

PostPosted: Wed Jun 04, 2008 1:29 am    Post subject: Reply with quote

What you say you did should work in principal. You seem to be getting past this but you said nothing about how you backed up your MBR's for for the boot drive and the /boot patition.

Something else to check, I haven't seen this to be a problem in recent kernels, but make certain that there is not a stray mtab file left in /etc. mtab lists what file systems are currently mounted, and if for some reason this file is still there with old mount information, it has been known to cause weird mounting issues.

Only other suggestion I would give is that when you do such a backup, it is best to do each mount point separately and from a live CD instead of the running kernel. But Linux should cope with that, unlike non *nix OS'.

Les
Back to top
View user's profile Send private message
CloseYetFar
Tux's lil' helper
Tux's lil' helper


Joined: 17 Aug 2006
Posts: 102

PostPosted: Wed Jun 04, 2008 1:43 am    Post subject: Reply with quote

I restored the MBR manually with the livecd. I got past grub with no problem.

As for mtab yea it would have had the mtab of the system still running. But how is that any different from a power failure, wouldn't the running mtab be left behind in that case as well?

I think next time I am gonna backup /dev /sys and /proc as well. Maybe that will help.
Back to top
View user's profile Send private message
LesCoke
n00b
n00b


Joined: 02 Jun 2008
Posts: 48
Location: Denton, Tx

PostPosted: Wed Jun 04, 2008 2:11 am    Post subject: Reply with quote

Like I said, I haven't seen recent problems with mtab still being there. Don't recall the specifics, but I recall the solution was to delete it and let it get recreated. But this was before udev.

Unless you are running a pre-udev kernel, /dev is automatically populated by most (if not all) drivers. There may still be a few that require mknod, but I can't think of any that would cause your problem.

/sys and /proc are definitely automatic. Just make certain you have the directories where they mount present in /.

I would test changing the options in fstab to noauto on the partition having problems and test doing a few mount umounts on it, to see if there are problems initially.

Short of some ABI / compiler alignment assumtions that are different between the build of reiser on the live-cd vs the kernel. I haven't done much with reiser..

Les
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