LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Full system backup. (http://www.linuxquestions.org/questions/linux-newbie-8/full-system-backup-335034/)

Terroth 06-18-2005 10:26 PM

Full system backup.
 
Hey guys, I was wondering what is the best way to do a remote full system backup? I want to clone my current drive onto a second drive basicly. Would .tar.gzing the drive to the 2nd work? Remember, I only have remote access.

edong23 06-18-2005 10:31 PM

yep. you would need ample hard drive space but you should be able to ssh into the system and issue somehting like

cd /
tar -cvvf /dev/otherdrive/backup.tar /
then
bzip2 it.

i would use bzip2 cause it compresses more and has no loss. it is newer and better. then if you need to untar it use
tar xvjpf whatever.

that would do it i do it all the time to my mail servers.

edong23 06-18-2005 10:32 PM

by the way. i said tar -cvvf cause the 2 v's mean very verbose. it will actually print onto your shell what files it is adding to the archive so that you know it is working.

doctor_sniff 06-18-2005 10:45 PM

Hey Terroth.
I wrote a simple backup script with bash.
you can use it for your system.
--------------------------------------------------------------
cd /home/httpd/vhosts/farsilinux.org/httpdocs/backups
Name=`date +%Y-%m-%d`
mkdir $Name
cd $Name
mkdir DB FILE
cp -dfrp /var/lib/mysql/fxnuke/* DB
cp -dfrp /home/httpd/vhosts/farsilinux.org/subdomains/portal/httpdocs/* FILE
cd ..
tar -cvzf $Name.tar.gz $Name
if test -s $Name.tar.gz
then
gpg -e -r backup $Name.tar.gz
echo "Backup $Name is Created. You Can receive it in this address: http://www.farsilinux.org/backups/$Name.tar.gz.gpg"|mail backup@farsilinux.org -s Date:$Name
if test -s $Name.tar.gz.gpg
then
rm -dfr $Name.tar.gz
fi
rm -dfr $Name
else
exit
fi
-----------------------------------------------------
run it and enjoy.

Terroth 06-19-2005 12:51 AM

Very nice script indeed. I heard that backing up drives remotely via taring it will miss files?

When you said ample space, how much space? The same exact ammount? Or do I need more then the partition? Im backing up a 37Gig SCSI to my other harddrive which is split into two, a 40 gig partion, and the rest for personal storage.

Tinkster 06-19-2005 02:04 AM

How about skipping intermediate steps? :}

Boot the target box of a knoppix CD, and
issue (from the mounted target drive):
rsync -Save ssh root@remotebox.com:/*


Cheers,
Tink

Terroth 06-19-2005 02:42 AM

I have no access to the CD-Rom.

Tinkster 06-19-2005 02:47 AM

Sorry - I thought you wanted to get the remote box to
a local system. If both drives live on the remote server
you can use rsync there ;}


Cheers,
Tink

doctor_sniff 06-19-2005 03:08 AM

if you want to use sync, you can use this command with this option:
frist run rsync service and run this code.
rsync -avz /var/www/html/ /Lab/PHP

and save thid commad to a file and move it to (e.g /etc/cron.hourly)

Ikebo 06-19-2005 06:12 AM

rdiff-backup is a good tool for this situation as well.

edong23 06-20-2005 06:26 PM

na it wont corrupt anything. at least not in my experience. ever. so. just ssh in and it is like you are there on the console. as far as space the initial tar file will be huge. when you bzip2 it it will be alot smaller. i have heard of even like 30% smaller. but some files are already shrunk so.. you know. the script above looks pretty nice too. i wont use ill rely on old faithful, but you could giver a try.

prasanta 06-21-2005 12:52 AM

Try with rsync -avzl option.
This will preserve all the links also. If there is a symblink to a particular directory, it will copy that as it is without copying the data to where the link specifies.

-Prasanta


All times are GMT -5. The time now is 03:12 AM.