Using Snapshot Driver
This section helps you create a snapshot of the selected disk partition. To create the snapshot using the Snapshot driver, perform the following steps.
In the current beta release, the use of the commands listed in this section does not require the root user rights.
Step 1 Create a snapshot device.
Select a disk partition with EXT4 file system (such as /dev/sda2), and execute the following command:
echo -n "create <snapshot device name> /dev/sda2 begin end" > /sys/kernel/cblb/cmd
Where <snapshot device name> refers to the device name that is being created, and /dev/sda2 is the name of the disk partition for which you create a snapshot. The “begin” and “end” parameters mean that you want to create a snapshot for the whole disk partition.
For example, the following command creates the test-sda2 snapshot device for the /dev/sda2 partition:
echo -n "create test-sda2 /dev/sda2 begin end" > /sys/kernel/cblb/cmd
Step 2 Check the creation operation status.
Run the dmesg command to check the creation operation status. If this operation succeded, the output messages should include:
Create snapshot <tst-sda2> for </dev/sda2> 0..end
and information on the sectors and block sizes.
Step 3 Create a catalog for storing temporary files.
The snapshot driver stores temporary data to a catalog you should create. To make a folder for temp files, use the following command:
mkdir <path to catalog>
For example, the following command creates the /tmp/driver catalog:
- For each snapshot device, create a separate catalog.
- If you store temporary files on a disk partition to be backed up, ensure that the partition has at least 60% of free space.
Step 4 Start the snapshot device.
To start the snapshot device, use the following command:
echo -n “start tst-sda2 /tmp/driver 409600 20” > /sys/kernel/cblb/cmd
where tst-sda2 is the previously used snapshot device name; /tmp/driver refers to a location for storing our temporary files; 409600 is the size of a single temporary file (in blocks), and 20 is a maximum number of files to create.
For Ubuntu Desktop releases, it is important to ensure that no background upgrade operations are running, because it could result in damaged file-system switched to read-only mode.
Step 5 Mount the snapshot device.
Create a catalog for mounting the snapshot device (mount point), such as /tmp/mtst (used as an example):
Mount the snapshot device (as read only):
sudo mount -o ro,noload /dev/tst-sda2 /tmp/mtst
Step 6 Check whether the snapshot driver works properly
To verify whether the snapshot driver works properly, do the following:
- Navigate to the mount point (such as /tmp/mtst):
- View the files list and ensure that it is a copy of the disk partition in question:
Step 7 Remove the snapshot
To remove snapshot and temporary files, unmount shadow device from previously used mount point(make sure you are not in the mount point directory location path):
sudo umount /tmp/mtst
To remove snapshot and temporary files enter:
echo -n “remove tst-sda2” > /sys/kernel/cblb/cmd
If everything went fine, in dmesg command output you will see something like