Backup and Restore Ubuntu 8.04 using Tar - Ubuntu

This is a discussion on Backup and Restore Ubuntu 8.04 using Tar - Ubuntu ; I have Ubuntu 8.04 alongside Window XP as a dual boot and am trialing desaster recovery for Ubuntu using Tar. For backup I use a command like:- tar cvpzf backup.tgz --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/lost+found --exclude /media / For the restore:- ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Backup and Restore Ubuntu 8.04 using Tar

  1. Backup and Restore Ubuntu 8.04 using Tar

    I have Ubuntu 8.04 alongside Window XP as a dual boot and am trialing
    desaster recovery for Ubuntu using Tar. For backup I use a command like:-

    tar cvpzf
    backup.tgz --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/lost+found
    --exclude /media /

    For the restore:-

    tar xvpfz backup.tgz -C /

    This works well except that it would be nice to have the option of removing
    any extra files on the destination which are NOT in the backup archive.

    Is this possible?

    It would provide the option of a "clean" restore without need to completely
    empty the partition completely first.

    Any thoughts on this would be most welcome.



  2. Re: Backup and Restore Ubuntu 8.04 using Tar

    Mike Sun wrote:

    > tar xvpfz backup.tgz -C /


    > This works well except that it would be nice to have the option of removing
    > any extra files on the destination which are NOT in the backup archive.


    Im pretty sure tar never deletes files outside of an archive except
    when overwriting.

    Reformatting has the advantage of having a clean filesystem.

    --
    Niklaus

  3. Re: Backup and Restore Ubuntu 8.04 using Tar

    Mike Sun schrieb:

    > tar cvpzf
    > backup.tgz --exclude=/mnt --exclude=/proc --exclude=/sys

    ^^^^^^^^^^^^^^
    > --exclude=/lost+found
    > --exclude /media /

    ^^^^^^^^^^^^^^^^^

    Just use the -l parameter to stay in the local filesystem.

    > It would provide the option of a "clean" restore without need to
    > completely empty the partition completely first.


    Then try rsync instead of tar.

    Martin.
    --
    OS: openSUSE 10.2 (i586)
    Kernel: 2.6.18.8-0.10-default
    KDE: 3.5.9 "release 64.2"


  4. Re: Backup and Restore Ubuntu 8.04 using Tar

    On Tue, 08 Jul 2008 14:35:13 +0000, Mike Sun wrote:

    >
    > It would provide the option of a "clean" restore without need to
    > completely empty the partition completely first.
    >
    > Any thoughts on this would be most welcome.


    The tar manual mentions a --recursive-unlink option that seems like just
    the thing you want. I would imagine that you would have to create the
    archive with the --absolute-names option, to make sure that regular files
    in the root directory are removed.

    I've never used it, but if you do, I'd like to hear about it.

    --
    Du kansst mir auf den Teller scheissen, musst
    nur Platz fr die Kartfoffeln lassen. (You can
    **** on my plate, you just have to leave some
    room for the potatoes).


  5. Re: Backup and Restore Ubuntu 8.04 using Tar

    Thanks for the comments - I tried the --recursive-unlink switch but it
    appears not to remove extraneous files. Perhaps the the --absolute-names
    option would have worked but this would restrict the flexibility of moving
    backup around if necessary?

    The rsync was more successful though not perfect. I extracted the backup to
    a temporary area on an NTFS partition where I had more space using:-

    tar xvpfz backup.tgz -C ./tmp

    Then I used:-

    rsync -irv --delete --exclude=/media/ --log-file=log.txt ./tmp/ /
    to delete extraneous files on the restored partition. It partially worked
    i.e not all surplus were deleted but repeating the rsync specifying specific
    root directories completed the job.

    Perhaps I haven't used the ideal switches for rsync - there are many to
    choose from. It also messed up the odd permissions - fixed by re-doing the
    command:-

    tar xvpfz backup.tgz -C /

    A more automated way of achieving a true mirror-like restore using some
    combination of tar and rsync would be really nice.






  6. Re: Backup and Restore Ubuntu 8.04 using Tar

    Mike Sun illuminated alt.os.linux.ubuntu by typing:
    > Thanks for the comments - I tried the --recursive-unlink switch but it
    > appears not to remove extraneous files. Perhaps the the --absolute-names
    > option would have worked but this would restrict the flexibility of moving
    > backup around if necessary?
    >
    > The rsync was more successful though not perfect. I extracted the backup to
    > a temporary area on an NTFS partition where I had more space using:-
    >
    > tar xvpfz backup.tgz -C ./tmp
    >
    > Then I used:-
    >
    > rsync -irv --delete --exclude=/media/ --log-file=log.txt ./tmp/ /
    > to delete extraneous files on the restored partition. It partially worked
    > i.e not all surplus were deleted but repeating the rsync specifying specific
    > root directories completed the job.
    >
    > Perhaps I haven't used the ideal switches for rsync - there are many to
    > choose from. It also messed up the odd permissions - fixed by re-doing the
    > command:-
    >
    > tar xvpfz backup.tgz -C /
    >
    > A more automated way of achieving a true mirror-like restore using some
    > combination of tar and rsync would be really nice.


    You're tar'ing and then rsyinc'ing?

    Why?

    --
    "My classmates would copulate with anything that moved, but I never saw
    any reason to limit myself." ~ Emo Philips

  7. Re: Backup and Restore Ubuntu 8.04 using Tar


    "Moog" wrote in message
    news:slrng7ae12.gj0.efcmoog@hardy.invalid...
    >
    > You're tar'ing and then rsyinc'ing?
    >
    > Why?
    >

    Because I already had the tgz file with a "clean" backup and I don't know
    how to perform a mirror-like restore from it directly...



  8. Re: Backup and Restore Ubuntu 8.04 using Tar

    Mike Sun illuminated alt.os.linux.ubuntu by typing:
    >
    > "Moog" wrote in message
    > news:slrng7ae12.gj0.efcmoog@hardy.invalid...
    >>
    >> You're tar'ing and then rsyinc'ing?
    >>
    >> Why?
    >>

    > Because I already had the tgz file with a "clean" backup and I don't know
    > how to perform a mirror-like restore from it directly...


    OK. Horses for courses, I suppose.

    Personally, I would rsysnc and then tar.

    Obviously, you'd need slightly more disk space to do this, but not a
    great deal.

    --
    "So I went down my local ice~cream shop, and said 'I want to buy an
    ice~cream'. He said Hundreds & thousands?' I said 'We'll start with
    one.' He said 'Knickerbocker glory?' I said 'I do get a certain amount
    of freedom in these trousers, yes.' ~ Tim Vine

+ Reply to Thread