Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
backing up
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
Mr. Hahn
Apprentice
Apprentice


Joined: 05 Apr 2003
Posts: 250

PostPosted: Thu May 15, 2003 4:57 pm    Post subject: backing up Reply with quote

If I wanted to backup the entire system, codulnt' I just put the entier root directory (/ not /root) into a tar.gz file and put it on my other hard drive, then if my main drive does die, all I have to do is setup partitions, go into chroot, untar the system compile the kernel and put the bzImage into /boot (also setup lilo the way it should be)?
Back to top
View user's profile Send private message
ferringb
Retired Dev
Retired Dev


Joined: 03 Apr 2003
Posts: 357

PostPosted: Thu May 15, 2003 5:59 pm    Post subject: Re: backing up Reply with quote

Mr. Hahn wrote:
If I wanted to backup the entire system, codulnt' I just put the entier root directory (/ not /root) into a tar.gz file and put it on my other hard drive, then if my main drive does die, all I have to do is setup partitions, go into chroot, untar the system compile the kernel and put the bzImage into /boot (also setup lilo the way it should be)?

That's basically what the stage1 tarball is... Few things to note though- don't do this on a live partition w/ open files.
Personally, since having a tarball of you're *ENTIRE* fs seems like overkill to me, I'd just tarball the directories/data you want, and store that. For getting the system back up and running, use the buildpkg option- I've got binary packages built to my settings ready to go should I inadvertantly trash my system.... say I did trash my fs, I could use the binary packages to get all of the software back.
Course, there is the issue of config's- another thing to backup.
Back to top
View user's profile Send private message
Mr. Hahn
Apprentice
Apprentice


Joined: 05 Apr 2003
Posts: 250

PostPosted: Thu May 15, 2003 6:06 pm    Post subject: Reply with quote

I have plenty of disk space I can handle a 5 gig tar file. So anyways, how should I do this? You said don't do it on a live partition w/ open files, so should do it in chroot? what did you mean?
Back to top
View user's profile Send private message
GenKiller
n00b
n00b


Joined: 04 Mar 2003
Posts: 66
Location: United States of America

PostPosted: Thu May 15, 2003 6:25 pm    Post subject: Reply with quote

I may be completely off track here, but wouldn't dd be an even easier choice?

Boot up with the gentoo livecd
mount whatever drive you want to hold the backup file
dd if=/dev/partition-to-backup of=/mnt/drive/backup-file

Just throwing this out there, there is also a thread already open that discusses backups that may help you. https://forums.gentoo.org/viewtopic.php?t=28123
_________________
http://www.digital-drip.com
Back to top
View user's profile Send private message
ferringb
Retired Dev
Retired Dev


Joined: 03 Apr 2003
Posts: 357

PostPosted: Thu May 15, 2003 6:28 pm    Post subject: Reply with quote

Mr. Hahn wrote:
I have plenty of disk space I can handle a 5 gig tar file. So anyways, how should I do this? You said don't do it on a live partition w/ open files, so should do it in chroot? what did you mean?

chroot only changes what the terminal treats as root- when I say live, I mean to do it correctly you'll most likely have to boot into the livecd, and do it through there.
Mind you that you can get away w/ tarballing a live fs, it's just not a good idea (live files among other things)...

**edit.
Still didn't properly explain a live fs. Figure it thus, if you have say /dev/hda3 mounted as /, there are going to be open files on it- that's what I mean by live- in use, mounted...
Back to top
View user's profile Send private message
ferringb
Retired Dev
Retired Dev


Joined: 03 Apr 2003
Posts: 357

PostPosted: Fri May 16, 2003 8:24 pm    Post subject: Reply with quote

GenKiller wrote:
dd if=/dev/partition-to-backup of=/mnt/drive/backup-file

Well, the only downside to it is that you're backing up the actual partition (the files and the disk info)... which can be somewhat inflexible for restoring it. Basically you need an exact partition setup for restoring it...
Personally for what he's after I'd just lived boot, mount the dir, and tar it... that way it can be restored to any partition (as long as size allows) rather then dding the partition and being able to restore it only to a matching partition setup.
Don't get me wrong- dding a partition is quite useful, I used to do it when I was working on a 16mb setup- quite an easy way to backup everything you've done, and restore in the event of a screw up. Course that only had one partition...
Back to top
View user's profile Send private message
Mr. Hahn
Apprentice
Apprentice


Joined: 05 Apr 2003
Posts: 250

PostPosted: Fri May 16, 2003 9:57 pm    Post subject: Reply with quote

ferringb wrote:


**edit.
Still didn't properly explain a live fs. Figure it thus, if you have say /dev/hda3 mounted as /, there are going to be open files on it- that's what I mean by live- in use, mounted...


cool, that's what I thought. ok, live cd but no chroot. yeah I'm an idiot, just mount the /dev/hdb3 and tar it up. One more question, if I tar up a directory, does it come out as files when I untar it, or does it come out as that directory? I never had that many opotunities to tar something up, guess I'll do a few tests :roll: .
Back to top
View user's profile Send private message
nil
n00b
n00b


Joined: 02 Mar 2003
Posts: 16
Location: california, usa

PostPosted: Fri May 16, 2003 10:33 pm    Post subject: Re: backing up Reply with quote

Mr. Hahn wrote:
..into a tar.gz file and put it on my other hard drive


i'm using an 8gb tmp partition to hold iso sized tar balls which i make using cdbkup* .. having the primary tar in cd size chunks is great.. and the peace of mind that comes from a nightly incremental tar into that temp space is kindof nice too.

emerge ckbkup

8) nil


fwiw, the tmp space is mounted as /mnt/parts/tmp and the symlink goes to /mnt/parts/tmp/tmp/

i've done it this way to also make a target/home for /mnt/parts/tmp/log and /mnt/parts/tmp/ccache.. works for me right now.


*make sure you list each path you want to exclude with -e notme .. and know that the final param specifies where the output goes; it always starts the backup from /
_________________
yesterday is just a story
Back to top
View user's profile Send private message
ferringb
Retired Dev
Retired Dev


Joined: 03 Apr 2003
Posts: 357

PostPosted: Sat May 17, 2003 1:59 am    Post subject: Reply with quote

Mr. Hahn wrote:
One more question, if I tar up a directory, does it come out as files when I untar it, or does it come out as that directory? I never had that many opotunities to tar something up, guess I'll do a few tests :roll: .

say I were to do
Code:
tar -cf test.tar directorya directoryb

the tar ball would have the files stored as directorya/file1, directorya/file2, directoryb/file9, etc...
Alternatively, you could use -C to specify a directory to change to... downside being that if you did
Code:
tar -cf test.tar -C dir *
bash/*sh seems to do the '*' substitution prior to starting the binary... meaning instead of having tar grab the files w/in the 'dir', it passes to tar the files in the current directory. On the other hand...
Code:
tar -cf test.tar -C dir .

Would work, since the shell doesn't do any substitution against it (so tar is left to handle it, and gets the correct files).
Probably way more info then what you're after...
Back to top
View user's profile Send private message
Mr. Hahn
Apprentice
Apprentice


Joined: 05 Apr 2003
Posts: 250

PostPosted: Sat May 17, 2003 2:18 pm    Post subject: Reply with quote

this is funny, did a :

tar cvf - . | gzip > /mnt/backUp/backUp.tar.gz inside the directory mounted as /dev/hda3 (live cd). My computer crashed because I think by doing it that way (tar and gzip at the same time) it puts the tar in memory, and I don't have 7 gigs of memory (just one) :oops: . I'm gonna have to try it again ans do archiving and compression separate. :twisted:
Back to top
View user's profile Send private message
ferringb
Retired Dev
Retired Dev


Joined: 03 Apr 2003
Posts: 357

PostPosted: Sat May 17, 2003 8:34 pm    Post subject: Reply with quote

Mr. Hahn wrote:
this is funny, did a :

tar cvf - . | gzip > /mnt/backUp/backUp.tar.gz inside the directory mounted as /dev/hda3 (live cd). My computer crashed because I think by doing it that way (tar and gzip at the same time) it puts the tar in memory, and I don't have 7 gigs of memory (just one) :oops: . I'm gonna have to try it again ans do archiving and compression separate. :twisted:

Hmm. that's quite fscked up. Offhand, and I'm no expert, it should be doing a stream between the two... which means it shouldn't be storing the majority of it in memory.
Whats possible, although I don't know the exact details of it, is that you ran into the big-file limit (roughly 2gb in a standard vanilla kernel).
One thing you could do also, is use the following flags w/ tar to do the compression (meaning no need to pipe it to a compresser, the ability to handle bzip2 and gzip are built into tar).
'-j' => it's a bzipped tarball (regardless of creating or extracting).
'-z' => it's a gzipped tarball (same).
Also, curious, but this is something that's bugged me for a long time- exempting weird cases, I've always seen bzip2 beat gzip (sometimes not by much, but usually like 3-6% I'd say) for most files (for binary files gzip seems to be on more equal footing).
Why does everyone use gzip rather then bzip2? Yes, bzip2 compression takes longer then gzip, but for decompression they seem to be on about equal footing (added bzip produces smaller files)...
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