Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
tar not extracting all files with correct permissions
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
manny15
Guru
Guru


Joined: 01 Dec 2002
Posts: 473
Location: USA

PostPosted: Sun May 29, 2005 6:08 pm    Post subject: tar not extracting all files with correct permissions Reply with quote

I had to restore my system from a backup tar archive because something went wrong after an emerge -u world, and my wireless card quit working. dhcpd would never return an address. I think the trouble maker was net-wireless/wireless-tools-28_pre7, but I'll save it for another post.

Anyway, when I did restore from the archive, I noticed some files that I should own were owned by root. There files were in my home directory. Here's the command I used to create the archive (It's part of my backup script):
Code:
/bin/tar cvjpf /mnt/usbhd/backups/rootfs-$DATE.tar.bz2 --wildcards --exclude "dev/*" --exclude "proc/*" --exclude "sys/*" --exclude "mnt/usbhd/*" *

To extract, I used an old gentoo liveCD (1.4_rc4), like so...
Code:
tar -xvpjf archive.tar.bz2 -C /mnt/dest

I thought the -p flag would make sure permissions were restored properly not all of them were. In addition,
Code:
chown -R user *
doesn't catch hidden files! ARG!

At first I thought it might be due to an older tar on the liveCD, but I extraced a seperate backup of my home directory once I rebooted into my new (well, older) system, and I got the same results.

Did I do something wrong?
Back to top
View user's profile Send private message
rutski89
Guru
Guru


Joined: 14 Mar 2005
Posts: 468
Location: United States N.Y.

PostPosted: Sun May 29, 2005 9:10 pm    Post subject: Reply with quote

All I can suggestion is doing backups via images with the "dd" command. Your commands look OK to me though, I'm clueless as to what is wrong.

P.S. You probably need a secondary hard drive and mabye a livecd of some sort (or linux installed on the secondary drive) to do effective dd image backups and restores.
_________________
<< ^ | ~ >>
Back to top
View user's profile Send private message
manny15
Guru
Guru


Joined: 01 Dec 2002
Posts: 473
Location: USA

PostPosted: Sun May 29, 2005 9:34 pm    Post subject: Reply with quote

I used to use partimage, but what I like about tar is that you can restore individual files. Now, I strange idea just popped in my head. What if I use dd + bzip2 to create an image file. Is there a way, using loopback, to mount a compressed image of a reiserfs filesystem? That would work great, I think. Because not only could I create an exact image, I could mount it and restore individual files too. Sure it may not compress as well as partimage, but it would be more flexible.
Back to top
View user's profile Send private message
rutski89
Guru
Guru


Joined: 14 Mar 2005
Posts: 468
Location: United States N.Y.

PostPosted: Sun May 29, 2005 9:40 pm    Post subject: Reply with quote

You are right, that would be great. I'm not sure that it would work, and I'm mainly make this post so that it can be bumped and get some more attention, hopefully from someone more knowledgeable. I'm off to play tennis, I'll check back later for sure. Good luck, it would be really sweet if you got it to work. I should also bring to your attention that I heard somehwere that writing a parition on that very same drive creates corruptions in the immage somehow, and that it is best to use a secondary drive or do it with netcat to a different computer; I'm not sure how true that is though. There also might be space issues involved in saving a drive image onto the very same drive if you have used more the 50% of the space. It seams that you have had experience with immaging more then I have, so I'll stop here.

Peace.
_________________
<< ^ | ~ >>
Back to top
View user's profile Send private message
manny15
Guru
Guru


Joined: 01 Dec 2002
Posts: 473
Location: USA

PostPosted: Sun May 29, 2005 9:54 pm    Post subject: Reply with quote

Regardless of your experience with images, thank you for your reply. I'm now considering to switch to an image-based backup procedure, but I don't think I want to go back to partimage, for reasons I've already stated. I feel like an idot for overlooking cloop. I allows you to mount compressed filesystems! I don't know alot about it, but I sure will look into it :)
Back to top
View user's profile Send private message
manny15
Guru
Guru


Joined: 01 Dec 2002
Posts: 473
Location: USA

PostPosted: Wed Jun 08, 2005 10:20 pm    Post subject: Reply with quote

Well, now I'm stumped. dd+bzip2 takes WAY too long, and partimage isn't on the Gentoo LiveCD (universal x86). I'm afraid of using tar, although I prefer file-based backups. I still can't figure out what went wrong with tar. It seemed like the perfect solution. I'm trying to depend on tools available on the Gentoo live CD. Here's my backup script.
Code:

#!/bin/sh

# A script to backup the entire system while it's live (running).

DATE=`date +"%Y%m%d"`

echo "Mounting External USB HD..."
mount /mnt/usbhd

echo "Archiving root file system..."
cd /
/bin/tar cvjpf /mnt/usbhd/backups/rootfs-$DATE.tar.bz2 --wildcards --exclude "dev/*" --exclude "proc/*" --exclude "sys/*" --exclude "mnt/usbhd/*" *
echo "Done."

echo "Archiving boot file system..."
mount /boot
cd /boot
/bin/tar cvjpf /mnt/usbhd/backups/bootfs-$DATE.tar.bz2 *
cd
umount /boot
echo "Done."

echo "System backup complete."
echo "You may now unmount /mnt/usbhd."

One thing I have learned is that I need atleast /dev/console and /dev/null, so I shouldn't exclude all of /dev.
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