Click Add

Saturday, April 5, 2014

Backing Up and Restore Your Server ----Backup Your Server's OS

Backing Up and Restore Your Server
   
Backup Your Server's OS
   

Making a backup of your Linux Operating System is a very simple process that uses tools included in every linux installation.

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, but you can attach USB devices like thumb drive and external hard drives and even special storage like iSCSI and NFS mounted device to store the backup.

Once you are logged into the server and at a command line make the directory to store the backup in an organized way such as:

mkdir /backups

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

For RedHat, CentOS and Fedora or any Operating System based on these linux flavors run the following command:

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

For Debian or Ubuntu run the following command:

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

Once the command completes the tarball will be located at /backups/backup.tgz

***HINT: You can change the name of the tarball file with a date identifier and keep multiple versions or "snapshots" of your server's configuration.

No comments:

Post a Comment