* [linux-lvm] summary of what I need to do to mount snapshot on XFS @ 2002-01-08 9:22 Jeremy Hansen 2002-01-09 6:07 ` Adrian Head 0 siblings, 1 reply; 11+ messages in thread From: Jeremy Hansen @ 2002-01-08 9:22 UTC (permalink / raw) To: linux-lvm I've seen a lot of posts that people do have this working. I was hoping someone could give a good summary for the steps involved. The goal is being able to mount the snapshots volume while the live filesystem is mounted. I see bits and pieces of the answer in various posts, so could someone break it down for me in a single mail? Thanks -jeremy ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-08 9:22 [linux-lvm] summary of what I need to do to mount snapshot on XFS Jeremy Hansen @ 2002-01-09 6:07 ` Adrian Head 2002-01-09 7:04 ` Patrick Caulfield 0 siblings, 1 reply; 11+ messages in thread From: Adrian Head @ 2002-01-09 6:07 UTC (permalink / raw) To: linux-lvm, Jeremy Hansen The basic concept is you create a snapshot LV lvcreate -L1G -s -n snap /dev/vg/lv1 This will create a 1G snapshot logical volume called snap for the original logical volume /dev/vg/lv1 If this has completed successfully then you can mount it. mount -t xfs -o nouuid /dev/vg/snap /mnt/snapshot This will mount an xfs snapshot. The -o nouuid is needed so that mount will not complain and refuse to mount an xfs volume with identical uuid's This is a good tutorial: http://www.sistina.com/lvm_howtos/lvm_howto/Common_tasks.html Is this what you are after or are you having problems with lvcreate segfaulting and kernel Oopes? On Wed, 9 Jan 2002 01:24, Jeremy Hansen wrote: > I've seen a lot of posts that people do have this working. I was hoping > someone could give a good summary for the steps involved. The goal is > being able to mount the snapshots volume while the live filesystem is > mounted. I see bits and pieces of the answer in various posts, so could > someone break it down for me in a single mail? > > Thanks > -jeremy > > > > > _______________________________________________ > linux-lvm mailing list > linux-lvm@sistina.com > http://lists.sistina.com/mailman/listinfo/linux-lvm > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html -- Adrian Head (Public Key available on request.) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-09 6:07 ` Adrian Head @ 2002-01-09 7:04 ` Patrick Caulfield 2002-01-09 14:23 ` Jeremy Hansen ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Patrick Caulfield @ 2002-01-09 7:04 UTC (permalink / raw) To: linux-lvm On Wed, Jan 09, 2002 at 10:06:04PM +1000, Adrian Head wrote: > The basic concept is you create a snapshot LV > lvcreate -L1G -s -n snap /dev/vg/lv1 > > This will create a 1G snapshot logical volume called snap for the original > logical volume /dev/vg/lv1 > > If this has completed successfully then you can mount it. > > mount -t xfs -o nouuid /dev/vg/snap /mnt/snapshot You may also need -o norecovery too. patrick ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-09 7:04 ` Patrick Caulfield @ 2002-01-09 14:23 ` Jeremy Hansen 2002-01-09 17:39 ` Adrian Head 2002-01-09 14:34 ` Jeremy Hansen 2002-01-09 14:51 ` Jeremy Hansen 2 siblings, 1 reply; 11+ messages in thread From: Jeremy Hansen @ 2002-01-09 14:23 UTC (permalink / raw) To: linux-lvm My issue wasn't so much with how to create the snapshot but how to simultaneously mount the snapshot with the live filesystem. I saw a big thread about having to uncomment from lvm.c, did that but then got unresolved symbols... It seemed as if there were some issues and a large discussion related to doing this with XFS. Thanks -jeremy On Wed, 2002-01-09 at 05:02, Patrick Caulfield wrote: > On Wed, Jan 09, 2002 at 10:06:04PM +1000, Adrian Head wrote: > > The basic concept is you create a snapshot LV > > lvcreate -L1G -s -n snap /dev/vg/lv1 > > > > This will create a 1G snapshot logical volume called snap for the original > > logical volume /dev/vg/lv1 > > > > If this has completed successfully then you can mount it. > > > > mount -t xfs -o nouuid /dev/vg/snap /mnt/snapshot > > You may also need -o norecovery too. > > patrick > > > _______________________________________________ > linux-lvm mailing list > linux-lvm@sistina.com > http://lists.sistina.com/mailman/listinfo/linux-lvm > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-09 14:23 ` Jeremy Hansen @ 2002-01-09 17:39 ` Adrian Head 2002-01-15 8:19 ` Heinz J . Mauelshagen 0 siblings, 1 reply; 11+ messages in thread From: Adrian Head @ 2002-01-09 17:39 UTC (permalink / raw) To: linux-lvm, Jeremy Hansen If this works for you - good. I have had heaps of issues that I have been working with various developers and trying to get fixed. Basically if I used the SGI 2.4.17-xfs kernel with lvm-1.0.1rc4(ish) some file systems would work but others would fail. Some would fail on snapshot creation, others would fail on snapshot mount and others would fail when the snapshot overflowed. When I upgraded LVM to lvm-1.0.1 other filesystems issues were fixed but others broke again. Check out the "Unable to get XFS, ext3, reiserfs & LVM to coexist happily" http://marc.theaimsgroup.com/?l=linux-lvm&m=100994364215110&w=2 thread on linux-lvm / linux-xfs mail archives and see if any of this relates to your problem. With 2.4.17-xfs + lvm-1.0.1 upgrade patch + VFS-lock patch ext2/3 & resierfs will operate correctly but XFS will fail at snapshot creation. You can do a little source code change and get a XFS snapshot created and mounted; but then it will fail on an overfull snapshot. These problems are being worked on by myself and the great SGI XFS developers. The lvm.c change you talk about I assume is the LVM_VFS_ENHANCEMENT change? For some reason when adding the lvm-1.0.1 upgrade patch this disappears from lvm.c I have been able to get this to compile with the change but I have forgoten what I did. This is one question I would like answered by the LVM gurus: should #define LVM_VFS_ENHANCEMENT still be there after upgrading to lvm-1.0.1? What does LVM_VFS_ENHANCEMENT actually do w.r.t lvm-1.0.1rc4(ish) and lvm-1.0.1? I know that LVM_VFS_ENHANCEMENT in older LVM versions was the locking of the VFS so that snapshots would be consistant - is this still correct and is it still needed? For the "large discussion" you are talking about the "Unable to get XFS, ext3, reiserfs & LVM to coexist happily" thread - hit me off list and I will attempt to summarise it for you. On Thu, 10 Jan 2002 06:09, Jeremy Hansen wrote: > My issue wasn't so much with how to create the snapshot but how to > simultaneously mount the snapshot with the live filesystem. I saw a big > thread about having to uncomment from lvm.c, did that but then got > unresolved symbols... > > It seemed as if there were some issues and a large discussion related to > doing this with XFS. > > Thanks > -jeremy -- Adrian Head (Public Key available on request.) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-09 17:39 ` Adrian Head @ 2002-01-15 8:19 ` Heinz J . Mauelshagen 2002-01-15 9:10 ` Adrian Head 0 siblings, 1 reply; 11+ messages in thread From: Heinz J . Mauelshagen @ 2002-01-15 8:19 UTC (permalink / raw) To: linux-lvm On Thu, Jan 10, 2002 at 09:38:08AM +1000, Adrian Head wrote: > If this works for you - good. I have had heaps of issues that I have been > working with various developers and trying to get fixed. > > Basically if I used the SGI 2.4.17-xfs kernel with lvm-1.0.1rc4(ish) some > file systems would work but others would fail. Some would fail on snapshot > creation, others would fail on snapshot mount and others would fail when the > snapshot overflowed. When I upgraded LVM to lvm-1.0.1 other filesystems > issues were fixed but others broke again. Check out the "Unable to get XFS, > ext3, reiserfs & LVM to coexist happily" > http://marc.theaimsgroup.com/?l=linux-lvm&m=100994364215110&w=2 > thread on linux-lvm / linux-xfs mail archives and see if any of this relates > to your problem. With 2.4.17-xfs + lvm-1.0.1 upgrade patch + VFS-lock patch > ext2/3 & resierfs will operate correctly but XFS will fail at snapshot > creation. You can do a little source code change and get a XFS snapshot > created and mounted; but then it will fail on an overfull snapshot. These > problems are being worked on by myself and the great SGI XFS developers. > > The lvm.c change you talk about I assume is the LVM_VFS_ENHANCEMENT change? > For some reason when adding the lvm-1.0.1 upgrade patch this disappears from > lvm.c I have been able to get this to compile with the change but I have > forgoten what I did. > > This is one question I would like answered by the LVM gurus: should #define > LVM_VFS_ENHANCEMENT still be there after upgrading to lvm-1.0.1? Yes. > What does > LVM_VFS_ENHANCEMENT actually do w.r.t lvm-1.0.1rc4(ish) and lvm-1.0.1? What it did before: compile the VFS lock/unlock calls in. > I > know that LVM_VFS_ENHANCEMENT in older LVM versions was the locking of the > VFS so that snapshots would be consistant - is this still correct and is it > still needed? Yes. > > For the "large discussion" you are talking about the "Unable to get XFS, > ext3, reiserfs & LVM to coexist happily" thread - hit me off list and I will > attempt to summarise it for you. > > On Thu, 10 Jan 2002 06:09, Jeremy Hansen wrote: > > My issue wasn't so much with how to create the snapshot but how to > > simultaneously mount the snapshot with the live filesystem. I saw a big > > thread about having to uncomment from lvm.c, did that but then got > > unresolved symbols... > > > > It seemed as if there were some issues and a large discussion related to > > doing this with XFS. > > > > Thanks > > -jeremy > > -- > Adrian Head > > (Public Key available on request.) > > _______________________________________________ > linux-lvm mailing list > linux-lvm@sistina.com > http://lists.sistina.com/mailman/listinfo/linux-lvm > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html -- Regards, Heinz -- The LVM Guy -- *** Software bugs are stupid. Nevertheless it needs not so stupid people to solve them *** =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Heinz Mauelshagen Sistina Software Inc. Senior Consultant/Developer Am Sonnenhang 11 56242 Marienrachdorf Germany Mauelshagen@Sistina.com +49 2626 141200 FAX 924446 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-15 8:19 ` Heinz J . Mauelshagen @ 2002-01-15 9:10 ` Adrian Head 2002-01-15 11:48 ` Andreas Dilger 0 siblings, 1 reply; 11+ messages in thread From: Adrian Head @ 2002-01-15 9:10 UTC (permalink / raw) To: linux-lvm, Heinz J . Mauelshagen On Wed, 16 Jan 2002 00:16, Heinz J . Mauelshagen wrote: > > The lvm.c change you talk about I assume is the LVM_VFS_ENHANCEMENT > > change? For some reason when adding the lvm-1.0.1 upgrade patch this > > disappears from lvm.c I have been able to get this to compile with the > > change but I have forgoten what I did. > > > > This is one question I would like answered by the LVM gurus: should > > #define LVM_VFS_ENHANCEMENT still be there after upgrading to lvm-1.0.1? > > Yes. I have found that using the generated lvm-1.0.1 upgrade patch that the #define LVM_VFS_ENHANCEMENT gets removed. If all I do is add it back in manually - do I need to worry about other areas of the code that also need touch-ups? How would I tell? Thanks -- Adrian Head (Public Key available on request.) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-15 9:10 ` Adrian Head @ 2002-01-15 11:48 ` Andreas Dilger 0 siblings, 0 replies; 11+ messages in thread From: Andreas Dilger @ 2002-01-15 11:48 UTC (permalink / raw) To: Adrian Head; +Cc: linux-lvm On Jan 16, 2002 01:09 +1000, Adrian Head wrote: > On Wed, 16 Jan 2002 00:16, Heinz J . Mauelshagen wrote: > > > The lvm.c change you talk about I assume is the LVM_VFS_ENHANCEMENT > > > change? For some reason when adding the lvm-1.0.1 upgrade patch this > > > disappears from lvm.c I have been able to get this to compile with the > > > change but I have forgoten what I did. > > > > > > This is one question I would like answered by the LVM gurus: should > > > #define LVM_VFS_ENHANCEMENT still be there after upgrading to lvm-1.0.1? > > > > Yes. > > I have found that using the generated lvm-1.0.1 upgrade patch that the > #define LVM_VFS_ENHANCEMENT gets removed. If all I do is add it back in > manually - do I need to worry about other areas of the code that also need > touch-ups? How would I tell? Well, when you generate a new LVM patch it will just do a "diff" between the lvm.c file in the LVM/kernel directory and the linux/md/lvm.c file. If the VFS-lock patch is applied to the kernel sources and not the LVM/kernel sources, it will be removed by the diff, meaning you will need to apply the VFS-lock patch to the kernel again. If you find you are doing a lot of patching, you could apply the VFS-lock patch to the LVM/kernel/lvm.c file, and then subsequent patches that you create will not have this part removed. Cheers, Andreas -- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-09 7:04 ` Patrick Caulfield 2002-01-09 14:23 ` Jeremy Hansen @ 2002-01-09 14:34 ` Jeremy Hansen 2002-01-10 2:40 ` Anselm Kruis 2002-01-09 14:51 ` Jeremy Hansen 2 siblings, 1 reply; 11+ messages in thread From: Jeremy Hansen @ 2002-01-09 14:34 UTC (permalink / raw) To: linux-lvm On Wed, 2002-01-09 at 05:02, Patrick Caulfield wrote: > On Wed, Jan 09, 2002 at 10:06:04PM +1000, Adrian Head wrote: > > The basic concept is you create a snapshot LV > > lvcreate -L1G -s -n snap /dev/vg/lv1 > > > > This will create a 1G snapshot logical volume called snap for the original > > logical volume /dev/vg/lv1 > > > > If this has completed successfully then you can mount it. > > > > mount -t xfs -o nouuid /dev/vg/snap /mnt/snapshot > > You may also need -o norecovery too. Ahh, it looks as if this did the trick. I was able to mount it! -jeremy > patrick > > > _______________________________________________ > linux-lvm mailing list > linux-lvm@sistina.com > http://lists.sistina.com/mailman/listinfo/linux-lvm > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-09 14:34 ` Jeremy Hansen @ 2002-01-10 2:40 ` Anselm Kruis 0 siblings, 0 replies; 11+ messages in thread From: Anselm Kruis @ 2002-01-10 2:40 UTC (permalink / raw) To: linux-lvm [-- Attachment #1: Type: TEXT/PLAIN, Size: 2122 bytes --] On 9 Jan 2002, Jeremy Hansen wrote: > On Wed, 2002-01-09 at 05:02, Patrick Caulfield wrote: > > On Wed, Jan 09, 2002 at 10:06:04PM +1000, Adrian Head wrote: > > > The basic concept is you create a snapshot LV > > > lvcreate -L1G -s -n snap /dev/vg/lv1 > > > > > > This will create a 1G snapshot logical volume called snap for the original > > > logical volume /dev/vg/lv1 > > > > > > If this has completed successfully then you can mount it. > > > > > > mount -t xfs -o nouuid /dev/vg/snap /mnt/snapshot > > > > You may also need -o norecovery too. > > Ahh, it looks as if this did the trick. I was able to mount it! Alternatively you could try the writeable snapshot patch. Then do an lvchange -p rw /dev/vg/snap mount -t xfs -o nouuid /dev/vg/snap /mnt/snapshot umount /dev/vg/snap sync lvchange -p r /dev/vg/snap # now the xfs on the snapshot is clean mount -t xfs -o ro,nouuid /dev/vg/snap /mnt/snapshot > > -jeremy > > > patrick > > > > > > _______________________________________________ > > linux-lvm mailing list > > linux-lvm@sistina.com > > http://lists.sistina.com/mailman/listinfo/linux-lvm > > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html > > > > _______________________________________________ > linux-lvm mailing list > linux-lvm@sistina.com > http://lists.sistina.com/mailman/listinfo/linux-lvm > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html > --- Anselm Kruis Tel. +49 (0)89-356386-74 science + computing ag FAX +49 (0)89-356386-37 Ingolstädter Str. 22 mailto: A.Kruis@science-computing.de D-80807 München WWW: http://www.science-computing.de/ ********************************************************************** *** CeBIT 2002 *** *** Besuchen Sie uns auf der CeBIT vom 13.-20.03.2002 *** *** auf dem Messegelände in Hannover, Halle 11 *** ********************************************************************** [-- Attachment #2: Type: TEXT/PLAIN, Size: 10926 bytes --] diff -c -r -b -B -N -x CVS LVM.vanilla/PATCHES/linux-2.4.15-writeable-snapshots.patch LVM/PATCHES/linux-2.4.15-writeable-snapshots.patch *** LVM.vanilla/PATCHES/linux-2.4.15-writeable-snapshots.patch Thu Jan 1 01:00:00 1970 --- LVM/PATCHES/linux-2.4.15-writeable-snapshots.patch Sun Nov 18 11:05:14 2001 *************** *** 0 **** --- 1,27 ---- + diff -u --recursive --new-file linux-2.4.15pre4.vanilla/Documentation/Configure.help linux/Documentation/Configure.help + --- linux-2.4.15pre4.vanilla/Documentation/Configure.help Sun Nov 18 10:46:17 2001 + +++ linux/Documentation/Configure.help Sat Nov 17 22:55:13 2001 + @@ -1693,6 +1693,13 @@ + want), say M here and read <file:Documentation/modules.txt>. The + module will be called lvm-mod.o. + + +Support for writeable snapshots + +CONFIG_LVM_WRITEABLE_SNAPSHOTS + + The LVM driver allows you to make snapshots of a logocal volume. + + Usually these snapshots are read-only. This options add support for + + writeable snapshots. You can use a writeable snapshot to run a + + filesystem check on the snapshot prior to mounting it. + + + Multiple devices driver support (RAID and LVM) + CONFIG_MD + Support multiple physical spindles through a single logical device. + diff -u --recursive --new-file linux-2.4.15pre4.vanilla/drivers/md/Config.in linux/drivers/md/Config.in + --- linux-2.4.15pre4.vanilla/drivers/md/Config.in Fri Sep 14 23:22:18 2001 + +++ linux/drivers/md/Config.in Sat Nov 17 22:41:02 2001 + @@ -14,5 +14,6 @@ + dep_tristate ' Multipath I/O support' CONFIG_MD_MULTIPATH $CONFIG_BLK_DEV_MD + + dep_tristate ' Logical volume manager (LVM) support' CONFIG_BLK_DEV_LVM $CONFIG_MD + +dep_mbool ' Support for writeable snapshots' CONFIG_LVM_WRITEABLE_SNAPSHOTS $CONFIG_BLK_DEV_LVM $CONFIG_EXPERIMENTAL + + endmenu diff -c -r -b -B -N -x CVS LVM.vanilla/kernel/lvm.c LVM/kernel/lvm.c *** LVM.vanilla/kernel/lvm.c Tue Jan 1 21:49:48 2002 --- LVM/kernel/lvm.c Tue Jan 1 22:04:01 2002 *************** *** 214,219 **** --- 214,220 ---- * in the LV each time. [AED] * 12/10/2001 - Use add/del_gendisk() routines in 2.4.10+ * 01/11/2001 - Backport read_ahead change from Linus kernel [AED] + * 01/01/2002 - Support for writeable snapshots [A.Kruis@science-computing.de] * */ *************** *** 374,379 **** --- 375,385 ---- ushort lvm_iop_version = LVM_DRIVER_IOP_VERSION; int loadtime = 0; const char *const lvm_name = LVM_NAME; + ushort lvm_feature_bits = + #ifdef CONFIG_LVM_WRITEABLE_SNAPSHOTS + LVM_FEATURE_WRITEABLE_SNAPSHOTS | + #endif + 0; /* volume group descriptor area pointers */ *************** *** 717,722 **** --- 723,735 ---- /* Main command switch */ switch (command) { + case LVM_GET_FEATURE_BITS: + /* return a the feature bits. These bits indicate particular + features supported by this kernel. */ + if (copy_to_user(arg, &lvm_feature_bits, sizeof(ushort)) != 0) + return -EFAULT; + return 0; + case LVM_LOCK_LVM: /* lock the LVM */ return lvm_do_lock_lvm(); *************** *** 1063,1068 **** --- 1076,1084 ---- return -EFAULT; break; + case BLKBSZGET: + case BLKBSZSET: + return blk_ioctl (inode->i_rdev, command, a); case HDIO_GETGEO: /* get disk geometry */ *************** *** 1293,1298 **** --- 1309,1315 ---- lv_t *lv = vg_this->lv[LV_BLK(minor)]; + restart: down_read(&lv->lv_lock); if (!(lv->lv_status & LV_ACTIVE)) { printk(KERN_ALERT *************** *** 1381,1389 **** goto out; if (lv->lv_access & LV_SNAPSHOT) { /* remap snapshot */ ! if (lvm_snapshot_remap_block(&rdev_map, &rsector_map, ! pe_start, lv) < 0) goto bad; } else if (rw == WRITE || rw == WRITEA) { /* snapshot origin */ lv_t *snap; --- 1398,1425 ---- goto out; if (lv->lv_access & LV_SNAPSHOT) { /* remap snapshot */ ! int ret; ! ret = lvm_snapshot_remap_block(&rdev_map, &rsector_map, ! pe_start, lv); ! if (ret < 0) goto bad; + if (ret > 0 || !(rw == WRITE || rw == WRITEA)) + goto out; /* already remapped or read access */ + + #ifdef CONFIG_LVM_WRITEABLE_SNAPSHOTS + /* remap the block */ + + /* Serializes the COW with the accesses to the + snapshot device. + + __remap_snapshot acquires the write lock. */ + up_read(&lv->lv_lock); + __remap_snapshot(rdev_map, rsector_map, + pe_start, lv, vg_this); + goto restart; + #else + goto bad; + #endif } else if (rw == WRITE || rw == WRITEA) { /* snapshot origin */ lv_t *snap; diff -c -r -b -B -N -x CVS LVM.vanilla/kernel/lvm.h LVM/kernel/lvm.h *** LVM.vanilla/kernel/lvm.h Tue Jan 1 21:49:48 2002 --- LVM/kernel/lvm.h Thu Nov 29 22:06:46 2001 *************** *** 72,77 **** --- 72,78 ---- * 22/06/2001 - added Andreas Dilger's PE on 4k boundary alignment enhancements * 19/07/2001 - added rwsem compatibility macros for 2.2 kernels * 13/11/2001 - reduced userspace inclusion of kernel headers to a minimum + * 18/11/2001 - added defines for LVM_GET_FEATURE_BITS ioctl [A.Kruis] * */ *************** *** 368,374 **** --- 369,384 ---- /* This is actually the same as _IO ( 0xff, 0x00), oops. Remove for IOP 12+ */ #define LVM_LOCK_LVM _IO ( 0xfe, 0x100) #endif + /* get lvm feature bits */ + #define LVM_GET_FEATURE_BITS _IOR ( 0xfe, 0x9b, 1) /* END ioctls */ + + + /* + * Feature Bits + */ + /* makeing a snapshot witeable is save */ + #define LVM_FEATURE_WRITEABLE_SNAPSHOTS 0x01 /* diff -c -r -b -B -N -x CVS LVM.vanilla/tools/lib/liblvm.h LVM/tools/lib/liblvm.h *** LVM.vanilla/tools/lib/liblvm.h Tue Jan 1 21:49:48 2002 --- LVM/tools/lib/liblvm.h Thu Nov 29 22:06:46 2001 *************** *** 409,414 **** --- 409,415 ---- void lvm_dont_interrupt ( int); int lvm_get_col_numbers ( char *, long **); int lvm_get_iop_version ( void); + int lvm_get_feature_bits ( void); void lvm_init(int argc, char **argv); void lvm_interrupt ( void); int lvm_lock ( void); diff -c -r -b -B -N -x CVS LVM.vanilla/tools/lib/lvm_get_feature_bits.c LVM/tools/lib/lvm_get_feature_bits.c *** LVM.vanilla/tools/lib/lvm_get_feature_bits.c Thu Jan 1 01:00:00 1970 --- LVM/tools/lib/lvm_get_feature_bits.c Mon Nov 19 19:49:11 2001 *************** *** 0 **** --- 1,60 ---- + /* + * tools/lib/lvm_get_iop_version.c + * + * Copyright (C) 2001 Anselm Kruis + * + * November 2001 + * + * + * This LVM library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This LVM library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this LVM library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA + * + */ + + /* + * Changelog + * + * 18/11/2001 - created + * + */ + + #include <liblvm.h> + + int lvm_get_feature_bits ( void) { + int group = -1; + int ret = 0; + ushort lvm_feature_bits = 0; + + debug_enter ( "lvm_get_feature_bits -- CALLED\n"); + + /* just to ensure existance of /dev/lvm interface special */ + lvm_check_special (); + + if ( ( group = open ( LVM_DEV, O_RDONLY)) == -1) + ret = -LVM_ELVM_IOP_VERSION_OPEN; + else if ( ( ret = ioctl ( group, LVM_GET_FEATURE_BITS, + &lvm_feature_bits)) == -1) ret = -errno; + debug ( "lvm_get_feature_bits -- AFTER ioctl ret: %d\n", ret); + if ( group != -1) close ( group); + /* older kernels didn't have this IOCTL */ + if ( -ret == EINVAL ) { + ret = 0; + lvm_feature_bits = 0; /* no special features */ + } + if ( ret == 0) ret = lvm_feature_bits; + + debug_leave ( "lvm_get_feature_bits -- LEAVING with ret: %d\n", ret); + return ret; + } diff -c -r -b -B -N -x CVS LVM.vanilla/tools/lvchange.c LVM/tools/lvchange.c *** LVM.vanilla/tools/lvchange.c Wed Jul 25 16:52:19 2001 --- LVM/tools/lvchange.c Mon Nov 19 19:46:12 2001 *************** *** 323,334 **** continue; } ! if ( lv->lv_access & LV_SNAPSHOT) { fprintf ( stderr, "%s -- change on snapshot logical " "volume \"%s\" not allowed\n", cmd, lv_name); continue; } if ( lv->lv_access & LV_SNAPSHOT_ORG) { fprintf ( stderr, "%s -- change on logical volume \"%s\" under " "snapshot not allowed\n", cmd, lv_name); --- 323,345 ---- continue; } ! if ( ( lv->lv_access & LV_SNAPSHOT) && ! ( (opt_C) || (opt_a) || (opt_r))) { fprintf ( stderr, "%s -- change on snapshot logical " "volume \"%s\" not allowed\n", cmd, lv_name); continue; } + if ( ( lv->lv_access & LV_SNAPSHOT) && (opt_p)) { + int feature_bits = lvm_get_feature_bits(); + if ( feature_bits < 0 || !(feature_bits & LVM_FEATURE_WRITEABLE_SNAPSHOTS)) { + fprintf ( stderr, "%s -- change on snapshot logical " + "volume \"%s\" not allowed\n", cmd, lv_name); + continue; + } + } + + /* fixme: opt_p should be save */ if ( lv->lv_access & LV_SNAPSHOT_ORG) { fprintf ( stderr, "%s -- change on logical volume \"%s\" under " "snapshot not allowed\n", cmd, lv_name); *************** *** 364,370 **** if ( doit > 0) { doit_sum++; ! lv->lv_access = lv_access; if ( opt_v > 0) printf ( "%s -- changing access permissions " "of logical volume \"%s\"\n", cmd, lv_name); --- 375,383 ---- if ( doit > 0) { doit_sum++; ! /* don't clear access flags except for LV_WRITE and LV_READ */ ! lv->lv_access &= ~( LV_READ | LV_WRITE ) | lv_access; ! lv->lv_access |= lv_access; if ( opt_v > 0) printf ( "%s -- changing access permissions " "of logical volume \"%s\"\n", cmd, lv_name); ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-lvm] summary of what I need to do to mount snapshot on XFS 2002-01-09 7:04 ` Patrick Caulfield 2002-01-09 14:23 ` Jeremy Hansen 2002-01-09 14:34 ` Jeremy Hansen @ 2002-01-09 14:51 ` Jeremy Hansen 2 siblings, 0 replies; 11+ messages in thread From: Jeremy Hansen @ 2002-01-09 14:51 UTC (permalink / raw) To: linux-lvm Actually, now I am getting Oops Mounting filesystem "lvm(58,1)" in no-recovery mode. Filesystem will be inconsi stent. lvm -- giving up to snapshot /dev/collector/collector_lv on /dev/collector/colle ctor_snapshot: out of space Unable to handle kernel paging request at virtual address 00006e60 printing eip: f884898d *pde = 00000000 Oops: 0000 CPU: 0 EIP: 0010:[<f884898d>] Not tainted EFLAGS: 00010246 eax: 00000dcc ebx: 00006e60 ecx: c7612c00 edx: 00000000 esi: 00000000 edi: 022ae678 ebp: 00000800 esp: e5149a9c ds: 0018 es: 0018 ss: 0018 Process mhonarc (pid: 21751, stackpage=e5149000) Stack: 00000080 e5148000 00000027 00000000 c7612d70 c7612c00 022ae69f 00000003 f8845821 e5149af6 e5149aec 022ae178 c7612c00 00002202 c69e5360 00000f67 f7e90600 f785b000 022ae178 00011560 022ae69f 022ae69f 08000001 c69e5360 Call Trace: [<f8845821>] [<c01b1ddf>] [<f884590f>] [<c0238f4f>] [<c01b1ddf>] [<c01b2007>] [<c01b24a0>] [<c01b211e>] [<c01b1e50>] [<c01f92e4>] [<c01f9a27>] [<c020551e>] [<c01f9157>] [<c01fafe8>] [<c01fb327>] [<c01f8b59>] [<c0204fd3>] [<c0217ffe>] [<c021a437>] [<c01cfa77>] [<c01f4044>] [<c020b2f3>] [<c0219cd1>] [<c0149b9c>] [<c0147496>] [<c0142025>] [<c014204b>] [<c013f01e>] [<c010712b>] Code: 8b 0b eb 12 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 90 8b On Wed, 2002-01-09 at 05:02, Patrick Caulfield wrote: > On Wed, Jan 09, 2002 at 10:06:04PM +1000, Adrian Head wrote: > > The basic concept is you create a snapshot LV > > lvcreate -L1G -s -n snap /dev/vg/lv1 > > > > This will create a 1G snapshot logical volume called snap for the original > > logical volume /dev/vg/lv1 > > > > If this has completed successfully then you can mount it. > > > > mount -t xfs -o nouuid /dev/vg/snap /mnt/snapshot > > You may also need -o norecovery too. > > patrick > > > _______________________________________________ > linux-lvm mailing list > linux-lvm@sistina.com > http://lists.sistina.com/mailman/listinfo/linux-lvm > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2002-01-15 11:48 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-01-08 9:22 [linux-lvm] summary of what I need to do to mount snapshot on XFS Jeremy Hansen 2002-01-09 6:07 ` Adrian Head 2002-01-09 7:04 ` Patrick Caulfield 2002-01-09 14:23 ` Jeremy Hansen 2002-01-09 17:39 ` Adrian Head 2002-01-15 8:19 ` Heinz J . Mauelshagen 2002-01-15 9:10 ` Adrian Head 2002-01-15 11:48 ` Andreas Dilger 2002-01-09 14:34 ` Jeremy Hansen 2002-01-10 2:40 ` Anselm Kruis 2002-01-09 14:51 ` Jeremy Hansen
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.