The blksnap mechanism is proposed for creating snapshots of block devices in Linux.

Veeam, a company that develops backup and disaster recovery software, has proposed a blksnap module for inclusion in the Linux kernel, implementing a mechanism for creating snapshots of block devices and tracking changes in block devices. A command-line utility, blksnap, and the library blksnap.so have been prepared for working with snapshots, allowing user space interaction with the kernel module through ioctl calls.

The objective of creating the module is to organize backup of storage devices and virtual disks without stopping operations — the module allows capturing the current state of the entire block device in a snapshot, providing an isolated snapshot for backup that is independent of ongoing changes. An important feature of blksnap is the ability to create snapshots simultaneously for multiple block devices, which ensures data integrity at the block device level and achieves consistency across different block devices in the backup.

To track changes in the block device subsystem (bdev), the ability to attach filters for intercepting input/output requests has been added. Blksnap implements a filter that intercepts write requests, reads the old value, and saves it in a separate list of changes that defines the state of the snapshot. With this approach, the logic of interacting with the block device remains unchanged; writes to the original block device are made as is, regardless of the snapshots, which eliminates the possibility of data corruption and allows avoiding issues even in the event of unpredictable critical errors in blksnap and overflow of space allocated for changes.

The module also allows you to determine which blocks have changed in the time frame between the last and any previous snapshot, which can be useful for implementing incremental backups. To retain changes relative to the snapshot state, any range of sectors on a block device can be allocated, enabling changes to be saved in separate files within the filesystem on block devices. The size of the area for storing changes can be increased at any time, even after a snapshot has been created.

Blksnap is based on the code of the veeamsnap module, which is part of the Veeam Agent for Linux product, but reworked with consideration for its delivery as part of the main Linux kernel. The conceptual difference between blksnap and veeamsnap is the involvement of a filter system attached to the block device instead of a separate bdevfilter component that intercepts input/output.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster