All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arne Jansen <sensille@gmx.net>
To: Martin Steigerwald <Martin@lichtvoll.de>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Safe fsck / consistent backup while mounted
Date: Sat, 04 Jun 2011 16:13:14 +0200	[thread overview]
Message-ID: <4DEA3D7A.40003@gmx.net> (raw)
In-Reply-To: <201106041225.56028.Martin@lichtvoll.de>

On 04.06.2011 12:25, Martin Steigerwald wrote:
> 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,r=
o or
> fsfreeze -f while writing with:
>
> I=3D0; while true ; let I=3DI+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.


for online fsck you can use scrub, it checks at least partially the
consistency.


>
>
> 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

I'd just take a snapshot and backup from there. As a snapshot is a
consistent image of the filesystem at the time the snapshot is taken,
and every database is required to always have an at least recoverable
state on disk, the snapshot represents a state where your DB can
recover from.

>
> My questions are:
>
> 1) Would this work?
>
> 2) Is the sync needed? And if so how to avoid the race condition betw=
een
> the sync and the fsfreeze invocation? Reading from the fsfreeze manpa=
ge 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=B4t tell it.
>
> Thanks,

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-06-04 14:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04 10:25 Safe fsck / consistent backup while mounted Martin Steigerwald
2011-06-04 14:13 ` Arne Jansen [this message]
2011-06-04 16:07 ` Calvin Walton
2011-06-05  7:58 ` David Pottage
  -- strict thread matches above, loose matches on Subject: below --
2011-06-04 13:46 Tomasz Chmielewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DEA3D7A.40003@gmx.net \
    --to=sensille@gmx.net \
    --cc=Martin@lichtvoll.de \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.