Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

[Howto] Creation of a Stage 5 archive

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
79 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • Next
Author
Message
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Tue Mar 13, 2007 12:24 pm

nth10sd wrote:pardon my ignorance, i've been away awhile but what is stage 5?

stage 1 = everything incl. bootstrap
stage 2 = no bootstrap
stage 3 = precompiled binaries
stage 4 = ?
stage 5 = ??

Is it something to do with liveCDs?
Stage 4 is a backup stage from Blinkeye.
Stage 5 is an another methode to backup a existing installation.

I choose the next number to create this script.
Top
nth10sd
n00b
n00b
Posts: 54
Joined: Fri Dec 31, 2004 8:28 am

  • Quote

Post by nth10sd » Tue Mar 13, 2007 12:27 pm

ok thanks for the info!
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Tue Mar 13, 2007 12:43 pm

No problem :)
Top
steveL
Watchman
Watchman
Posts: 5153
Joined: Wed Sep 13, 2006 1:18 pm
Location: The Peanut Gallery

  • Quote

Post by steveL » Wed Mar 28, 2007 3:44 pm

likewhoa wrote:my method to backup/clone a system for transfering to another system of the same -march is simple..

Code: Select all

tar cvjp --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/stage4.tar.bz2 --file stage4.tar.bz2 /
then simply scp that tarball to your new system,.. untar it, then simply cd into the /mnt/gentoo/dev directory and run

Code: Select all

MAKEDEV generic
this will create the necessary nodes. after mount proc & dev then finally chroot to it. that's it; you should know the rest. :)
Thanks for the info; you say we know the rest, but I'm not looking to do a new install, but copy to a new hard drive. I'm guessing that I do this from a live disk then set up grub and I'm good to go?
Is it ok to do this from a running system (I'm thinking of temp files in the home directory.) Also, it seems like this would be the definitive line?:

Code: Select all

tar cvjp --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/stage4.tar.bz2 --exclude=/tmp --exclude=/var/tmp --include=/dev/null --include=/dev/console --file stage4.tar.bz2 /
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Wed Mar 28, 2007 4:58 pm

I think :)
Top
likewhoa
l33t
l33t
Posts: 778
Joined: Wed Oct 04, 2006 12:28 pm
Location: Brooklyn, New York
Contact:
Contact likewhoa
Website

  • Quote

Post by likewhoa » Wed Mar 28, 2007 5:07 pm

steveL wrote:
likewhoa wrote:my method to backup/clone a system for transfering to another system of the same -march is simple..

Code: Select all

tar cvjp --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/stage4.tar.bz2 --file stage4.tar.bz2 /
then simply scp that tarball to your new system,.. untar it, then simply cd into the /mnt/gentoo/dev directory and run

Code: Select all

MAKEDEV generic
this will create the necessary nodes. after mount proc & dev then finally chroot to it. that's it; you should know the rest. :)
Thanks for the info; you say we know the rest, but I'm not looking to do a new install, but copy to a new hard drive. I'm guessing that I do this from a live disk then set up grub and I'm good to go?
Is it ok to do this from a running system (I'm thinking of temp files in the home directory.) Also, it seems like this would be the definitive line?:

Code: Select all

tar cvjp --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/stage4.tar.bz2 --exclude=/tmp --exclude=/var/tmp --include=/dev/null --include=/dev/console --file stage4.tar.bz2 /

Code: Select all

rm -rf /usr/portage/distfiles/* && rm -rf /var/tmp/portage/* && rm -rf /var/log/portage/* && tar cvjp --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/stage4.tar.bz2 --exclude=/tmp --file /stage4.tar.bz2 /
is more like it. then to restore boot with livecd then do the following steps after you have mounted the partition to /mnt/gentoo

Code: Select all

cd /mnt/gentoo && tar xvjpf stage4.tar.bz2 && mkdir {dev,proc,tmp,sys} && chmod 1777 tmp && cd dev && MAKEDEV generic && mount -t proc none /mnt/gentoo/proc && mount -o bind /dev /mnt/gentoo/dev 

then just copy /etc/resolv.conf if needed them chroot to it, setup grub etc.. /sys will be regenerated for you, just add it to fstab.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Mon Apr 09, 2007 6:25 pm

I rewritted the howto, so if you have any comments or update that you want, just post :)
Top
likewhoa
l33t
l33t
Posts: 778
Joined: Wed Oct 04, 2006 12:28 pm
Location: Brooklyn, New York
Contact:
Contact likewhoa
Website

  • Quote

Post by likewhoa » Tue Apr 10, 2007 6:42 am

thanks for the guide, a stage4/5 is a great way to clone a Gentoo server and rapidly deploy it on a server with the same arch.
Top
alexdu
n00b
n00b
Posts: 49
Joined: Tue Oct 25, 2005 5:24 pm
Location: Moscow, Russia

Re: [Howto] Creation of a Stage 5 archive

  • Quote

Post by alexdu » Wed Apr 25, 2007 9:13 am

d2_racing wrote: Yes, send an example with the tar or something else plz :)
Yeah, your are right, tar is not useful for raw disk images :)

I guess

Code: Select all

cat /dev/hda | bzip2 | ssh user@host "cat > /home/user/hda.backup.010107.bzip"
could be an example?
Top
dR0PS
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 116
Joined: Sun Feb 27, 2005 9:18 pm
Location: DE/Hamburg

  • Quote

Post by dR0PS » Sun Apr 29, 2007 12:58 pm

likewhoa wrote:
steveL wrote:
likewhoa wrote:my method to backup/clone a system for transfering to another system of the same -march is simple..

Code: Select all

tar cvjp --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/stage4.tar.bz2 --file stage4.tar.bz2 /
then simply scp that tarball to your new system,.. untar it, then simply cd into the /mnt/gentoo/dev directory and run

Code: Select all

MAKEDEV generic
this will create the necessary nodes. after mount proc & dev then finally chroot to it. that's it; you should know the rest. :)
Thanks for the info; you say we know the rest, but I'm not looking to do a new install, but copy to a new hard drive. I'm guessing that I do this from a live disk then set up grub and I'm good to go?
Is it ok to do this from a running system (I'm thinking of temp files in the home directory.) Also, it seems like this would be the definitive line?:

Code: Select all

tar cvjp --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/stage4.tar.bz2 --exclude=/tmp --exclude=/var/tmp --include=/dev/null --include=/dev/console --file stage4.tar.bz2 /

Code: Select all

rm -rf /usr/portage/distfiles/* && rm -rf /var/tmp/portage/* && rm -rf /var/log/portage/* && tar cvjp --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/stage4.tar.bz2 --exclude=/tmp --file /stage4.tar.bz2 /
is more like it. then to restore boot with livecd then do the following steps after you have mounted the partition to /mnt/gentoo

Code: Select all

cd /mnt/gentoo && tar xvjpf stage4.tar.bz2 && mkdir {dev,proc,tmp,sys} && chmod 1777 tmp && cd dev && MAKEDEV generic && mount -t proc none /mnt/gentoo/proc && mount -o bind /dev /mnt/gentoo/dev 

then just copy /etc/resolv.conf if needed them chroot to it, setup grub etc.. /sys will be regenerated for you, just add it to fstab.
for me i got some headache while untarring with these tar options

Code: Select all

cd /mnt/gentoo && tar xvjpf stage4.tar.bz2
i had to use

Code: Select all

cd /mnt/gentoo && tar xvjpfP stage4.tar.bz2
Note the capital P
elsewhise all softlinks that point to sth. with '/' at the target would get lost (pointing to nirvana)
.... so i believe thats important !!!!!

pls, correct if i'm wrong on here but at least only these options worked for me.

dR0PS

~x86 gentoo / zen-sources 2.6.36-zen1
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Mon Apr 30, 2007 4:27 pm

It's the first time that I heard about this P problem...
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Mon Apr 30, 2007 4:27 pm

I will check this out tomorrow :)
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Sat May 05, 2007 3:46 pm

For my configuration, I don't need to add the P....

What kind of encoding do you use ?
Top
Dieter@be
Guru
Guru
Posts: 314
Joined: Sun Apr 03, 2005 7:19 pm
Location: Wetteren, Belgium
Contact:
Contact Dieter@be
Website

  • Quote

Post by Dieter@be » Sat Jun 23, 2007 9:45 am

Why didn't you just edit the variables in the stage 4 script?
The values in there are meant to be defaults and users are able to add and remove directories as they wish
Nothing beats a ride on the Gentoo learning curve.
2 Gentoo Linux boxes - 2 Arch Linux boxes - Love all four
Say no to i386 binaries! -- Adopt an unanswered topic
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Sat Jun 23, 2007 3:32 pm

Because the Stage 4 doesn't backup a complete partition.

I don't want to include each and every directories in the Stage 4 script.
Top
Dieter@be
Guru
Guru
Posts: 314
Joined: Sun Apr 03, 2005 7:19 pm
Location: Wetteren, Belgium
Contact:
Contact Dieter@be
Website

  • Quote

Post by Dieter@be » Sat Jun 23, 2007 3:50 pm

Are you sure about that?

Of course it does not "backup partitions" (or file systems, which is probably what you mean?) but it recursively backups all the directories (mountpoints) you want if you just configure some variables.
$default_include_folders: folders which need to be included in the backup recursively for a minimal working system.

$custom_include_list: directories which are not imperative for a working system but which may be desirable to be also saved by your backup interactively (like /home or /usr/src/)
Unless the *_exclude_{list,pattern} variables match stuff you need, it should back up everything you want, or am I missing something?

http://blinkeye.ch/mediawiki/index.php/ ... _customise

Also, backing up complete file systems makes a backup less convenient imho (less flexibility, fragmented state of file systems, ...) Especially since creating file systems is so easy to do (you could even script it ;-) ) edit: hmm after studying your code a bit more you also need to create the new file system. I honestly don't see the use.
Nothing beats a ride on the Gentoo learning curve.
2 Gentoo Linux boxes - 2 Arch Linux boxes - Love all four
Say no to i386 binaries! -- Adopt an unanswered topic
Top
zxy
Veteran
Veteran
User avatar
Posts: 1160
Joined: Fri Jan 06, 2006 8:07 am
Location: in bed in front of the computer
Contact:
Contact zxy
Website

Re: [Howto] Creation of a Stage 5 archive

  • Quote

Post by zxy » Thu Jun 28, 2007 1:29 am

alexdu wrote:
d2_racing wrote: Now you will have a Gentoo back on track.
Hi.

I don't understand :?
if someone needs to make/restore a *nix snapshot why do not use simple low level coping:

Code: Select all

# cp /dev/hda1 ...
; or even
# cp /dev/hda ...
; later mount LiveCD and do back
# cp ... /dev/hda1
; or
# cp ... /dev/hda
you can pipe it any way you want - tar, scp, bzip...

Also, playing with tools like resize_reiserfs you can shrink or expand your partition.
You can also change the physical order of restored partitions - all you need is to fix /etc/fstab after restore. (and may be somewhere else if you use raw hard disk access somewhere - it's unusual case)
If you want to change something in the saved binary image, you can mount it as a loop device: mount -o loop file... mountpoint.... , while it is a single partition and not compressed or splitted.
Simple cp won't preserve atimes for example (and some other things too), and some software uses that. So when you restore the data you'll find yourself in some problems.
I once read a nice document about this on the internet, but (by murphy) I can't find it now. Maybe more luck later...

EDIT: Indeed... here is the link describing (also) the possible problems with different ways of backing up unix systems: http://www.halfgaar.net/backing-up-unix
Nature does not hurry, yet everything is accomplished.
Lao Tzu
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Thu Jun 28, 2007 11:30 am

Thanks for the article :)
Top
Roman_Gruber
Advocate
Advocate
Posts: 3854
Joined: Tue Oct 03, 2006 8:43 am
Location: Austro Bavaria

  • Quote

Post by Roman_Gruber » Thu Jun 28, 2007 11:38 am

Hi
The Stage 5 act like Ghost or Acronis True Image.In fact, you can backup a complete partition.With this stage, you can backup a complete HDD and transfer it to a new one without any problems.The technique can be use by administrator, because in case of a crash, they can restore only the partition that failed.
As I have seen Acronis True Image is mentioned.

Does this script really reconstruct everything?

Does this script restore on a new individual harddisk my windo**s, my ntfs-data-partition, my root partition with ext3, my boot partition with ext2?
What does this script with partioning? Assume i want to restore it to a smaller/bigger hdd? Do I have to use gparted before? Is the MBR proper restored? Is grub proper restored?

Thanks, Roman
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Thu Jun 28, 2007 4:00 pm

Ok, the Stage 5 is use to backup a *nix parittion.

So everything from ext2,ext3,ReiserFS etc... can do the job.

But, I didn't test for a FAT32 partition.

Also, you cannot bakcup a NTFS partition with the Stage 5 script and the MBR.

But, Acronis True Image can backup a HDD that constain a NTFS,EXT3,EXT2 and also a MBR without any troubles.
Top
slycordinator
Advocate
Advocate
User avatar
Posts: 3065
Joined: Sat Jan 31, 2004 9:51 pm
Location: Korea

  • Quote

Post by slycordinator » Tue Aug 07, 2007 1:23 am

1) Why do "rm /usr/portage/distfiles/*"? Instead of removing your distfiles, just have that directory excluded.

2) The major reason that you created this script is because stage4 didn't (previously) copy /dev/console for you and currently doesn't copy /dev/tty1 for you. On the other hand, copying /dev/tty1 can be done with stage4 by adding it to the default include list.
Top
likewhoa
l33t
l33t
Posts: 778
Joined: Wed Oct 04, 2006 12:28 pm
Location: Brooklyn, New York
Contact:
Contact likewhoa
Website

  • Quote

Post by likewhoa » Tue Aug 07, 2007 1:52 am

for a succesfull boot you only need /dev/{console,null} /dev/tty is not mandatory to have, and udev would generate that anyways for you after the init sequence begins.
Top
slycordinator
Advocate
Advocate
User avatar
Posts: 3065
Joined: Sat Jan 31, 2004 9:51 pm
Location: Korea

  • Quote

Post by slycordinator » Tue Aug 07, 2007 5:17 pm

likewhoa wrote:for a succesfull boot you only need /dev/{console,null} /dev/tty is not mandatory to have, and udev would generate that anyways for you after the init sequence begins.
But apparently it is needed for gensplash.
Top
likewhoa
l33t
l33t
Posts: 778
Joined: Wed Oct 04, 2006 12:28 pm
Location: Brooklyn, New York
Contact:
Contact likewhoa
Website

  • Quote

Post by likewhoa » Tue Aug 07, 2007 6:12 pm

agreed.
Top
slycordinator
Advocate
Advocate
User avatar
Posts: 3065
Joined: Sat Jan 31, 2004 9:51 pm
Location: Korea

  • Quote

Post by slycordinator » Tue Aug 07, 2007 7:43 pm

My point, though, was that a new backup method is unnecessary to get what he wanted.
Top
Post Reply

79 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic