#1  
Old 16th January 2007, 00:32
gabrix gabrix is offline
Senior Member
 
Join Date: Sep 2006
Location: Napoli
Posts: 186
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via MSN to gabrix Send a message via Yahoo to gabrix Send a message via Skype™ to gabrix
Exclamation rsync backup ... the restore.

This is the result of the rsync backup how to it was on this site ... how do i make i full restore ?
Quote:
root@www:~# ls /backup/
2006-12-08_18:00 2006-12-19_06:00 2006-12-25_00:00 2006-12-30_18:00 2007-01-05_12:00 2007-01-11_06:00
2006-12-09_00:00 2006-12-19_12:00 2006-12-25_06:00 2006-12-31_00:00 2007-01-05_18:00 2007-01-11_12:00
2006-12-09_06:00 2006-12-19_18:00 2006-12-25_12:00 2006-12-31_06:00 2007-01-06_00:00 2007-01-11_18:00
2006-12-09_12:00 2006-12-20_00:00 2006-12-25_18:00 2006-12-31_12:00 2007-01-06_06:00 2007-01-12_00:00
2006-12-09_18:00 2006-12-20_06:00 2006-12-26_00:00 2006-12-31_18:00 2007-01-06_12:00 2007-01-12_12:00
2006-12-10_00:00 2006-12-20_12:00 2006-12-26_06:00 2007-01-01_00:00 2007-01-06_18:00 2007-01-12_18:00
2006-12-10_06:00 2006-12-20_18:00 2006-12-26_12:00 2007-01-01_06:00 2007-01-07_00:00 2007-01-13_00:00
2006-12-10_12:00 2006-12-21_00:00 2006-12-26_18:00 2007-01-01_12:00 2007-01-07_06:00 2007-01-13_06:00
2006-12-10_18:00 2006-12-21_06:00 2006-12-27_00:00 2007-01-01_18:00 2007-01-07_12:00 2007-01-13_12:00
2006-12-11_00:00 2006-12-21_12:00 2006-12-27_06:00 2007-01-02_00:00 2007-01-07_18:00 2007-01-13_18:00
2006-12-11_06:00 2006-12-21_18:00 2006-12-27_12:00 2007-01-02_06:00 2007-01-08_00:00 2007-01-14_00:00
2006-12-11_12:00 2006-12-22_00:00 2006-12-27_18:00 2007-01-02_12:00 2007-01-08_06:00 2007-01-14_06:00
2006-12-11_18:00 2006-12-22_06:00 2006-12-28_00:00 2007-01-02_18:00 2007-01-08_12:00 2007-01-14_12:00
2006-12-12_00:00 2006-12-22_12:00 2006-12-28_06:00 2007-01-03_00:00 2007-01-08_18:00 2007-01-14_18:00
2006-12-12_06:00 2006-12-22_18:00 2006-12-28_12:00 2007-01-03_06:00 2007-01-09_00:00 2007-01-15_00:00
2006-12-12_12:00 2006-12-23_00:00 2006-12-28_18:00 2007-01-03_12:00 2007-01-09_06:00 2007-01-15_06:00
2006-12-12_18:00 2006-12-23_06:00 2006-12-29_00:00 2007-01-03_18:00 2007-01-09_12:00 2007-01-15_12:00
2006-12-14_00:00 2006-12-23_12:00 2006-12-29_06:00 2007-01-04_00:00 2007-01-09_18:00 2007-01-15_18:00
2006-12-16_00:50 2006-12-23_18:00 2006-12-29_12:00 2007-01-04_06:00 2007-01-10_00:00 2007-01-16_00:00
2006-12-18_11:38 2006-12-24_00:00 2006-12-29_18:00 2007-01-04_12:00 2007-01-10_06:00 current
2006-12-18_12:00 2006-12-24_06:00 2006-12-30_00:00 2007-01-04_18:00 2007-01-10_12:00
2006-12-18_18:00 2006-12-24_12:00 2006-12-30_06:00 2007-01-05_00:00 2007-01-10_18:00
2006-12-19_00:00 2006-12-24_18:00 2006-12-30_12:00 2007-01-05_06:00 2007-01-11_00:00
Where from do i start ?
__________________
http://www.gabrix.ath.cx
Reply With Quote
Sponsored Links
  #2  
Old 16th January 2007, 09:53
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,146
Thanks: 4
Thanked 55 Times in 51 Posts
Default

Gabrix: It's quite simple. Basically the rsync syntax is like this:

Code:
rsync some options from to
So if you have to code like this:

Code:
rsync /home /backup/current
You will mirror your home folder into /backup/current.

Now to restore it, you simply switch origin and destination to:

Code:
rsync /backup/current /home
In this case you will mirror from /backup/current into /home and hence make a restore...
Reply With Quote
  #3  
Old 17th January 2007, 03:01
gabrix gabrix is offline
Senior Member
 
Join Date: Sep 2006
Location: Napoli
Posts: 186
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via MSN to gabrix Send a message via Yahoo to gabrix Send a message via Skype™ to gabrix
Exclamation

It's an incremental backup which means from date of the first backup 2006-12-08_18:00 to current only changes got copied , so in current i'm not going to have all files being in 2006-12-08_18:00 but only the new onces and that's the same for the backup.sql , right ?Just giving the above code doesn't look to me to be a complete restore it's a website document root has to be complete.I'm just trying to understand completly.
Anyway all done for the document root the backup.sql instead:
Quote:
root@www:/backup/current/mysql_backup# mysql < tor-final.sql -u root -p
Enter password:
ERROR 1046 (3D000) at line 11: No database selected
Is this the right way of restoring a backup.sql ?
__________________
http://www.gabrix.ath.cx

Last edited by gabrix; 17th January 2007 at 03:30.
Reply With Quote
  #4  
Old 17th January 2007, 07:25
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,146
Thanks: 4
Thanked 55 Times in 51 Posts
Default

Well, if you did it the way I described in the how to then the incremental means only altered files are transferred for backup... however due to the nature of hardlinks you do have full backups at any given time.

Easily explained:
A harddisk consists of two parts:
(1) Table of contents
(2) The actual data

When you create a file it will create an entry in the table of contents. That one says where the file is physically located on the hardisk.

When you make a hardlink, you double the toc and copy it to another place. I looks like you will then have twice the files (which consumes only a little more space than the file itself, since only the toc entry was doubled).
So as long as you have somehwere a hardlink pointing to the file then the file does exist.

What now rsync does is compare whether files have changed. If they have, then rsync will remove 1 hardlink (the others still remain and hence also the files) and create a new file... in that case you do have the file double on your disk (but in two different versions).

The correct syntax for restoring mysql dbs is:

Code:
mysql - u user_name -p your_password database_name < file_name.sql
Reply With Quote
  #5  
Old 20th January 2007, 01:06
gabrix gabrix is offline
Senior Member
 
Join Date: Sep 2006
Location: Napoli
Posts: 186
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via MSN to gabrix Send a message via Yahoo to gabrix Send a message via Skype™ to gabrix
Default

that's how i did it.I don't know why but i can't name the database with the previous name i think because it has a '-' in name tor-final.I called it just tor and it works:
Quote:
mysql> create database tor-final;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-final' at line 1
mysql> create database tor;
Query OK, 1 row affected (0.00 sec)
I'm using the above code to restore my database but ...
Quote:
root@www:/backup/current/mysql_backup# mysql -u root -p xyfR4mkfhj tor < tor-final.sql
mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (i386)
Copyright (C) 2002 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Usage: mysql [OPTIONS] [database]
-?, --help Display this help and exit.
--auto-rehash Enable automatic rehashing. One doesn't need to use
'rehash' to get table and field completion, but startup
and reconnecting may take a ...........
It shows the help .
__________________
http://www.gabrix.ath.cx

Last edited by gabrix; 20th January 2007 at 01:13.
Reply With Quote
  #6  
Old 20th January 2007, 14:13
martinfst martinfst is offline
Senior Member
 
Join Date: Dec 2006
Location: Hilversum, The Netherlands
Posts: 880
Thanks: 1
Thanked 18 Times in 17 Posts
Send a message via MSN to martinfst Send a message via Skype™ to martinfst
Default

See here: http://bugs.mysql.com/bug.php?id=461

This is a MySQL 'feature'. You have to encapsulate the database name with a dash with back tick quotes.
Reply With Quote
  #7  
Old 21st January 2007, 14:52
gabrix gabrix is offline
Senior Member
 
Join Date: Sep 2006
Location: Napoli
Posts: 186
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via MSN to gabrix Send a message via Yahoo to gabrix Send a message via Skype™ to gabrix
 
Default

Ok!Everything is all right now.I managed to move my site on an another pc and it is up and running .I wanted just to say thanks to sjau and everybody here , great !!!!
__________________
http://www.gabrix.ath.cx
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
please help...restore 180 mb backup gary1974 Programming/Scripts 3 30th January 2007 13:08
Systemimager (rsync) doesn't copy all comedit HOWTO-Related Questions 11 19th January 2007 17:17
Restore ispconfig complete backup statiic General 1 15th January 2007 10:32
Backup and restore on Debian 3.1 Sarge arve Tips/Tricks/Mods 1 14th October 2006 15:17
backup and restore provell Installation/Configuration 4 2nd May 2006 12:21


All times are GMT +2. The time now is 14:42.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.