Full Partition Backups

Grid Computing with PCQLinux

Games on PCQLinux 2006

Remote Installation of PCQLinux 2006

Tandberg Storage Loader LTO2 Autoloader

PCQlinux ships two utilities partimage and rsync for backup and restore functions.

Partimage can be used to create an image of an entire partition. The image can subsequently be used to restore a crashed partition or corrupted data. The Partimage utility has a client and an optional server. The client can connect to the server and copy the image of a partition onto it. Similarly data can be restored back from the server across the network. Needless to say, the client can take backup and restore it from a mounted network share too.

Backups on Linux is no longer a bunch of commands but a simple to use graphical utility

PCQLinux 2006 bundles the Partimage client. Let us see how it can be used to backup the image of a partition on a Windows share.

Backup and Restore partitions with Partimage
Assume a Windows file server running at 192.168.3.1 with a share named backups accessible to a user named backupuser with password as secret.

Create a directory named backupserver under /mnt on your PCQLinux 2006 machine. Mount the Windows share as:

mount -t smbfs -o username=backupuser //192.168.3.1/backups  /mnt/backupserver

If you are running a Linux file server, then you can NFS (Network FileSystem) mount the server's directory.

Incremental backups

PCQLinux 2006 ships with Rsync for regular data backup jobs.  Rsync backs up only incremental data, saving time and network bandwidth.

Suppose, you need to regularly (say daily) backup the data in /home/common on your PCQLinux 2006 file server running at 192.168.3.5 to a PCQLinux backup server at 192.168.3.6. The backup data is to be stored in the directory /home/commonbackup on the latter server. For this, we will use rsync and also schedule it to run daily using the cron scheduler. The rsync program at 192.168.3.5 will connect to the backup server at 192.168.3.6 and dump the backup data to the directory /home/commonbackup. We will refer to 192.168.3.5 as the client and 192.168.3.6 as the server.

Setting up the backup server
First we need to setup a rsync user and password (say backup and secret) on the server. For this issue:

echo “backup:secret” > /etc/rsyncd.scrt
chmod 600 /etc/rsyncd.scrt

Next create a file named rsyncd.conf with the following contents:

motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
transfer logging = yes

[commonbackup]
  
path = /home/commonbackup
   comment = Backup Server

   read only = no
  
uid = 0
  
gid = 0
  
list = yes
  
auth users = backup
  
secrets file = /etc/rsyncd.scrt 

Save the file in the /etc directory.

To start Rsync on the server issue 'ntsysv'. From amongst the list of services, check rsync and click on Ok. Next issue:

service xinetd restart

On the rsync client
On the client machine, type in the following in a file called dobackup.sh:

export RSYNC_PASSWORD=secret

rsync -a --verbose --compress  --exclude *~ /home/common/* backup@192.168.3.6::commonbackup  

Substitute secret and backup (in  backup@192.168.3.6) with the rsync user and password that you had specified above. Save the file in the directory /etc/cron.daily and give it executable permissions as:

chmod +x /etc/cron.daily/dobackup.sh

This should start backing up the data from 192.168.3.5 to 192.168.3.6 everyday at 4:02 A.M. Note that only modified data flows across the network and that too in a compressed form. To restore data from the server, issue the command:

rsync -a --verbose --compress  --exclude *~ backup@192.168.3.22::commonbackup /home/common

Login as root. In a terminal window in KDE/GNOME or on the Linux console, type 'partimage'. This will launch the graphical (to be precise, a character based interface) interface of Partimage.

For “Partition to save/restore”, select the partition which you want to backup. Note that in case of dual boot machines, you can also backup the Windows (FAT32 and NTFS) partitions. For 'Image file to create/use', type in /mnt/backupserver/ hostname.gz. Substitute hostname with the name of the PCQLinux machine. Press F5. On the next screen, press F5 again. Subsequently, type in a description for the image for example – 'image of home partition at server.pcqlabs.net'. Select Ok. This will create the image on /mnt/backupserver named hostname.gz.000

To restore from a backup, first create a partition using say MS fdisk or Linux fdisk. Fire up partimage. Select the partition you created. For “Image file to create/use”, type in /mnt/backupserver/ hostname.gz.000.

For 'Action to be done', select 'Restore partition from an image file'. Press F5. On the subsequent screen, press F5 again. This will restore the backed up data in the partition you selected.

The Partimage server
Instead of using a network share you can store all the images on a central server using the Partimage server called partimaged. You can download the Partimage server from ftp://fr.rpmfind.net/linux/ dag/redhat/el4/en/i386/dag/RPMS/partimage-server-0.6.4-1.2.el4.rf.i386.rpm. Install the downloaded RPM as:

rpm -ivh  partimage-server-0.6.4-1.2.el4.rf.i386.rpm

Next we will need to specify which users can connect to the Partimage server. Note that Partimage server uses system users – user swho have account on the Linux machine. Create a user account named backupuser (say) on the Linux machine as:

useradd backupuser
passwd backupuser

When prompted specify the password for the backupuser. The password is required to authenticate while connecting to the Partimage server. Next append the username i.e. backupuser to the file named partimagedusers found in /etc/partimaged directory. Next, login as root and run the Partimage server as:

partimaged

Let us assume that you have the Partimage server on a machine with IP 192.168.3.2. Now from another machine, connected the network, fire up partimage. As before, select the partition to backup. For “Image file to create/use”, type in /var/partimaged/hostname.gz. The /var/partimaged is a directory on 192.168.3.2 on which the images will be stored. Next, check 'Connect to the server' and fill in the IP address of the server. The subsequent steps remain the same as above.

To restore, the steps remain almost the same. You will need to fill in the IP address and the path to the image as /var/partimaged/hostname.gz.000. With partimaged, you can maintain a central repository of images of all the partitions holding critical data. Whenever you need to restore, point to the server, select your image and done.

Hopefully, you will not need restore using partimage ever. But if you ever do, ensure that you have a backup created.

  • Follow PCQuest on
  • become a fan on
  • Stay updated via
  • RSS

LEAVE A REPLY

Notify me of follow-up comments via e-mail address

Post Comment

Survey Box

Now that Microsoft has finally discontinued support for Windows XP, which OS are you likely to upgrade to?

Send this article by email

X