Backup and Restore your Centos

Some time you want to take backup of your server including application and settings .below are the easy method a small example

1- The first step is to create a location to store the backup. For this article we’re going to store the backup on the same hard drive as the installed operating system

2-Make a backup directory where you will keep backup file.

mkdir /backup

3- Now we will create a compressed version of the Operating System in one single file (tarball) using the tar command.

tar cvpzf /backups/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backups --exclude=/dev --exclude=/sys --exclude=/boot/grub --exclude=/boot/grub2 --exclude=/etc/fstab --exclude=/etc/sysconfig/network-scripts/ --exclude=/etc/udev/rules.d/70-persistent-net.rules  /

Now transfer your backup.tgz file to new server .In order to restore your server from the previously created tarball the server must have the same Operating System version loaded on it.

To Restore your backup use the following.

tar xvpfz /backups/backup.tgz -C /

Your email address will not be published. Required fields are marked *