datto / dattobd

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

Filesystem goes read-only after dbdctl setup-snapshot run #251

Open Mishman7 opened 3 years ago

Mishman7 commented 3 years ago

Following README https://github.com/datto/dattobd/blob/master/README.md I'm trying to reproduce steps pointed in chapter 'Performing Incremental Backups' on Debian 9. After running of dbdctl setup-snapshot /dev/sda2 /.datto 0 (Snapshot and COW files are appear as expected) I'm trying to make dd if=/dev/datto0 of=/backups/sda2-bkp bs=1M , but getting error: "dd: failed to open '/backups/sda2-bkp' : Read-only file system". Before dbdctl setup-snapshot start file system not in Read-only mode. File system structure: Filesystem Size Used Avail Use% Mounted on udev 7.8G 0 7.8G 0% /dev tmpfs 1.6G 9.2M 1.6G 1% /run /dev/sda2 47G 15G 30G 34% / tmpfs 7.8G 42M 7.8G 1% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup tmpfs 1.6G 16K 1.6G 1% /run/user/116 tmpfs 1.6G 36K 1.6G 1% /run/user/1000

Debian info: OS: Debian 9.13 Kernel: Linux 4.9.0-15-amd64 Filesystem: EXT3 dattobd v.0.10.15 installation was made from repositories

The same behavior is observed on Debian 9 installed on VM with EXT4 filesystem. Read-only state fixes only from manual fsck command run and reload.

nixomose commented 3 years ago

well, for sure something odd is going on, but it probably has nothing to do with dattobd.

run 'mount' before dbdctl and before dd and look for the mount mode for whereever /backups is, see if it says ro or rw at each step. if you say dbdctl setup-snapshot /dev/sda2, that's all it touches, it doesn't go near any other block device. test the filesystem at /backups to make sure everything is kosher before doing anything with dattobd.

try dd if=/dev/urandom of=/backups... to it first make sure everything is okay, not related to dattobd.

the only other thing I can think is there are some cases where linux's error messages aren't the most accurate. so read only filesystem is pretty distinct sometimes you can get things into a state where the not obvious is going on and the error actually refers to a subfunction of a command your running or something like that.

nixomose commented 3 years ago

erm... I don't see /backups mounted anywhere in the list above, which means /backups is a directory on / which is on /dev/sda2 which is the block device you're snapshotting.

and while this might appear to work, it's unrealistic to copy a block device to a file on that block device. maybe I'm missing some aspect of your setup.

yito24 commented 3 years ago

I have been able to reproduce this issue. Debian 10 is fine. It is occurring in Debian 9.