public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* LVM + XFS + external log + snapshots
@ 2013-06-22  5:30 aurfalien
  2013-06-22  7:58 ` Stan Hoeppner
  2013-06-23 22:55 ` Dave Chinner
  0 siblings, 2 replies; 8+ messages in thread
From: aurfalien @ 2013-06-22  5:30 UTC (permalink / raw)
  To: xfs

Hi all,

So I have an XFS file system within LVM  which has an external log.

My mount option in FSTAB is;

/dev/vg_spock_data/lv_data	/data	xfs	logdev=/dev/sdc1,nobarrier,logbufs=8,noatime,nodiratime	1 1

All is well no issues and very fast.

Now I'd like to snapshot this bad boy and then run rsnapshot to create a few days backup.

A snapshot volume is created w/o issue;

lvcreate -L250G -s -n datasnapshot /dev/vg_spock_data/lv_data

But when i try to mount the file system;

mount /dev/vg_spock_data/datasnapshot /snapshot -o nouuid,ro

I get this;

mount: wrong fs type, bad option, bad superblock on /dev/mapper/vg_anette_data-datasnapshot,
      missing codepage or helper program, or other error
      In some cases useful info is found in syslog - try
      dmesg | tail  or so

The command dmesg shows;

XFS (dm-3): filesystem is marked as having an external log; specify logdev on the mount command line.
XFS (dm-3): SB validate failed

So I then use this mount option;

mount /dev/vg_anette_data/datasnapshot /snapshot -o logdev=/dev/sdc1,nouuid,ro

But get this error;

mount: /dev/mapper/vg_spock_data-datasnapshot already mounted or /snapshot busy

And the command dmesg shows;

XFS (dm-3): Invalid device [/dev/sdc1], error=-16

Am I doing something wrong or is this not possible?

I prefer being in error, I often am anyways.

Thanks in advance,

- aurf
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: LVM + XFS + external log + snapshots
  2013-06-22  5:30 LVM + XFS + external log + snapshots aurfalien
@ 2013-06-22  7:58 ` Stan Hoeppner
  2013-06-22 21:13   ` aurfalien
  2013-06-23 22:55 ` Dave Chinner
  1 sibling, 1 reply; 8+ messages in thread
From: Stan Hoeppner @ 2013-06-22  7:58 UTC (permalink / raw)
  To: xfs@oss.sgi.com

Sorry for err aurfalien, first reply didn't make the list.

On 6/22/2013 12:30 AM, aurfalien wrote:
> Hi all,
> 
> So I have an XFS file system within LVM  which has an external log.

Migrate to internal logs as snaps are easy.  Since delaylog (2.6.39+)
external logs are generally no longer needed, provide little to no
advantage as log bandwidth drops dramatically.  If RHEL or CentOS that's
6.2 or later.

...
> lvcreate -L250G -s -n datasnapshot /dev/vg_spock_data/lv_data
> 
> But when i try to mount the file system;

For now, to get past this current problem, you must snapshot both the
filesystem and the log, during the same freeze.  You're currently
cloning the Lone Ranger without cloning Tonto.  Ain't gonna work.  And
it looks like the log device doesn't reside on LVM, so you're outta
luck, can't snap it.

> logdev=/dev/sdc1


> Am I doing something wrong or is this not possible?

Your first error was putting the log on raw storage instead of an LV.
If your kernel is new enough to support delaylog, then your 2nd error
was using an external log.  External logs were once useful for high
metadata workloads, but since delaylog they are largely no longer needed.

xfsdump the filesytem, mkfs.xfs with an internal log, then xfsrestore.

Alternatively you could keep the external log:  Remount the live XFS
using an alternate location for the log.  Put an LV on sdc1.  Then
remount again using this new LV as the log location.  Then you can snap
both XFS and the log, and mount the snap with the matching log.

-- 
Stan

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: LVM + XFS + external log + snapshots
  2013-06-22  7:58 ` Stan Hoeppner
@ 2013-06-22 21:13   ` aurfalien
  0 siblings, 0 replies; 8+ messages in thread
From: aurfalien @ 2013-06-22 21:13 UTC (permalink / raw)
  To: stan; +Cc: xfs@oss.sgi.com

Many many thanks Stan.

It appears that I poorly architected the file system layout.

Will most likely move the log to another device, then LVM the original device (sdc1) and move it back.

Many many thanks for the info, very top tier expert level for sure.

- aurf
On Jun 22, 2013, at 12:58 AM, Stan Hoeppner wrote:

> Sorry for err aurfalien, first reply didn't make the list.
> 
> On 6/22/2013 12:30 AM, aurfalien wrote:
>> Hi all,
>> 
>> So I have an XFS file system within LVM  which has an external log.
> 
> Migrate to internal logs as snaps are easy.  Since delaylog (2.6.39+)
> external logs are generally no longer needed, provide little to no
> advantage as log bandwidth drops dramatically.  If RHEL or CentOS that's
> 6.2 or later.
> 
> ...
>> lvcreate -L250G -s -n datasnapshot /dev/vg_spock_data/lv_data
>> 
>> But when i try to mount the file system;
> 
> For now, to get past this current problem, you must snapshot both the
> filesystem and the log, during the same freeze.  You're currently
> cloning the Lone Ranger without cloning Tonto.  Ain't gonna work.  And
> it looks like the log device doesn't reside on LVM, so you're outta
> luck, can't snap it.
> 
>> logdev=/dev/sdc1
> 
> 
>> Am I doing something wrong or is this not possible?
> 
> Your first error was putting the log on raw storage instead of an LV.
> If your kernel is new enough to support delaylog, then your 2nd error
> was using an external log.  External logs were once useful for high
> metadata workloads, but since delaylog they are largely no longer needed.
> 
> xfsdump the filesytem, mkfs.xfs with an internal log, then xfsrestore.
> 
> Alternatively you could keep the external log:  Remount the live XFS
> using an alternate location for the log.  Put an LV on sdc1.  Then
> remount again using this new LV as the log location.  Then you can snap
> both XFS and the log, and mount the snap with the matching log.
> 
> -- 
> Stan
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: LVM + XFS + external log + snapshots
  2013-06-22  5:30 LVM + XFS + external log + snapshots aurfalien
  2013-06-22  7:58 ` Stan Hoeppner
@ 2013-06-23 22:55 ` Dave Chinner
  2013-06-23 23:24   ` Eric Sandeen
  1 sibling, 1 reply; 8+ messages in thread
From: Dave Chinner @ 2013-06-23 22:55 UTC (permalink / raw)
  To: aurfalien; +Cc: xfs

On Fri, Jun 21, 2013 at 10:30:31PM -0700, aurfalien wrote:
> Hi all,
> 
> So I have an XFS file system within LVM  which has an external log.
> 
> My mount option in FSTAB is;
> 
> /dev/vg_spock_data/lv_data	/data	xfs	logdev=/dev/sdc1,nobarrier,logbufs=8,noatime,nodiratime	1 1
> 
> All is well no issues and very fast.
> 
> Now I'd like to snapshot this bad boy and then run rsnapshot to create a few days backup.

You need to snapshot the log device as well.

But that is problematic in that you need to snapshot it at the same
time you snapshot the data volume. Hence yo'd have to do:

# xfs_freeze -f <filesystem>
# <snapshot data volume>
# <snapshot log volume>
# xfs_freeze -u <filesystem>

And now you can mount the snapshot with:

# mount /dev/vg_spock_data/datasnapshot /snapshot -o nouuid,ro,logdev=/dev/vg_spock_log/logsnapshot

If you can't snapshot the log device, then you can't snapshot the
filesystem. Yet another reason for using internal logs...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: LVM + XFS + external log + snapshots
  2013-06-23 22:55 ` Dave Chinner
@ 2013-06-23 23:24   ` Eric Sandeen
  2013-06-23 23:39     ` Dave Chinner
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Eric Sandeen @ 2013-06-23 23:24 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs, aurfalien

On 6/23/13 5:55 PM, Dave Chinner wrote:
> On Fri, Jun 21, 2013 at 10:30:31PM -0700, aurfalien wrote:
>> Hi all,
>>
>> So I have an XFS file system within LVM  which has an external log.
>>
>> My mount option in FSTAB is;
>>
>> /dev/vg_spock_data/lv_data	/data	xfs	logdev=/dev/sdc1,nobarrier,logbufs=8,noatime,nodiratime	1 1
>>
>> All is well no issues and very fast.
>>
>> Now I'd like to snapshot this bad boy and then run rsnapshot to create a few days backup.
> 
> You need to snapshot the log device as well.
> 
> But that is problematic in that you need to snapshot it at the same
> time you snapshot the data volume. Hence yo'd have to do:
> 
> # xfs_freeze -f <filesystem>
> # <snapshot data volume>
> # <snapshot log volume>
> # xfs_freeze -u <filesystem>
> 
> And now you can mount the snapshot with:
> 
> # mount /dev/vg_spock_data/datasnapshot /snapshot -o nouuid,ro,logdev=/dev/vg_spock_log/logsnapshot
> 
> If you can't snapshot the log device, then you can't snapshot the
> filesystem. Yet another reason for using internal logs...

Hm, given that freezing the fs makes the log (almost) completely clean, I wonder
if he could mount with /dev/zero (or a loopback 0-filled file) to get at the snapshot,
especially since it's being mounted RO.

Should be safe & consistent, no?

i.e.

truncate --size=2g logfile (or however big it needs to be)
losetup /dev/loop0 logfile
mount /dev/vg_anette_data/datasnapshot /snapshot -o logdev=/dev/loop0,nouuid,ro

-Eric

> Cheers,
> 
> Dave.
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: LVM + XFS + external log + snapshots
  2013-06-23 23:24   ` Eric Sandeen
@ 2013-06-23 23:39     ` Dave Chinner
  2013-06-24  0:33     ` aurfalien
  2013-06-24  0:44     ` aurfalien
  2 siblings, 0 replies; 8+ messages in thread
From: Dave Chinner @ 2013-06-23 23:39 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs, aurfalien

On Sun, Jun 23, 2013 at 06:24:39PM -0500, Eric Sandeen wrote:
> On 6/23/13 5:55 PM, Dave Chinner wrote:
> > On Fri, Jun 21, 2013 at 10:30:31PM -0700, aurfalien wrote:
> >> Hi all,
> >>
> >> So I have an XFS file system within LVM  which has an external log.
> >>
> >> My mount option in FSTAB is;
> >>
> >> /dev/vg_spock_data/lv_data	/data	xfs	logdev=/dev/sdc1,nobarrier,logbufs=8,noatime,nodiratime	1 1
> >>
> >> All is well no issues and very fast.
> >>
> >> Now I'd like to snapshot this bad boy and then run rsnapshot to create a few days backup.
> > 
> > You need to snapshot the log device as well.
> > 
> > But that is problematic in that you need to snapshot it at the same
> > time you snapshot the data volume. Hence yo'd have to do:
> > 
> > # xfs_freeze -f <filesystem>
> > # <snapshot data volume>
> > # <snapshot log volume>
> > # xfs_freeze -u <filesystem>
> > 
> > And now you can mount the snapshot with:
> > 
> > # mount /dev/vg_spock_data/datasnapshot /snapshot -o nouuid,ro,logdev=/dev/vg_spock_log/logsnapshot
> > 
> > If you can't snapshot the log device, then you can't snapshot the
> > filesystem. Yet another reason for using internal logs...
> 
> Hm, given that freezing the fs makes the log (almost) completely clean, I wonder
> if he could mount with /dev/zero (or a loopback 0-filled file) to get at the snapshot,
> especially since it's being mounted RO.
> 
> Should be safe & consistent, no?

In theory. Never tried it myself.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: LVM + XFS + external log + snapshots
  2013-06-23 23:24   ` Eric Sandeen
  2013-06-23 23:39     ` Dave Chinner
@ 2013-06-24  0:33     ` aurfalien
  2013-06-24  0:44     ` aurfalien
  2 siblings, 0 replies; 8+ messages in thread
From: aurfalien @ 2013-06-24  0:33 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs


On Jun 23, 2013, at 4:24 PM, Eric Sandeen wrote:

> On 6/23/13 5:55 PM, Dave Chinner wrote:
>> On Fri, Jun 21, 2013 at 10:30:31PM -0700, aurfalien wrote:
>>> Hi all,
>>> 
>>> So I have an XFS file system within LVM  which has an external log.
>>> 
>>> My mount option in FSTAB is;
>>> 
>>> /dev/vg_spock_data/lv_data	/data	xfs	logdev=/dev/sdc1,nobarrier,logbufs=8,noatime,nodiratime	1 1
>>> 
>>> All is well no issues and very fast.
>>> 
>>> Now I'd like to snapshot this bad boy and then run rsnapshot to create a few days backup.
>> 
>> You need to snapshot the log device as well.
>> 
>> But that is problematic in that you need to snapshot it at the same
>> time you snapshot the data volume. Hence yo'd have to do:
>> 
>> # xfs_freeze -f <filesystem>
>> # <snapshot data volume>
>> # <snapshot log volume>
>> # xfs_freeze -u <filesystem>
>> 
>> And now you can mount the snapshot with:
>> 
>> # mount /dev/vg_spock_data/datasnapshot /snapshot -o nouuid,ro,logdev=/dev/vg_spock_log/logsnapshot
>> 
>> If you can't snapshot the log device, then you can't snapshot the
>> filesystem. Yet another reason for using internal logs...
> 
> Hm, given that freezing the fs makes the log (almost) completely clean, I wonder
> if he could mount with /dev/zero (or a loopback 0-filled file) to get at the snapshot,
> especially since it's being mounted RO.
> 
> Should be safe & consistent, no?
> 
> i.e.
> 
> truncate --size=2g logfile (or however big it needs to be)
> losetup /dev/loop0 logfile
> mount /dev/vg_anette_data/datasnapshot /snapshot -o logdev=/dev/loop0,nouuid,ro
> 
> -Eric

I'll try it and let you know.

Should be interesting.

- aurf
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: LVM + XFS + external log + snapshots
  2013-06-23 23:24   ` Eric Sandeen
  2013-06-23 23:39     ` Dave Chinner
  2013-06-24  0:33     ` aurfalien
@ 2013-06-24  0:44     ` aurfalien
  2 siblings, 0 replies; 8+ messages in thread
From: aurfalien @ 2013-06-24  0:44 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs


On Jun 23, 2013, at 4:24 PM, Eric Sandeen wrote:

> On 6/23/13 5:55 PM, Dave Chinner wrote:
>> On Fri, Jun 21, 2013 at 10:30:31PM -0700, aurfalien wrote:
>>> Hi all,
>>> 
>>> So I have an XFS file system within LVM  which has an external log.
>>> 
>>> My mount option in FSTAB is;
>>> 
>>> /dev/vg_spock_data/lv_data	/data	xfs	logdev=/dev/sdc1,nobarrier,logbufs=8,noatime,nodiratime	1 1
>>> 
>>> All is well no issues and very fast.
>>> 
>>> Now I'd like to snapshot this bad boy and then run rsnapshot to create a few days backup.
>> 
>> You need to snapshot the log device as well.
>> 
>> But that is problematic in that you need to snapshot it at the same
>> time you snapshot the data volume. Hence yo'd have to do:
>> 
>> # xfs_freeze -f <filesystem>
>> # <snapshot data volume>
>> # <snapshot log volume>
>> # xfs_freeze -u <filesystem>
>> 
>> And now you can mount the snapshot with:
>> 
>> # mount /dev/vg_spock_data/datasnapshot /snapshot -o nouuid,ro,logdev=/dev/vg_spock_log/logsnapshot
>> 
>> If you can't snapshot the log device, then you can't snapshot the
>> filesystem. Yet another reason for using internal logs...
> 
> Hm, given that freezing the fs makes the log (almost) completely clean, I wonder
> if he could mount with /dev/zero (or a loopback 0-filled file) to get at the snapshot,
> especially since it's being mounted RO.
> 
> Should be safe & consistent, no?
> 
> i.e.
> 
> truncate --size=2g logfile (or however big it needs to be)
> losetup /dev/loop0 logfile
> mount /dev/vg_anette_data/datasnapshot /snapshot -o logdev=/dev/loop0,nouuid,ro
> 
> -Eric
> 

It worked!

After running your mount command above I get;

mount: you didn't specify a filesystem type for /dev/mapper/vg_anette_data-datasnapshot
       I will try type xfs
/dev/mapper/vg_anette_data-datasnapshot on /snapshot type xfs (ro,logdev=/dev/loop0,nouuid)
mount: /snapshot does not contain SELinux labels.
       You just mounted an file system that supports labels which does not
       contain labels, onto an SELinux box. It is likely that confined
       applications will generate AVC messages and not be allowed access to
       this file system.  For more details see restorecon(8) and mount(8).

And the contents of the /snapshot dir matched the data volume files, size, etc...

Wow, how cool are you man, many thanks!!!!

I'm thinking of disabling selinux on this box at any rate which should remove the above message.

- aurf
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-06-24  0:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-22  5:30 LVM + XFS + external log + snapshots aurfalien
2013-06-22  7:58 ` Stan Hoeppner
2013-06-22 21:13   ` aurfalien
2013-06-23 22:55 ` Dave Chinner
2013-06-23 23:24   ` Eric Sandeen
2013-06-23 23:39     ` Dave Chinner
2013-06-24  0:33     ` aurfalien
2013-06-24  0:44     ` aurfalien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox