rsync backup ... the restore.

Discussion in 'HOWTO-Related Questions' started by gabrix, Jan 16, 2007.

  1. gabrix

    gabrix New Member

    This is the result of the rsync backup how to it was on this site ... how do i make i full restore ?
    Where from do i start ?
     
  2. sjau

    sjau Local Meanie Moderator

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

    Code:
    rsync [i]some options[/i] [b]from[/b] [b]to[/b]
    
    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...
     
  3. gabrix

    gabrix New Member

    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:
    Is this the right way of restoring a backup.sql ?
     
    Last edited: Jan 17, 2007
  4. sjau

    sjau Local Meanie Moderator

    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
    
     
  5. gabrix

    gabrix New Member

    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:
    I'm using the above code to restore my database but ...
    It shows the help .
     
    Last edited: Jan 20, 2007
  6. martinfst

    martinfst Member Moderator

  7. gabrix

    gabrix New Member

    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 !!!!
     

Share This Page