Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Stage4: Anyone any experience; good practise?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Fri Oct 23, 2009 9:33 am    Post subject: Stage4: Anyone any experience; good practise? Reply with quote

Hi,

Today its time again for backup. Last time I did rdiff-backup and I wasnt able to restore gcc, and so at the end I had to reinstall hole gentoo. What a .....


http://en.gentoo-wiki.com/wiki/Custom_Stage4

Quote:
tar cvjf /path/to/save/at/stage4.tar.bz2 / -X stage4.excl


looks simple, but If I restore this later on the same hardware, with e.g. another harddiscs and another lvm setup, will this work or not?

And Is it possible to get some files out of the archive or do I have to extract the hole stuff then?

Thx.

tar should do the job, I think. Because rdiff-backup was unable to restore my harddisc in august this year.
Back to top
View user's profile Send private message
pappy_mcfae
Watchman
Watchman


Joined: 27 Dec 2007
Posts: 5997
Location: Pomona, California.

PostPosted: Sun Oct 25, 2009 5:28 am    Post subject: Re: Stage4: Anyone any experience; good practise? Reply with quote

tw04l124 wrote:
Hi,

Today its time again for backup. Last time I did rdiff-backup and I wasnt able to restore gcc, and so at the end I had to reinstall hole gentoo. What a .....


http://en.gentoo-wiki.com/wiki/Custom_Stage4

Quote:
tar cvjf /path/to/save/at/stage4.tar.bz2 / -X stage4.excl


looks simple, but If I restore this later on the same hardware, with e.g. another harddiscs and another lvm setup, will this work or not?


That depends on whether or not you reset the kernel and other settings if your hardware changes (ie Intel CPU to AMD CPU). You would also have to be sure the LVM stuff is correct from one machine to the next.

Quote:
And Is it possible to get some files out of the archive or do I have to extract the hole stuff then?


Yes. Read the man page. I don't know the exact incantation, but I know that individual files can be pulled from a tarball without having to decompress the whole thing.

Blessed be!
Pappy
_________________
This space left intentionally blank, except for these ASCII symbols.
Back to top
View user's profile Send private message
sera
Retired Dev
Retired Dev


Joined: 29 Feb 2008
Posts: 1017
Location: CET

PostPosted: Sun Oct 25, 2009 6:27 am    Post subject: Reply with quote

A tar.bz2 / tar.gz needs to be decompressed to a tar before you are able to pull single files out of the archive.

Unlike zip archives where the single files are compressed and then packed into an archive (soft compression) tar.bz2 is a compressed tar archive (hard compression).
Hard compression is more efficient but comes at the cost of not being able to pull single files from the archive directly.
Back to top
View user's profile Send private message
desultory
Administrator
Administrator


Joined: 04 Nov 2005
Posts: 9221

PostPosted: Sun Oct 25, 2009 7:23 am    Post subject: Reply with quote

It works on compressed files, for example, to extract bash-4.0/MANIFEST.doc from bash-4.0.tar.gz just tar xvzf bash-4.0.tar.gz bash-4.0/MANIFEST.doc.
Back to top
View user's profile Send private message
sera
Retired Dev
Retired Dev


Joined: 29 Feb 2008
Posts: 1017
Location: CET

PostPosted: Sun Oct 25, 2009 10:37 am    Post subject: Reply with quote

desultory wrote:
It works on compressed files, for example, to extract bash-4.0/MANIFEST.doc from bash-4.0.tar.gz just tar xvzf bash-4.0.tar.gz bash-4.0/MANIFEST.doc.


Ok, learned something new, thanks desultory for correcting me. But I wouldn't recommend that practice if you want to extract multiple files from a large compressed tar archive as it still has to be decompressed as a whole before extracting the files. Unless you can and do specify them all at once you will generate a lot of overhead.
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6108
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sun Oct 25, 2009 10:56 am    Post subject: Reply with quote

regarding answers to your questions: pappy already has written all that needs to be known ...


to get an idea how it also could be done (with 7z):


my commands are:

compressing stuff:


for archive (with 7z compression):

time (tar -cp / -X /root/stage4.excl | 7z a -si -t7z -m0=lzma -mx=9 -mfb=64 -md=128m -ms=on -mmt=2 /bak/system/stage4-amd64-hardened_Final-71-241009.t7z)

for regular / more fast compression (with bzip2 compression):

time (tar -cp / -X /root/stage4.excl | 7z a -si -md=128m -mmt=5 -tbzip2 /bak/system/stage4-amd64-hardened_Final-62-090809.tbz2)


extracting stuff:

from bzip2 archive:

time (7z e -so -tbzip2 /bak/system/stage4-lexa-m1330_amd64_Final-11-030808.tbz2 | tar -xp -C /mnt/gentoo)

from 7z archive:

time (7z e -so -t7z -mmt=5 /home/system/stage4-amd64-hardened_Final-59-280609.t7z | tar -xp -C /mnt/gentoo)


stage4.excl:

Quote:
.bash_history
/mnt/*
/boot/*
/data/*
/data2/*
/tmp/*
/proc/*
/home/*
/sys/*
/usb/*
/dev/*
/bak/*
/bak2/*
/usr/src/sources/kernel/*
/etc/ssh/ssh_host_*
# /usr/src/*

/usr/src/linux-2.6.31-zen1_r4_test/*
/usr/src/linux-2.6.31-zen1_test/*
/usr/src/linux-2.6.31-zen4/*
/lib/modules/2.6.31-zen1_CFS_r4v/*
/lib/modules/2.6.31-zen1_cfs_r4t/*
/lib/modules/2.6.31-zen4_BFS/*

/usr/portage/*
/usr/gentoo/*
/reiserfs/*
/var/cache/edb/dep/*
/var/cache/squid/*
/var/lib/slocate/*
/var/lib/mlocate/*
/var/lib/aide/*
/media/*

_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Oct 26, 2009 10:23 am    Post subject: Reply with quote

Hi, thx you guys for your answers. Especially pappy and kernel of truth. Great guys you too.

Is a tar file faster to extract, if I dont care about compression. I think I will stick at the first time to tar, because I dont care about compression. Lots of the files are already compressed, and text files aren*t such big. In the past, if I hat a lot of bmps, there were a reason to use compression.

So: Is tar faster to restore or should I use tar.gz or tar.bz2. 7zip is nice, but I want to use something which is well tested and often used. Because its a backup. My backup drive is a esata drive, and I have a Intel(R) Core(TM)2 Duo CPU T9500 @ 2.60GHz GenuineIntel GNU/Linux CPU.

Well This time. I use tar and then I use rdiff-backup twice, so I can be sure, that my backup will work!!.

Ok, I hope the backup will be fine. THX


PS: kernel of truth: Dankeschön für deine Antwort. Die Auflistung der Befehle ist mir eh am liebsten. Translation: Thx for your answer. The command listening I do prefer.
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Mon Oct 26, 2009 12:04 pm    Post subject: Reply with quote

You should check the Stage 5 too.
Back to top
View user's profile Send private message
Kingoftherings
Guru
Guru


Joined: 04 May 2008
Posts: 328

PostPosted: Mon Oct 26, 2009 7:36 pm    Post subject: Reply with quote

tw04l124 wrote:

So: Is tar faster to restore or should I use tar.gz or tar.bz2. 7zip is nice, but I want to use something which is well tested and often used.


You can get the same compression algorithm used by 7zip by using tar.lzma
Back to top
View user's profile Send private message
hirakendu
Guru
Guru


Joined: 24 Jan 2007
Posts: 386
Location: san diego

PostPosted: Tue Oct 27, 2009 3:11 am    Post subject: Reply with quote

I am not sure if you can do it from within a running system, but I would suggest squashfs (mksquashfs and unsquashfs). Benefits - easy file access (can mount it like a iso image) and possibly use as a live disk. If only it had been writable :).

As far as matching of specs go, I don't think you'll have any issue. Example, I compile my Gentoo on a Core 2 Duo (E8400) with cflags -march=core2 in make.conf and kernel compiled for core2, and have been running on even AMD machines (Athlon64 X2 3800+ and Phenom X3) without any issues.
_________________
Helium Sources || Gentoo Minimal Livecd
Back to top
View user's profile Send private message
Ric95
Tux's lil' helper
Tux's lil' helper


Joined: 10 Apr 2007
Posts: 94
Location: Alberta Can.

PostPosted: Sat Nov 14, 2009 9:43 pm    Post subject: Reply with quote

If I may add a question to this thread;
After the last time I restored like this, when I re-added my user, my home directory got renamed with .old, and a new user directory was created.
How do you restart your normal user using your original directory in /home ?
_________________
Corporations are not like people. They don't need rights as people do, they only need an even playing field on which to compete.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software 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