I have a backup of a website that I created using the tar command below:
tar -cvpzf backup.tar.gz /var/www/vhosts/example.com/httpdocs
I see that in the archive file, it has saved the entire path (/var/www...) and when I try to restore it, all these folders are created in the destination folder. Should I use the below command instead to backup the website?
tar -cvpzf backup.tar.gz -C /var/www/vhosts/example.com/httpdocs .
and restore the backup using this?
tar -xvpzf backup.tar.gz -C /var/www/vhosts/example.com/httpdocs --numeric-owner
You may also suggest a better backup method for my situation - I need to backup the files and database dump of a website to a single .tgz file and store in my external HDD.
Note: I'm also considering Duplicity. http://duplicity.nongnu.org/