View previous topic :: View next topic |
Author |
Message |
xnd Tux's lil' helper
Joined: 26 Sep 2004 Posts: 132 Location: Sherbrooke, Quebec, Canada
|
Posted: Tue Nov 23, 2004 3:14 pm Post subject: Backup of / |
|
|
Hey girls,
I am wondering which command is the best to take a backup of a whole partition, exactly as it is. I mean, i would like to backup my /, because i have some maintenance to do on it, and don't wanna loose any data, and if it's the case, would like to recover it exactly as it was before.
I can use the 'tar' command and 'dd' right? With the 'tar', what options should I use to compress/decompress in order to keep file permission?
I thought about
Code: | tar -cvzef / /stuff/rootFolder.tar.gz (/stuff is an other partition) |
And to extract Code: | tar -zxpvf /stuff/rootFolder.tar.gz / |
Does that make sense? And what about 'dd'?
Tkx!
XND _________________ They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, 'coz if you play it forwards, it installs Windows..! |
|
Back to top |
|
|
jeremy whiting Apprentice
Joined: 25 May 2004 Posts: 159 Location: UT
|
Posted: Tue Nov 23, 2004 3:25 pm Post subject: |
|
|
that'd probably work, but it'll take a long time since / has so much stuff, and the file wont be very small either. I've never seen the 'e' flag on tar either, what does it do?
If I were you I'd use these flags
Code: | tar -cjlvf / /path/to/some/file.bz2 |
that way you've got better compression 'j' means use bz2 compression
and you've got it to stay on this partition 'l' (that is a lowercase L) makes it stay on this partition. Otherwise it would back up everything even things mounted on /, so basically everything.
you might also want to --exclude=/dev,/boot or something similar if you know there are directories you don't need to back up as well. |
|
Back to top |
|
|
vonhelmet l33t
Joined: 06 Apr 2004 Posts: 770 Location: Somewhere in a school
|
Posted: Tue Nov 23, 2004 3:26 pm Post subject: Re: Backup of / |
|
|
xnd wrote: | Hey girls,
I am wondering which command is the best to take a backup of a whole partition, exactly as it is. I mean, i would like to backup my /, because i have some maintenance to do on it, and don't wanna loose any data, and if it's the case, would like to recover it exactly as it was before.
I can use the 'tar' command and 'dd' right? With the 'tar', what options should I use to compress/decompress in order to keep file permission?
I thought about
Code: | tar -cvzef / /stuff/rootFolder.tar.gz (/stuff is an other partition) |
And to extract Code: | tar -zxpvf /stuff/rootFolder.tar.gz / |
Does that make sense? And what about 'dd'?
Tkx!
XND |
Your tar command will backup stuff as well, if it is mounted at the time of the tarring. You could tell tar to exclude other directories i.e. ones where other partitions get mounted.
dd might be a better command for a single partition. You might be better with using dd and piping the output from it into a tar command of some kind. _________________ My blog
nvtuner software - enhance your AGP Geforce 6800 or 6200! |
|
Back to top |
|
|
xnd Tux's lil' helper
Joined: 26 Sep 2004 Posts: 132 Location: Sherbrooke, Quebec, Canada
|
Posted: Tue Nov 23, 2004 3:45 pm Post subject: |
|
|
yeah, quick answer, love it! Tkx!
I discovered this website that could help with the backups:
http://www.partimage.org/
Tkx everybudy
XND _________________ They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, 'coz if you play it forwards, it installs Windows..! |
|
Back to top |
|
|
jstelly n00b
Joined: 28 Dec 2003 Posts: 70
|
Posted: Tue Nov 23, 2004 3:49 pm Post subject: |
|
|
This is my perl script to back up my boot and root partitions. /mnt/backup is a network share:
Code: |
#!/usr/bin/perl
print "backing up $ENV{HOSTNAME}\n";
$base_backup_dir="/mnt/backup";
print "deleting contents of /var/tmp/portage:...";
`rm -rf /var/tmp/portage/*`;
print "done.\n";
print "deleting contents of /usr/portage/distfiles:...";
`rm -rf /usr/portage/distfiles/*`;
print "done.\n";
print "deleting contents of /opt/crosstool/src/build:...";
`rm -rf /opt/crosstool/src/build/*`;
print "done.\n";
print "backing up / filesystem...";
`tar -cjlf $base_backup_dir/$ENV{HOSTNAME}.tar.bz2 /`;
print "done.\n";
print "backing up /boot filesystem...";
`tar -cjlf $base_backup_dir/$ENV{HOSTNAME}.boot.tar.bz2 /boot`;
print "done.\n";
|
|
|
Back to top |
|
|
xnd Tux's lil' helper
Joined: 26 Sep 2004 Posts: 132 Location: Sherbrooke, Quebec, Canada
|
Posted: Tue Nov 23, 2004 4:00 pm Post subject: |
|
|
oh, interesting
Tkx!
XND _________________ They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, 'coz if you play it forwards, it installs Windows..! |
|
Back to top |
|
|
|
|
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
|
|