Automatic image creation using cron service

As a rule, disk/partition images are created regularly, often daily. To automate this operation, you can use the cron service familiar to many UNIX users.

As an example, let’s consider a situation where you (the system administrator) need to back up one or more disk partitions regularly.

Use the –list command to obtain the necessary partition number:

Disk 1:
1-1      hda1  Pri,Act     31.35 MB    26.67 MB    FAT16
         Table                                     Table
1-2      hda5              980.5 MB                Linux Swap
1-3      hda6              4.887 GB    135.9 MB    Ext2
1-4      hda7              9.767 GB    1.751 GB    Ext2
1-5      hda8              3.462 GB    1.3 GB      Ext2
Disk 2:
2-1 (/1) hdd1  Pri,Act     4.806 GB    4.627 GB    Ext3
         Table                                     Table
2-2      hdd5              3 GB        1.319 GB    Ext3
2-3      hdd6              3.906 GB                Ext3

You need to back up partition 2-1. Let’s suppose a complete image has to be created weekly, supported by incremental images created daily.

To do this, place the respective executable files (e.g. trueimage.cron) into /etc/cron.daily and /etc/cron.weekly folders.

To initiate weekly creation of a complete image of partition 2-1, add the following line to the above file:

#!/bin/bash
/usr/sbin/trueimagecmd –create –partition:2-1 \
–filename:/mnt/backups/my_host/backup.tib

Where /mnt/backups/my_host/backup.tib is the name and path of the image.

The second executable file is needed to initiate daily creation of incremental images:

#!/bin/bash
/usr/sbin/trueimagecmd –create –incremental –partition:2-1 \
–filename:/mnt/backups/my_host/backup.tib

If needed, users can set up their own backup schedule. For more information, see Help on the cron service.

Automatic image creation using cron service