How To Backup And Restore Directory In Linux
Posted On Sun Dec 28, 2008 By wallpaperama In Linux Forums And Topics Discussions For Wallpaper Websites Running On Linux Servers Forums
backing up and restoring a directory in linux is easy. i wanted to put this here just incase anyone is insterested in knowing how to backup their wallpaper website. backing up with linux its nothing complicated, but if you dont have much practice with the unix shell commands, it can be overwhelming sometimes. i know it was for me, im getting use it to it, but from time to time, i want to know how i can do a full backup of my website. if you are used to backing up your website with ftp, that takes forever. how about if i told you that you can compress and backup your entire websites in just seconds.
for me, my website is about 5G full, so ftp just wont do. if i had to do a full backup, this will take me forever to ftp plus then another forever to download if you are poor like me and only have s slow dsl line.
so here it is, i wont bore you with my drama,, lets say i have want to compress my web directory, and the location is: /var/www/
in the /var/www/ is where i keep my website on my dedicated server. so to compress it i will compress it using gzip and tarball. the first command would be for me to change directory to the /var:
then once i am in /var i can tar my www/ directory and im going to call my backup file: backup-12-128-08-mydomain so this is the command i would do:
once it completes, you can to the list command to show that it created our file:
* the -la is to show details of the files, this way you can see the file size
ok now you can download the file with http instead of ftp
so lets say now that for some reason something went bad, and i want to restore to my backup, easy, to restore our backup file i would put our backup-12-128-08-mydomain.tar.gz file in the /var directory:
this will move our backup-12-128-08-mydomain.tar.gz to the /var directory
now go back to the /var directory where we put our new backup file
then rename my old www/ to www-broken-12-28-08
then i can restore the www/ with this command:
then you will see all your files and directories that you saved, start to load.
wooo hooo!
for me, my website is about 5G full, so ftp just wont do. if i had to do a full backup, this will take me forever to ftp plus then another forever to download if you are poor like me and only have s slow dsl line.
so here it is, i wont bore you with my drama,, lets say i have want to compress my web directory, and the location is: /var/www/
in the /var/www/ is where i keep my website on my dedicated server. so to compress it i will compress it using gzip and tarball. the first command would be for me to change directory to the /var:
cd /var
then once i am in /var i can tar my www/ directory and im going to call my backup file: backup-12-128-08-mydomain so this is the command i would do:
tar -pczf backup-12-128-08-mydomain.tar.gz www/
once it completes, you can to the list command to show that it created our file:
ls -la
* the -la is to show details of the files, this way you can see the file size
ok now you can download the file with http instead of ftp
so lets say now that for some reason something went bad, and i want to restore to my backup, easy, to restore our backup file i would put our backup-12-128-08-mydomain.tar.gz file in the /var directory:
mv /var/www/public_html/downloads/backup-12-128-08-mydomain.tar.gz /var/backup-12-128-08-mydomain.tar.gz
this will move our backup-12-128-08-mydomain.tar.gz to the /var directory
now go back to the /var directory where we put our new backup file
cd /var
then rename my old www/ to www-broken-12-28-08
mv www/ www-broken-12-28-08/
then i can restore the www/ with this command:
tar xvfz backup-12-128-08-mydomain.tar.gz
then you will see all your files and directories that you saved, start to load.
wooo hooo!
Susnic Tue Apr 03, 2012
Hello,
Is there any way to take backup on a scheduled basis using "crontab". Please reply if anyone know a solution.
Is there any way to take backup on a scheduled basis using "crontab". Please reply if anyone know a solution.
Related Content
Information
Forums »
Linux Forums And Topics Discussions For Wallpaper Websites Running On Linux Servers »
How To Backup And Restore Directory In Linux
Linux Forums And Topics Discussions For Wallpaper Websites Running On Linux Servers »
How To Backup And Restore Directory In Linux
Title: How To Backup And Restore Directory In Linux
Description: How To Backup And Restore Directory In Linux
Tags: how ,to ,backup ,and ,restore ,directory ,in ,linux
Info: This Post Has Been Viewed 0 Times Since
Date: Sun Dec 28, 2008
Author wallpaperama Received 1 Replies #3048
Date: Sun Dec 28, 2008
Author wallpaperama Received 1 Replies #3048
Share
URL: 

Embed: 

To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it
BBCODE:: 

BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
wallpaperama | Wallpapers | Forums | Terms Of Service
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5