Safe fsck / consistent backup while mounted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

In mailing list debian-user-german we are discussing safe ways to do a 
fsck when mounted.

I tested with Ext4 that fsck -nf works either with mount -o remount,ro or 
fsfreeze -f while writing with:

I=0; while true ; let I=I+1 ; do touch /boot/test$I ; sleep 0.2 ; done

In the read only mount case the write application returns errors, in the 
fsfreeze case Linux kernel stacks the changes in memory, but the fsck 
reports no errors like it should.


Now I thought about a way to safely backup a MySQL or other database - 
without long service interruption:

- Tell DB to turn itself into consistent state and freeze there
- sync / btrfs filesystem sync ; fsfreeze -f /mountpoint
- btrfs subvolume snapshot
- fsfreeze -u /mountpoint
- Tell DB to continue business as usual

My questions are:

1) Would this work?

2) Is the sync needed? And if so how to avoid the race condition between 
the sync and the fsfreeze invocation? Reading from the fsfreeze manpage I 
understand that fsfreeze allows all ongoing transactions to complete. But 
does that include everything what sync would bring to disk?

3) Is the fsfreeze needed at all? Does btrfs subvolume freeze the 
filesystem prior to the snapshot? The manpage doesn´t tell it.

Thanks,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux