Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
make your own Stage4 mini HOWTO
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  Next  
This topic is locked: you cannot edit posts or make replies.    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
DaNIsH
Apprentice
Apprentice


Joined: 01 Jan 2003
Posts: 197
Location: Melbourne, Australia.

PostPosted: Mon Jul 05, 2004 1:09 pm    Post subject: Reply with quote

kamina wrote:
Will I end up with a working backup if I exclude /proc /var/tmp /usr/portage/distfiles /mnt and /tmp?

Possibly, but IMO it's probably safer to just exclude the contents of certain dirs, as I mentioned in an above post.
_________________
Adopt an unanswered post today
Back to top
View user's profile Send private message
nekranos
n00b
n00b


Joined: 07 Apr 2004
Posts: 52

PostPosted: Wed Jul 07, 2004 5:52 pm    Post subject: Reply with quote

I just tested out the backup I made (three times in the past week, in fact, all due to stupidity). Works perfectly.

I didn't pass any options to "exclude" any directories, since I booted from a LiveCD, mounted up the drives, then tar.bz2'd up everything. Restoring it doesn't seem to cause any issues, either.
Back to top
View user's profile Send private message
T-Bird
n00b
n00b


Joined: 28 Mar 2003
Posts: 71

PostPosted: Sun Jul 11, 2004 9:06 pm    Post subject: Reply with quote

Before I try to update my system I'm backing up again just to make sure I can get the system back up if things screw up.

The command line I used for this was:

Code:
tar cjpf /home/stage4.tar.bz2 / --exclude=stage4.tar.bz2 --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* --exclude=/mnt/cdrom/* --exclude=/mnt/floppy/* --exclude=/usr/portage/distfiles/*


I'll have to see how big the file is now.
Back to top
View user's profile Send private message
T-Bird
n00b
n00b


Joined: 28 Mar 2003
Posts: 71

PostPosted: Sun Jul 11, 2004 11:42 pm    Post subject: Reply with quote

I found out on of the reasons for such a big backup was because of an mp3 directory that I forgot to exclude. Hopefully things will become a little less now.

Last edited by T-Bird on Thu Aug 26, 2004 4:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
CiscoSid
n00b
n00b


Joined: 14 Jun 2004
Posts: 6

PostPosted: Fri Jul 16, 2004 6:16 pm    Post subject: Custom Live CD? Reply with quote

Anyone know if it's possible to combine a stage4.tar.bz2 into a live disc?

My stage4 is around 600MB, but is it possible to create a DVD iso image from the original LiveCD and add my stage4 to the stages dir?

That way I could just boot from a live DVD, and extract my stage4...
_________________
Asus A7N8X Deluxe 2.0 | AMD XP 2400 | ATI 9600XT
Back to top
View user's profile Send private message
amiatrome
Apprentice
Apprentice


Joined: 28 Jun 2004
Posts: 180
Location: Campus | Arena Country Club | Home

PostPosted: Fri Jul 16, 2004 8:02 pm    Post subject: Reply with quote

Is it possible to tar up our fresh windows install partition and just restore the fresh install from within Linux instead of reinstalling windows all over again the next time? :?:
Back to top
View user's profile Send private message
Grilo
Tux's lil' helper
Tux's lil' helper


Joined: 22 Apr 2003
Posts: 114
Location: Canada

PostPosted: Thu Jul 29, 2004 3:33 pm    Post subject: Reply with quote

Something i think everyone could use from this thread is a good script. Since I have no clue what a script is I asked a good friend, the one who introduced me to linux, to make me one. Here is the script for this backing up and a script to put it back together. I hope it is useful and if you have questions ask me and i'll see what I can do.

Code:

#!/bin/bash
# Backup script for Gentoo Linux
# Author: fdavid
# Date: 2003.11.29.
# Modified by Luke MacGregor, to have more than just the /home dir
# backed up.
# Date: 2004.07.29

# Actual changes:
# 1. Made it use a command line argument to get the backup destination directory.
#    The usage is like this: "backup <directory to send backup file>"

# Designating which dirs to exclude in the backup process. You might want to change
# this depending on what your needs are.

if [ $# -lt 1 ]; then
   "echo usage: ./backup <backup file destination>"
   exit 1
fi

dirsExclude="--exclude=/mnt/* --exclude=/proc --exclude=/sys --exclude=/tmp --exclude=/usr/portage/distfiles --exclude=/var/tmp/*"

# options for the archive
tarOptions="cvjpf"

# name of the archive
archive=$1$(date +%Y%m%d).tar.gz

# create the archive
tar ${tarOptions}  ${archive} / --exclude=${dirsExclude} --exclude=${archive} 

echo archive is done

# split the archive to cd size (use: "cat ${archive}.* >> ${archive}" to join the parts)

split --bytes=700000000 ${archive} ${archive}.

echo splitting is done


and the put back

Code:

#!/bin/bash
echo You should be doing this as root. If you are not, it may result in errors.

if [ $# -lt 1 ]; then
        "echo usage: ./putback <backup file root name>"
        exit 1
fi

cat $1* > $1

echo Done putting backup together
echo Now mount your drives, and untar the full backup using something like:
echo tar xvjpf filename.tar.gz


I hope this works for you.

Thanks for the help on the forum to all.

Grilo
_________________
Knowledge is power but the drive to learn is harnessing wizdom
Back to top
View user's profile Send private message
Phage64
n00b
n00b


Joined: 31 Jul 2004
Posts: 42

PostPosted: Mon Aug 02, 2004 3:42 pm    Post subject: Reply with quote

I believe there is one minor error in the above script...
Code:

# create the archive
tar ${tarOptions}  ${archive} / --exclude=${dirsExclude} --exclude=${archive}


should be:
Code:

# create the archive
tar ${tarOptions}  ${archive} / ${dirsExclude} --exclude=${archive}


right?

and for gentoo you should also have /dev excluded
Back to top
View user's profile Send private message
kalisphoenix
Apprentice
Apprentice


Joined: 28 Sep 2003
Posts: 211
Location: Ohio

PostPosted: Sun Aug 08, 2004 6:14 am    Post subject: Reply with quote

Yummy howto and thanks for the additional info, everyone. Let's hope that I don't need this anytime soon ;-)
Back to top
View user's profile Send private message
ixtow
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2004
Posts: 102

PostPosted: Sun Aug 15, 2004 3:08 am    Post subject: This would be great, if..... Reply with quote

I was getting:

Code:

tar: Cowardly refusing to create an empty archive


So, as stated in this thread, I eliminated the "C"

Code:

# tar cjpf /home/public/stage4.tar.bz2 --exclude=stage4.tar.bz2 --exclude=/proc --exclude=/mnt --exclude=/tmp --exclude=/usr/portage/distfiles --exclude=/sys
tar: Cowardly refusing to create an empty archive
Try `tar --help' for more information.


As you can see, this had no effect at all.

I added the "v" to see if it would tell me something and...

Code:

# tar cvjpf /home/public/stage4.tar.bz2 --exclude=stage4.tar.bz2 --exclude=/proc --exclude=/mnt --exclude=/tmp --exclude=/usr/portage/distfiles --exclude=/sys
tar: Cowardly refusing to create an empty archive
Try `tar --help' for more information.


...I got jack...

It would seem that tar is just a coward and plain flat doesn't create archives at all....
Back to top
View user's profile Send private message
ixtow
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2004
Posts: 102

PostPosted: Sun Aug 15, 2004 3:14 am    Post subject: Reply with quote

And, just to be thorough....

Code:


# tar cvjpf /home/public/stage4.tar.bz2 --exclude=stage4.tar.bz2 --exclude=/proc --exclude=/mnt --exclude=/tmp --exclude=/usr/portage/distfiles --exclude=/sys --exclude=/home
tar: Cowardly refusing to create an empty archive
Try `tar --help' for more information.

# tar cvjpf /home/public/stage4.tar.bz2
tar: Cowardly refusing to create an empty archive
Try `tar --help' for more information.

# tar cjpf /home/public/stage4.tar.bz2
tar: Cowardly refusing to create an empty archive
Try `tar --help' for more information.

# tar cCjpf /home/public/stage4.tar.bz2
tar: Old option `f' requires an argument.
Try `tar --help' for more information.

Back to top
View user's profile Send private message
Phage64
n00b
n00b


Joined: 31 Jul 2004
Posts: 42

PostPosted: Sun Aug 15, 2004 8:46 pm    Post subject: Reply with quote

you have:
Code:

tar cvjpf /home/public/stage4.tar.bz2 --exclude=stage4.tar.bz2 --exclude=/proc --exclude=/mnt --exclude=/tmp --exclude=/usr/portage/distfiles --exclude=/sys
tar: Cowardly refusing to create an empty archive
Try `tar --help' for more information.


add a " /" in there to make it:
Code:

tar cvjpf /home/public/stage4.tar.bz2 / --exclude=stage4.tar.bz2 --exclude=/proc --exclude=/mnt --exclude=/tmp --exclude=/usr/portage/distfiles --exclude=/sys
tar: Cowardly refusing to create an empty archive
Try `tar --help' for more information.
[/code]

and you may also want to exclude /dev
Back to top
View user's profile Send private message
ixtow
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2004
Posts: 102

PostPosted: Wed Aug 18, 2004 3:57 am    Post subject: ...... Reply with quote

spread cheeks, insert boot....

I really shouldn't be allowed to post messages anymore.....
Back to top
View user's profile Send private message
tfunk
n00b
n00b


Joined: 06 Apr 2004
Posts: 67

PostPosted: Thu Aug 26, 2004 9:40 pm    Post subject: Reply with quote

I'm missing somthing. Sorry for being so dense....

I made the stage4 backup. everything okay there.
Pulled the backup off via SCP and pushed it to a new/identical machine
booted the new machine to live CD
fdisk, created filesystem, mounted swap, mounted /mnt/gentoo

Tried to use tar xvjpf stage4.tar.bz2 to unpack it

I keep getting Cannot write: No space left on device errors

I know sense everyone else it seems to be working for that I HAVE to be missing something dumb because I'm noob.

Can someone help me figure out what it is?

Thanks!

Tfunk
_________________
========================================================
ILLEGITIMUS NON CARBORUNDUM
========================================================
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Fri Aug 27, 2004 2:34 am    Post subject: Reply with quote

check your file partitions (with fdisk or cfdisk). You may have fudged something up during that part of the install. or, for a quick check, try 'df -h' to see how much space you have.
Back to top
View user's profile Send private message
tfunk
n00b
n00b


Joined: 06 Apr 2004
Posts: 67

PostPosted: Fri Aug 27, 2004 4:09 am    Post subject: Reply with quote

I give up for the time being...

I'm just going to install from scratch and then try it again. I'm anxious to get this working for backups :)

Thanks for the help thought. I got into it and relised that for some reason I had /mnt/gentoo/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot/boot so I must have had somthing pretty screwed up.

back to the drawing board :)

Thanks!

Tfunk[/code][/quote]
_________________
========================================================
ILLEGITIMUS NON CARBORUNDUM
========================================================
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Fri Aug 27, 2004 4:19 am    Post subject: Reply with quote

nope. boot is symlinked to itself.
Back to top
View user's profile Send private message
Deranger
Veteran
Veteran


Joined: 26 Aug 2004
Posts: 1215

PostPosted: Tue Sep 14, 2004 8:51 pm    Post subject: Reply with quote

Great HOWTO, I just backed up my whole system.

Code:

tar cjpf /home/oktane/stage4.tar.bz2 / --exclude=stage4.tar.bz2 --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* --exclude=/var/tmp/* --exclude=/dev/* --exclude=/mnt/cdrom/* --exclude=/mnt/floppy/* --exclude=/usr/portage/distfiles/*


Hopefully this works when I screw up something ;)

EDIT: Forgot to exclude /var/tmp/* and /dev/*...Tarring again at the moment.


Last edited by Deranger on Sun Nov 21, 2004 8:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
nianderson
Guru
Guru


Joined: 06 May 2003
Posts: 369
Location: Lawrence, KS

PostPosted: Thu Sep 16, 2004 7:10 am    Post subject: Reply with quote

Check out the wiki I added 2 scripts to it one to create a stage4 and one to restore from it. appriciate any testing and feedback anyoen can offer.
http://gentoo-wiki.com/HOWTO_Custom_Stage4
down in step 6
Back to top
View user's profile Send private message
rushdy
n00b
n00b


Joined: 01 Jun 2004
Posts: 22
Location: England

PostPosted: Thu Sep 16, 2004 10:40 am    Post subject: Reply with quote

That backup script looks great, thanks. I havnt had chance to test it but i will soon. No more boot from live cd to backup by hand for me... :lol:
Back to top
View user's profile Send private message
nianderson
Guru
Guru


Joined: 06 May 2003
Posts: 369
Location: Lawrence, KS

PostPosted: Thu Sep 16, 2004 11:20 pm    Post subject: Reply with quote

I just tested the script that creates the stage4 it is a little broken but i have it fixed
one thing i added was to exclude /dev/* thats ok isnt it? everything in dev is created on boot if it dosnt exist right?


Wiki is updated with the working (at least for me) script.
including exclude /dev/* i can change that if i am wrong about dev entries being created on boot
Back to top
View user's profile Send private message
postop
n00b
n00b


Joined: 20 Dec 2003
Posts: 12
Location: Austin, TX

PostPosted: Sun Sep 26, 2004 4:27 am    Post subject: Reply with quote

This worked great except for setting up grub off the live cd.

I unpack the tar, chroot'ed into /mnt/gentoo, copied /proc/mounts into /etc/mtab. and tried to run grub-install like the handbook says, but it complains about the device not existing. I looked at the /dev dir and the only thing there is null.

I copied the /dev of the live cd into /mnt/gentoo/dev but grub-install still wouldn't work. If I did grub manually everything worked fine and runs just fine after rebooting.

Am I missing something? Is there a better way to fix this?
Back to top
View user's profile Send private message
CRC
Tux's lil' helper
Tux's lil' helper


Joined: 30 Mar 2003
Posts: 90
Location: Dallas, TX, USA

PostPosted: Sun Sep 26, 2004 8:41 am    Post subject: Copying /dev Reply with quote

First, I don't know how you copied /dev, or why anyone would try to tar /dev. Most Unix tools don't deal with /dev or sparse files properly at all! Tar will try doing weird things like putting /dev/hda into the file, which is the entire contents of your hard disk!

Sparse files are created (in C/geek talk, using open, then seek, then write/close) so that the filesystem can store very large files but only store the data you specifically write into the file. So a 2GB file might only be taking up 20MB, even if the file size says its 2GB. Tar will try to back up 2GB, not 20MB.

The solution for both problems is simple. Don't back up (or copy) using tar. The best way to back up weird stuff and preserve EVERYTHING is to use cpio instead. cpio is also a great way to copy whole directories including all subdirectories, permissions, etc (using -p). Check "man cpio". You usually feed it with "find" and then feed the output into gzip.

To backup:
find / | grep -v mybackup.cpio.gz | cpio -o -B | gzip -c >/mybackup.cpio.gz

To restore:
gzip -cd </mybackup.cpio.gz | cpio -i -Bmd

The grep just filters off the file from the list. Cpio uses -i and -o to copy "in" and "out" of the filesystem (to do both, use -p, passthrough). -B uses a larger buffer size (faster). The -m is to preserve file modification time of the original and not use the current time. The -d is to make any directories that it needs.

Have fun.
_________________
Unix/Linux Consulting & Hosting
We Support Gentoo!
http://CoolRunningConcepts.com

Freenode: Taro!
Back to top
View user's profile Send private message
Deranger
Veteran
Veteran


Joined: 26 Aug 2004
Posts: 1215

PostPosted: Sun Sep 26, 2004 9:43 am    Post subject: Reply with quote

I don't know about that, but tar-backup works great but you need to exclude things...

I've excluded:

/dev/*
/tmp/*
/var/tmp/*
/usr/portage/distfiles/*
/sys/*
/proc/*
/mnt/*

This Stage 4 is nice, it's like Stage 1 without bootstrapping ;)


Last edited by Deranger on Sun Nov 21, 2004 8:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
CRC
Tux's lil' helper
Tux's lil' helper


Joined: 30 Mar 2003
Posts: 90
Location: Dallas, TX, USA

PostPosted: Sun Sep 26, 2004 9:51 am    Post subject: Reply with quote

[quote= Oktane]
I don't know about that, but tar-backup works great but you need to exclude things..
[/quote]

Well, I do know about that. I just told you. Tar isn't great for system backups. You can safely backup and restore device nodes with cpio (the major and minor numbers and device types are all backed up, and I feel this is important). The handling of spare files can be really helpful for some database files.

As for excluding of files or directories, since cpio takes the list of files from stdin, you are free to modify the list however you want with the power of regular expressions.

Try it out on a test directory, try /tmp, or /home/user/testdir.
_________________
Unix/Linux Consulting & Hosting
We Support Gentoo!
http://CoolRunningConcepts.com

Freenode: Taro!
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies.    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 3 of 6

 
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