datto / dattobd

kernel module for taking block-level snapshots and incremental backups of Linux block devices
GNU General Public License v2.0
576 stars 122 forks source link

cow file disappear if increase size is larger than fallocate size. #127

Closed yummydsky closed 6 years ago

yummydsky commented 6 years ago

dattobd version 0.10.0

I try to monitor my disk partition /dev/sdb1 which size is 2G and mounted at /root/data/ with command below

dbdctl setup-snapshot /dev/sdb1 /root/data/.datto0 0

The datto information is

# cat /proc/datto-info 
{
    "version": "0.10.0",
    "devices": [
        {
            "minor": 0,
            "cow_file": "/.datto0",
            "block_device": "/dev/sdb1",
            "max_cache": 314572800,
            "fallocate": 213909504,
            "seq_id": 1,
            "uuid": "eb1e1c1cba7d427086cb3a3f41951856",
            "state": 3
        }
    ]
}

After that, I copy the 98M file to another file name in folder /root/data/, then the cow file disappears.

cp xxx.iso xxx.iso.1
cp xxx.iso xxx.iso.2
rm xxx.iso.1
rm xxx.iso.2
cp xxx.iso xxx.iso.1
cp xxx.iso xxx.iso.2
rm xxx.iso.1
rm xxx.iso.2

I have checked the dmesg, and it said cow file exceeded max size 214646784.

[260102.137987] datto: cow file '/root/data/.datto0' max size exceeded (214646784/214643507): -27
[260102.139094] datto: error writing cow data: -27
[260102.140203] datto: error writing cow data and mapping: -27
[260102.141163] datto: error handling write bio: -27
[260102.142219] datto: error handling write bio in kernel thread: -27

Is that what we expected? Or it's a bug?

crawfxrd commented 6 years ago

This is expected behavior. When an error occurs, the driver puts the device into an error state. Some metadata is preserved (information about it can be seen in /proc/datto-info), but the underlying device is destroyed.

yummydsky commented 6 years ago

Okay, Can I ask what you suggest to do when this case happens? And if the state goes to unverified which number is 4 or 5. Is there other action I can do except destroy it?

tcaputi commented 6 years ago

Once you exceed the size of the COW file dattobd can no longer maintain an accurate snapshot so it enters the error state (as you see here). The metadata about it is kept for error analysis, but basically the only thing you can do is destroy it.

yummydsky commented 6 years ago

Okay, thanks.