Hello everybody :)

first time participant on linux-btrfs@vger.kernel.org mailinglist, 
hence please excuse (yet tell me about) any problems. thank you.

My question/topic is:
Wanting to generate backups of a btrfs filesystems on a running system
it seems that using `btrfs subvolume snapshot` would be a possible way
to make certain that data kept in RAM (i.e. buffer/cache) would be 
synced to the disk.  

Reading this mailing list I stumpled upon this:

>> Subject:    Re: freezes during snapshot creation/deletion -- to be expected? 
>> (Was: Re: btrfs based backup?)
>> From:       Zygo Blaxell <ce3g8jdj () umail ! furryterror ! org>
>>
>> [..]
>>
>> Snapshot create has unbounded running time on 5.0 kernels.  The creation
>> process has to flush dirty buffers to the filesystem to get a clean
>> snapshot state.  Any process that is writing data while the flush is
>> running gets its data included in the snapshot flush, so in the worst
>> possible case, the snapshot flush never ends (unless you run out of disk
>> space, or whatever was writing new data stops, whichever comes first).
>> [..]

Now I wonder that if `btrfs filesystem sync` would be a viable alternative 
to `btrfs subvolume snapshot`, with respect of not having to risk a 
"snapshot flush never ends" situation? 

My layman perception is that.

1) "btrfs on-disk-persistet data is ideally alway non-corrupted". Since
changes are commited via COW and hence in a atomic fashion, meaning that
at worst data on disk is outdated, but never corrupt. (unless hardware or 
blockdevice issues )

2) btrfs filesystem sync or sync(1) should flush data out from memory
to disk - which would once finished - lead to a "more recent" consistent
data on disk. 

3) btrfs subvolume snapshot implies a sync

Are those perceptions roughly correct?

If so I am unsure if the issue with a "neverending flush" is related to
the btrfs filesystem sync and consequently relying on btrfs filesystem 
sync as alternative to btrfs snapshot to prevent "a neverending flush"
is not a possibility. 

Tahnk yo and best regards,

Alexander Mahr

Reply via email to