* Proper method of snapshotting XFS with external log using LVM2
@ 2007-07-29 19:32 Mario Becroft
2007-08-01 12:17 ` David Chinner
0 siblings, 1 reply; 5+ messages in thread
From: Mario Becroft @ 2007-07-29 19:32 UTC (permalink / raw)
To: linux-xfs
I am using XFS and LVM2 under Linux. My XFS filesystems have an external
log.
What is the correct method of creating an LVM2 snapshot of volumes
containing an XFS filesystem with external log?
Do I need to snapshot the main filesystem volume and the log volume?
Should I be using xfs_freeze to ensure that the filesystem is not
modified between when I create the filesystem snapshot and the log
snapshot?
Or is there a special procedure for atomically creating both snapshots?
Or should I not be using an external log? If not, won't this decrease
performance?
In the past I have successfully used xfs_freeze and created separate
snapshots of the filesystem and log volumes. However, I am not sure
whether this is the recommended approach.
Thanks for any help.
--
Mario Becroft <mb@gem.win.co.nz>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Proper method of snapshotting XFS with external log using LVM2
2007-07-29 19:32 Proper method of snapshotting XFS with external log using LVM2 Mario Becroft
@ 2007-08-01 12:17 ` David Chinner
2007-08-01 12:23 ` Mario Becroft
0 siblings, 1 reply; 5+ messages in thread
From: David Chinner @ 2007-08-01 12:17 UTC (permalink / raw)
To: Mario Becroft; +Cc: linux-xfs
On Mon, Jul 30, 2007 at 07:32:18AM +1200, Mario Becroft wrote:
> I am using XFS and LVM2 under Linux. My XFS filesystems have an external
> log.
>
> What is the correct method of creating an LVM2 snapshot of volumes
> containing an XFS filesystem with external log?
Not sure. I've never tried it.
> Do I need to snapshot the main filesystem volume and the log volume?
Yes.
> Should I be using xfs_freeze to ensure that the filesystem is not
> modified between when I create the filesystem snapshot and the log
> snapshot?
Yes.
> Or is there a special procedure for atomically creating both snapshots?
>
> Or should I not be using an external log? If not, won't this decrease
> performance?
If it doesn't work, then don't use an external log and yes, it will
decrease performance.
> In the past I have successfully used xfs_freeze and created separate
> snapshots of the filesystem and log volumes. However, I am not sure
> whether this is the recommended approach.
As long as both snapshots were taken with the one xfs_freeze command,
then it shouldbe ok.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Proper method of snapshotting XFS with external log using LVM2
2007-08-01 12:17 ` David Chinner
@ 2007-08-01 12:23 ` Mario Becroft
2007-08-01 14:09 ` David Chinner
0 siblings, 1 reply; 5+ messages in thread
From: Mario Becroft @ 2007-08-01 12:23 UTC (permalink / raw)
To: David Chinner; +Cc: linux-xfs
Hi David,
Thanks very much for your clear explanation of how to snapshot XFS
filesystems with external log. It is good to know that I am doing it
right.
I found that in the latest Linux kernel version 2.6.22.1, you cannot use
the method I have been using, and which you confirmed is ok. The problem
is that if you xfs_freeze the filesystem, then the LVM snapshot command
hangs forever. (Back in kernel version 2.6.16 this did not happen.) I
guess the snapshot command is also attempting to freeze the filesystem,
or something, which doesn't work when it is already frozen. I suppose
how to fix this is a question for the linux-lvm mailing list.
Thanks again for your detailed answer.
--
Mario Becroft <mb@gem.win.co.nz>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Proper method of snapshotting XFS with external log using LVM2
2007-08-01 12:23 ` Mario Becroft
@ 2007-08-01 14:09 ` David Chinner
2007-08-01 15:02 ` Mario Becroft
0 siblings, 1 reply; 5+ messages in thread
From: David Chinner @ 2007-08-01 14:09 UTC (permalink / raw)
To: Mario Becroft; +Cc: David Chinner, linux-xfs
On Thu, Aug 02, 2007 at 12:23:29AM +1200, Mario Becroft wrote:
> Hi David,
>
> Thanks very much for your clear explanation of how to snapshot XFS
> filesystems with external log. It is good to know that I am doing it
> right.
>
> I found that in the latest Linux kernel version 2.6.22.1, you cannot use
> the method I have been using, and which you confirmed is ok. The problem
> is that if you xfs_freeze the filesystem, then the LVM snapshot command
> hangs forever.
Ah, yes, I wondered if that still happened. The dm snapshot code is
a little naive - it just assumes that it is the only thing that can
freeze a device.
> (Back in kernel version 2.6.16 this did not happen.) I
> guess the snapshot command is also attempting to freeze the filesystem,
> or something, which doesn't work when it is already frozen.
It hangs on a lock that is held across the xfs_freeze -f ;
xfs_freeze -u sequence.
> I suppose
> how to fix this is a question for the linux-lvm mailing list.
IIRC from the last time this came, they'll tell you not to use
xfs_freeze.
As it is, the freeze_bdev() interface that both xfs_freeze and
dm-snapshot use is a complete pile of crud that we need to fix.
One of these days I'll get some time to fix it....
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Proper method of snapshotting XFS with external log using LVM2
2007-08-01 14:09 ` David Chinner
@ 2007-08-01 15:02 ` Mario Becroft
0 siblings, 0 replies; 5+ messages in thread
From: Mario Becroft @ 2007-08-01 15:02 UTC (permalink / raw)
To: David Chinner; +Cc: linux-xfs, linux-lvm
On Thu, 2007-08-02 at 00:09 +1000, David Chinner wrote:
> [lvm snapshot] hangs on a lock that is held across the xfs_freeze -f ;
> xfs_freeze -u sequence.
Right.
> > I suppose
> > how to fix this is a question for the linux-lvm mailing list.
>
> IIRC from the last time this came, they'll tell you not to use
> xfs_freeze.
Well, two problems with that:
1. There is no way to atomically create snapshots of two different
volumes (the main filesystem and the log) without using xfs_freeze.
2. I tried without xfs_freeze anyway just to see what would happen, and
actually in kernel 2.6.22.1 if you simply create a snapshot of the main
filesystem volume and destroy it several times in a row (not even
touching the log volume yet) lvcreate hangs.
So it sounds like there is a fundamental problem with the approach, plus
a bug somewhere... I will copy this to linux-lvm.
For the benefit of those reading on linux-lvm, the issue is that I am
trying to snapshot an XFS filesystem with an external log. To do this it
is necessary to snapshot two volumes--the main filesystem volume and the
log volume--while the filesystem is frozen. It is not sufficient to
freeze the filesystem separately for each snapshot creation since its
state might change between the two snapshots. The correct approach is to
use xfs_freeze to freeze the filesystem, then create both snapshots,
then unfreeze it. This used to work 100% reliably with kernel 2.6.16,
device-mapper 1.02.03 and LVM2 2.02.02. With device-mapper 1.02.21 and
LVM2 2.02.27, lvcreate hangs while creating a snapshot of a filesystem
that has been frozen with xfs_freeze. Furthermore, when using kernel
2.6.22.1 (and latest device-mapper and LVM2), even if I do not use
xfs_freeze, lvcreate hangs about 10% of the time when creating a
snapshot. Once in the hung state (whether because xfs_freeze was used or
because of the random hang) it seems impossible to get it unstuck
without rebooting the system.
I guess this is not an XFS-specific problem--it would happen with any
filesystem employing a separate log volume.
I am happy to test any patches that might address this issue... or maybe
even hack one up myself if someone gives me some pointers, but I guess
someone who knows something about LVM should really do it.
--
Mario Becroft <mb@gem.win.co.nz>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-08-01 15:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-29 19:32 Proper method of snapshotting XFS with external log using LVM2 Mario Becroft
2007-08-01 12:17 ` David Chinner
2007-08-01 12:23 ` Mario Becroft
2007-08-01 14:09 ` David Chinner
2007-08-01 15:02 ` Mario Becroft
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox