Linux Incremental volume backup

Incremental volume backup for Linux like operating systems can be implemented by tracking block-level writes. The block-level writes tracking can be achieved by adding a block level filter driver through ‘Device mapper’.

The Device Mapper is a kernel component which could transform a block I/O (“BIO”) request based on different policies. By transforming a BIO request, a Device Mapper device could remap the request to a different address, to a different block device(psudo device created based on device mapper on top of original device), or simply perform some bookkeeping task and then pass the request to the underlying original device.

To track writes to a block device in Linux, one can instantiate a write tracking Device Mapper device stacked on top of the original block device. Then, whenever the write tracking Device Mapper device receives a BIO write request, it tracks the write. After that, it passes the BIO write request down to the underlying original block device. In addition, to track writes to a block device, Linux needs to be told to access the write tracking device instead of the block device itself. Thus, if a file system is already mounted on the block device, it would have to be remounted to the write tracking device.

At boot time, Linux selects the block devices on which its file systems mount by looking at a File System Table (fstab). By changing the block device on which a specific file system mounts to a write tracking device in fstab, write tracking will occur after the next reboot.

Now the problem is with root(‘/’) partitions. How pseudo device can be replaced by original root partition? This can be achieved by preparing pseudo device for root partition insight the initrd image.

For full backup one can use only used blocks by writing user level utility to find out the used blocks only from the volume. This will save time as well as space. Additionally along with filter driver a COW(Copy-On-Write) mechanism can be implemented to provide stable snapshot of volume for full backup. For the COW mechanism some free space is required to maintain the copied writes. That free space can be obtained by maintaining list of free blocks on the same volume.

The next incremental backups of volume will be based on changed block list which block level filter driver is tracking. The list can be obtained by using IOCTL to filter driver. Thus only changed blocks will be backed up from last backup.

Please see following block diagram for more details of block-level filter driver.

Block level filter driver_jitu

About the Author: Jitendra Pawar is a Linux enthusiast, and has extensive experience working on products especially in Linux across multiple areas of Storage utilities, Linux Clusters, test automation frameworks and server back-end tools. He just loves what he does and uses his vast experience in the designing and analysis of software products.

About krenoadmin

No Comments

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>