# Backup restore



## albsallu (Oct 30, 2009)

I am fairly new to restoring a users home directory from a backup file.

I have a backupfile seating in the /usr/backups/ directory. A user mistakenly delted some of her email folders. I want to restore the users home directory without having to wait for long to extract the entire backup file. How do I go about doing that? Also, during the restore, i want to be able to restore without affecting new emails.

Note* The backup file is zipped home.backup.tgz

Thanks


----------



## graudeejs (Oct 30, 2009)

untar it....
read restore()
there's interactive mode.... with it you can do partial restore....

you can test stuff like that on your /tmp.... 

sorry I won't explain step by step... I'm to busy right now


----------



## jostrowski (Nov 7, 2009)

man tar

  tar -xzvf home.backup.tgz filename

  (replace the word 'filename' above with the file in the tar archive you want to extract. For example, if the mailbox you want to extract is named "vinnie", you would do this:

  tar -xzvf home.backup.tgz vinnie

  That will leave you with the file "vinnie" in your directory. 

  Then, to restore it without deleting existing mail that has come in, cat vinnie /var/mail/vinnie > /var/mail/vinnie.tmp

  then mv /var/mail/vinnie.tmp /var/mail/vinnie.

  Then set the permissions back to what they should be with chown and chmod.

  If you are unsure what the filename is in the archive, you can do tar -tzvf home.backup.tgz to get a list, find the file, and do the above. Note that if there is a directory before the file, it will extract it there.


----------

