Backup with rsync and tar
Posted on 2010-11-19
I'm running ubuntu servers. I'm using 'rsync' for backing up necessary directories(/usr /var /etc..) to a remote location so that I can immediately come up with the new server in case of system failure. The following is the rsync command:
rsync -avP --exclude 'udev' --exclude 'fstab' /etc /usr /var /lib /home /bin /sbin 192.168.2.100:/mnt/rsyncmounts/
To save disk space and to easily take and extract rsyncmounts directory, I thought of using 'tar'.
To create the tar file of rsyncmounts directory on the remote machine I used the following command:
tar -cvzf ~/clone.tgz /mnt/rsyncmounts
When I checked extracting it on a virtual machine using the following command, it's extracting under the directory which the tar is created(under /mnt/rsyncmounts) even having it specified to extract under /:
tar -xvpzf ~/clone.tgz -C /
Any tips or tricks to make it extract under the root directory /?