linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] snapshots can't be deactivated
@ 2007-07-17 14:33 Falko Zurell
  2007-07-18 11:37 ` Joachim Banzhaf
  0 siblings, 1 reply; 6+ messages in thread
From: Falko Zurell @ 2007-07-17 14:33 UTC (permalink / raw)
  To: linux-lvm

Hello list,

I have a strange behaviour on my snapshots.
I got a Ubuntu Server 7.04 with LVM2 setup:

lvm> version
   LVM version:     2.02.06 (2006-05-12)
   Library version: 1.02.08 (2006-07-17)
   Driver version:  4.11.0


I have two logical volumes I want to make snapshots of every night:

/dev/vg0/home with XFS
/dev/vg0/opt with XFS

These snapshots will be mounted read-only under /backup

So in principle the steps to achieve this should be:

  - unmount the snapshot from yesterday (umount /backup/home)
  - discard the snapshot from yesterday (lvremove -f
/dev/vg0/daily-snapshot-home)
  - freeze the filesystem (xfs_freeze -f /dev/vg0/home)
  - create the snapshot (lvcreate --snapshot --size 20G --name 
daily-snap-home -v /dev/vg0/home)
  - unfreeze the filesystem (xfs_freeze -u /dev/vg0/home)
  - mount the new snapshot ro (mount -oro,nouuid 
/dev/vg0/daily-snap-home /backup/home)


I wrote a script for that with some error checking too. But sometimes 
this doesn't work. The problem seems to be that the snapshot isn't 
removed even if "lvremove -f " sais it is removed. I got the following 
error message when I then recreate the snapshot:

root@konrad:~# ./create-snapshot-home.sh
+ /sbin/lvs
   LV              VG   Attr   LSize   Origin Snap%  Move Log Copy%
   daily-snap-home vg0  swi-ao  20.00G home     0.00
   daily-snap-opt  vg0  swi-ao  20.00G opt      0.08
   home            vg0  owi-ao 100.00G
   opt             vg0  owi-ao 100.00G
   root            vg0  -wi-ao  10.00G
   video           vg0  -wi-ao 800.00G
+ /bin/umount -f /backup/home
+ /sbin/lvdisplay
+ grep /dev/vg0/daily-snap-home
                          /dev/vg0/daily-snap-home [active]
   LV Name                /dev/vg0/daily-snap-home
+ [ 0 -eq 0 ]
+ [ -b /dev/mapper/vg0-daily--snap--home ]
+ /sbin/lvremove -f /dev/vg0/daily-snap-home
   Logical volume "daily-snap-home" successfully removed
+ sleep 5
+ [ -b /dev/mapper/vg0-daily--snap--home ]
+ [ 0 -eq 0 ]
+ /usr/sbin/xfs_freeze -f /home
+ [ 0 -eq 0 ]
+ /sbin/lvcreate --snapshot --size 20G --name daily-snap-home -v 
/dev/vg0/home
     Setting chunksize to 16 sectors.
     Finding volume group "vg0"
     Archiving volume group "vg0" metadata (seqno 116).
     Creating logical volume daily-snap-home
     Creating volume group backup "/etc/lvm/backup/vg0" (seqno 117).
     Found volume group "vg0"
     Creating vg0-daily--snap--home
     Loading vg0-daily--snap--home table
     Resuming vg0-daily--snap--home (254:5)
     Clearing start of logical volume "daily-snap-home"
     Found volume group "vg0"
   LV vg0/daily-snap-home in use: not deactivating
   Couldn't deactivate new snapshot.
+ /usr/sbin/xfs_freeze -u /home
+ /bin/mount -oro,nouuid /dev/vg0/daily-snap-home /backup/home
mount: you must specify the filesystem type

I don't know why this happens. The script will work perfectly 3 out of 5 
times. But sometimes it comes up with the error above.

Are my steps right in principle? Did I forget to do something before or 
after removing?

Thanks and kind regards

-- 

Falko Zurell
Head of Application Management


/i-d media AG
Ohlauer Stra�e 43
D-10999 Berlin

Tel +49 (0)30 - 2 59 47 - 357
Fax +49 (0)30 - 2 59 47 - 471
www.idmedia.com

_______________________________________________

Board: Regine Haschka-Helmer (CEO), Franz Klose (CFO)
Chairman of the Supervisory Board: Christian A. Hufnagl
Headquarters: Berlin, Place of Jurisdiction: Berlin HRB 76342
UST-Id. DE812698340
_______________________________________________


This message may contain confidential information and must not be 
copied, disclosed or used by anybody other than the intended recipient. 
If you have received this message in error, please notify us immediately 
by reply e-mail and delete all records of the message from your 
computer. The views represented in this message are solely those of the 
author. Neither the author nor I-D Media AG accepts any liability for 
the contents of this message.

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

* Re: [linux-lvm] snapshots can't be deactivated
  2007-07-17 14:33 [linux-lvm] snapshots can't be deactivated Falko Zurell
@ 2007-07-18 11:37 ` Joachim Banzhaf
  2007-07-19  7:48   ` Falko Zurell
  2007-07-19 14:52   ` Stuart D. Gathman
  0 siblings, 2 replies; 6+ messages in thread
From: Joachim Banzhaf @ 2007-07-18 11:37 UTC (permalink / raw)
  To: linux-lvm

Hi Falko,

Am Dienstag, 17. Juli 2007 16:33 schrieb Falko Zurell:

> I don't know why this happens. The script will work perfectly 3 out of 5
> times. But sometimes it comes up with the error above.

Maybe some hotplug script trying to find out what kind of new device that is?

> Are my steps right in principle? Did I forget to do something before or
> after removing?

I am by no means an expert on lvm, so dont take this too seriously: shouldn't 
there be an lvchange -an yourlv before lvremove? Maybe this active status is 
still hanging around somewhere although you can force the remove?

HTH

Joachim Banzhaf

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

* Re: [linux-lvm] snapshots can't be deactivated
  2007-07-18 11:37 ` Joachim Banzhaf
@ 2007-07-19  7:48   ` Falko Zurell
  2007-07-19 14:52   ` Stuart D. Gathman
  1 sibling, 0 replies; 6+ messages in thread
From: Falko Zurell @ 2007-07-19  7:48 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 2176 bytes --]

Thanks for the advices. I will look for some hotplug stuff around.

I tried the "lvchange -an" as well as I sounded pragmatic to me. But  
this doesn't seems to work at all on the snapshots.

thanks and kind regards

---

Falko Zurell
Head of Application Management
Mobil +49 (0)160 - 3 62 52 77

/i-d media AG
Ohlauer Straße 43
D-10999 Berlin

Tel +49 (0)30 - 2 59 47 - 357
Fax +49 (0)30 - 2 59 47 - 471
www.idmedia.com

_______________________________________________

Board: Regine Haschka-Helmer (CEO), Franz Klose (CFO)
Chairman of the Supervisory Board: Christian A. Hufnagl
Headquarters: Berlin, Place of Jurisdiction: Berlin HRB 76342
UST-Id. DE812698340
_______________________________________________


This message may contain confidential information and must not be  
copied, disclosed or used by anybody other than the intended  
recipient. If you have received this message in error, please notify  
us immediately by reply e-mail and delete all records of the message  
from your computer. The views represented in this message are solely  
those of the author. Neither the author nor I-D Media AG accepts any  
liability for the contents of this message.


Am 18.07.2007 um 13:37 schrieb Joachim Banzhaf:

> Hi Falko,
>
> Am Dienstag, 17. Juli 2007 16:33 schrieb Falko Zurell:
>
> > I don't know why this happens. The script will work perfectly 3  
> out of 5
> > times. But sometimes it comes up with the error above.
>
> Maybe some hotplug script trying to find out what kind of new  
> device that is?
>
> > Are my steps right in principle? Did I forget to do something  
> before or
> > after removing?
>
> I am by no means an expert on lvm, so dont take this too seriously:  
> shouldn't
> there be an lvchange -an yourlv before lvremove? Maybe this active  
> status is
> still hanging around somewhere although you can force the remove?
>
> HTH
>
> Joachim Banzhaf
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>


[-- Attachment #2: Type: text/html, Size: 12392 bytes --]

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

* Re: [linux-lvm] snapshots can't be deactivated
  2007-07-18 11:37 ` Joachim Banzhaf
  2007-07-19  7:48   ` Falko Zurell
@ 2007-07-19 14:52   ` Stuart D. Gathman
  2007-07-19 21:50     ` David Timms
  1 sibling, 1 reply; 6+ messages in thread
From: Stuart D. Gathman @ 2007-07-19 14:52 UTC (permalink / raw)
  To: LVM general discussion and development

On Wed, 18 Jul 2007, Joachim Banzhaf wrote:

> > Are my steps right in principle? Did I forget to do something before or
> > after removing?
> 
> I am by no means an expert on lvm, so dont take this too seriously: shouldn't 
> there be an lvchange -an yourlv before lvremove? Maybe this active status is 
> still hanging around somewhere although you can force the remove?

When I try lvchange -an C4_SNAP, it always fails.  So I have had to force
the lvremove in the backup script.  I am nervous about this, and already asked
why this is the case.  When reading about the "active" flag, it seems
to have something to do with shared SAN storage volume groups, so perhaps we
are not supposed to deactivate LVs for simple single machine systems.  But the
error from lvremove is disconcerting.  If I force it, what if there is
a *different* error that I really *don't* want to force?

-- 
	      Stuart D. Gathman <stuart@bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.

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

* Re: [linux-lvm] snapshots can't be deactivated
  2007-07-19 14:52   ` Stuart D. Gathman
@ 2007-07-19 21:50     ` David Timms
  2007-07-20  6:24       ` Falko Zurell
  0 siblings, 1 reply; 6+ messages in thread
From: David Timms @ 2007-07-19 21:50 UTC (permalink / raw)
  To: LVM general discussion and development

Stuart D. Gathman wrote:
> On Wed, 18 Jul 2007, Joachim Banzhaf wrote:
> 
>>> Are my steps right in principle? Did I forget to do something before or
>>> after removing?
>> I am by no means an expert on lvm, so dont take this too seriously: shouldn't 
>> there be an lvchange -an yourlv before lvremove? Maybe this active status is 
>> still hanging around somewhere although you can force the remove?
> 
> When I try lvchange -an C4_SNAP, it always fails.  So I have had to force
> the lvremove in the backup script.  I am nervous about this, and already asked
> why this is the case.  When reading about the "active" flag, it seems
> to have something to do with shared SAN storage volume groups, so perhaps we
> are not supposed to deactivate LVs for simple single machine systems.  But the
> error from lvremove is disconcerting.  If I force it, what if there is
> a *different* error that I really *don't* want to force?
Perhaps the command produces an errorlevel that you could test against, 
and only continue when you get the expected error ?

DaveT.

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

* Re: [linux-lvm] snapshots can't be deactivated
  2007-07-19 21:50     ` David Timms
@ 2007-07-20  6:24       ` Falko Zurell
  0 siblings, 0 replies; 6+ messages in thread
From: Falko Zurell @ 2007-07-20  6:24 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 9859 bytes --]

Hello,

I got some more debug output from the lvchange command.
I noticed, that sometimes lvchange -an vg0/daily-snap-opt worked and  
after that I was able to really remove the snapshot.

But most of the times it doesn't work. It seems that system need  
several minutes do free the snapshot because when I wait some minutes  
an retry, I can deactivate and remove the snapshot to reuse the name.

root@konrad:~# lvchange -vvv -an vg0/daily-snap-opt
         Processing: lvchange -vvv -an vg0/daily-snap-opt
         O_DIRECT will be used
       Setting global/locking_type to 1
       Setting global/locking_dir to /var/lock/lvm
       File-based locking enabled.
     Using logical volume(s) on command line
       Locking /var/lock/lvm/V_vg0 WB
         /dev/ram0: Not using O_DIRECT
         Opened /dev/ram0 RW
         /dev/ram0: block size is 1024 bytes
       /dev/ram0: No label detected
         Closed /dev/ram0
         Opened /dev/vg0/root RW O_DIRECT
         /dev/vg0/root: block size is 512 bytes
       /dev/vg0/root: No label detected
         Closed /dev/vg0/root
         /dev/ram1: Not using O_DIRECT
         Opened /dev/ram1 RW
         /dev/ram1: block size is 1024 bytes
       /dev/ram1: No label detected
         Closed /dev/ram1
         Opened /dev/cciss/c0d0p1 RW O_DIRECT
         /dev/cciss/c0d0p1: block size is 1024 bytes
       /dev/cciss/c0d0p1: No label detected
         Closed /dev/cciss/c0d0p1
         Opened /dev/mapper/vg0-home-real RW O_DIRECT
         /dev/mapper/vg0-home-real: block size is 4096 bytes
       /dev/mapper/vg0-home-real: No label detected
         Closed /dev/mapper/vg0-home-real
         /dev/ram2: Not using O_DIRECT
         Opened /dev/ram2 RW
         /dev/ram2: block size is 1024 bytes
       /dev/ram2: No label detected
         Closed /dev/ram2
         Opened /dev/cciss/c0d0p2 RW O_DIRECT
         /dev/cciss/c0d0p2: block size is 4096 bytes
       /dev/cciss/c0d0p2: No label detected
         Closed /dev/cciss/c0d0p2
         Opened /dev/vg0/home RW O_DIRECT
         /dev/vg0/home: block size is 512 bytes
       /dev/vg0/home: No label detected
         Closed /dev/vg0/home
         /dev/ram3: Not using O_DIRECT
         Opened /dev/ram3 RW
         /dev/ram3: block size is 1024 bytes
       /dev/ram3: No label detected
         Closed /dev/ram3
         Opened /dev/cciss/c0d0p3 RW O_DIRECT
         /dev/cciss/c0d0p3: block size is 512 bytes
       /dev/cciss/c0d0p3: lvm2 label detected
         lvmcache: /dev/cciss/c0d0p3: now orphaned
         /dev/cciss/c0d0p3: Found metadata at 156160 size 2511 for  
vg0 (Lw0OiY-teNf-jRuy-Ck2s-mqv7-A4BL-8EIzBo)
         lvmcache: /dev/cciss/c0d0p3: now in VG vg0
         lvmcache: /dev/cciss/c0d0p3: setting vg0 VGID to  
Lw0OiYteNfjRuyCk2smqv7A4BL8EIzBo
         lvmcache: /dev/cciss/c0d0p3: VG vg0: Set creation host to  
konrad.
         Opened /dev/vg0/opt RW O_DIRECT
         /dev/vg0/opt: block size is 512 bytes
       /dev/vg0/opt: No label detected
         Closed /dev/vg0/opt
         /dev/ram4: Not using O_DIRECT
         Opened /dev/ram4 RW
         /dev/ram4: block size is 1024 bytes
       /dev/ram4: No label detected
         Closed /dev/ram4
         Opened /dev/vg0/video RW O_DIRECT
         /dev/vg0/video: block size is 512 bytes
       /dev/vg0/video: No label detected
         Closed /dev/vg0/video
         /dev/ram5: Not using O_DIRECT
         Opened /dev/ram5 RW
         /dev/ram5: block size is 1024 bytes
       /dev/ram5: No label detected
         Closed /dev/ram5
         Opened /dev/disk/by-label/opt RW O_DIRECT
         /dev/disk/by-label/opt: block size is 4096 bytes
       /dev/disk/by-label/opt: No label detected
         Closed /dev/disk/by-label/opt
         /dev/ram6: Not using O_DIRECT
         Opened /dev/ram6 RW
         /dev/ram6: block size is 1024 bytes
       /dev/ram6: No label detected
         Closed /dev/ram6
         Opened /dev/mapper/vg0-daily--snap--home-cow RW O_DIRECT
         /dev/mapper/vg0-daily--snap--home-cow: block size is 4096 bytes
       /dev/mapper/vg0-daily--snap--home-cow: No label detected
         Closed /dev/mapper/vg0-daily--snap--home-cow
         /dev/ram7: Not using O_DIRECT
         Opened /dev/ram7 RW
         /dev/ram7: block size is 1024 bytes
       /dev/ram7: No label detected
         Closed /dev/ram7
         Opened /dev/vg0/daily-snap-home RW O_DIRECT
         /dev/vg0/daily-snap-home: block size is 512 bytes
       /dev/vg0/daily-snap-home: No label detected
         Closed /dev/vg0/daily-snap-home
         /dev/ram8: Not using O_DIRECT
         Opened /dev/ram8 RW
         /dev/ram8: block size is 1024 bytes
       /dev/ram8: No label detected
         Closed /dev/ram8
         /dev/ram9: Not using O_DIRECT
         Opened /dev/ram9 RW
         /dev/ram9: block size is 1024 bytes
       /dev/ram9: No label detected
         Closed /dev/ram9
         Opened /dev/vg0/daily-snap-opt RW O_DIRECT
         /dev/vg0/daily-snap-opt: block size is 4096 bytes
       /dev/vg0/daily-snap-opt: No label detected
         Closed /dev/vg0/daily-snap-opt
         /dev/ram10: Not using O_DIRECT
         Opened /dev/ram10 RW
         /dev/ram10: block size is 1024 bytes
       /dev/ram10: No label detected
         Closed /dev/ram10
         /dev/ram11: Not using O_DIRECT
         Opened /dev/ram11 RW
         /dev/ram11: block size is 1024 bytes
       /dev/ram11: No label detected
         Closed /dev/ram11
         /dev/ram12: Not using O_DIRECT
         Opened /dev/ram12 RW
         /dev/ram12: block size is 1024 bytes
       /dev/ram12: No label detected
         Closed /dev/ram12
         /dev/ram13: Not using O_DIRECT
         Opened /dev/ram13 RW
         /dev/ram13: block size is 1024 bytes
       /dev/ram13: No label detected
         Closed /dev/ram13
         /dev/ram14: Not using O_DIRECT
         Opened /dev/ram14 RW
         /dev/ram14: block size is 1024 bytes
       /dev/ram14: No label detected
         Closed /dev/ram14
         /dev/ram15: Not using O_DIRECT
         Opened /dev/ram15 RW
         /dev/ram15: block size is 1024 bytes
       /dev/ram15: No label detected
         Closed /dev/ram15
       /dev/cciss/c0d0p3: lvm2 label detected
         /dev/cciss/c0d0p3: Found metadata at 156160 size 2511 for  
vg0 (Lw0OiY-teNf-jRuy-Ck2s-mqv7-A4BL-8EIzBo)
       /dev/cciss/c0d0p3: lvm2 label detected
         /dev/cciss/c0d0p3: Found metadata at 156160 size 2511 for  
vg0 (Lw0OiY-teNf-jRuy-Ck2s-mqv7-A4BL-8EIzBo)
         Read vg0 metadata (153) from /dev/cciss/c0d0p3 at 156160  
size 2511
         /dev/cciss/c0d0p3 0:      0   2560: root(0:0)
         /dev/cciss/c0d0p3 1:   2560  25600: home(0:0)
         /dev/cciss/c0d0p3 2:  28160  25600: opt(0:0)
         /dev/cciss/c0d0p3 3:  53760 204800: video(0:0)
         /dev/cciss/c0d0p3 4: 258560  87040: NULL(0:0)
         /dev/cciss/c0d0p3 5: 345600   5120: daily-snap-home(0:0)
         /dev/cciss/c0d0p3 6: 350720   5120: daily-snap-opt(0:0)
         /dev/cciss/c0d0p3 7: 355840 119136: NULL(0:0)
   Can't change snapshot logical volume "daily-snap-opt"
       Unlocking /var/lock/lvm/V_vg0
         Closed /dev/cciss/c0d0p3

Unfortunatly these debug messages doesn't give me a clue why the  
snapshot can't be deactivated.



---

Falko Zurell
Head of Application Management
Mobil +49 (0)160 - 3 62 52 77

/i-d media AG
Ohlauer Straße 43
D-10999 Berlin

Tel +49 (0)30 - 2 59 47 - 357
Fax +49 (0)30 - 2 59 47 - 471
www.idmedia.com

_______________________________________________

Board: Regine Haschka-Helmer (CEO), Franz Klose (CFO)
Chairman of the Supervisory Board: Christian A. Hufnagl
Headquarters: Berlin, Place of Jurisdiction: Berlin HRB 76342
UST-Id. DE812698340
_______________________________________________


This message may contain confidential information and must not be  
copied, disclosed or used by anybody other than the intended  
recipient. If you have received this message in error, please notify  
us immediately by reply e-mail and delete all records of the message  
from your computer. The views represented in this message are solely  
those of the author. Neither the author nor I-D Media AG accepts any  
liability for the contents of this message.


Am 19.07.2007 um 23:50 schrieb David Timms:

> Stuart D. Gathman wrote:
> > On Wed, 18 Jul 2007, Joachim Banzhaf wrote:
> >
> >>> Are my steps right in principle? Did I forget to do something  
> before or
> >>> after removing?
> >> I am by no means an expert on lvm, so dont take this too  
> seriously: shouldn't
> >> there be an lvchange -an yourlv before lvremove? Maybe this  
> active status is
> >> still hanging around somewhere although you can force the remove?
> >
> > When I try lvchange -an C4_SNAP, it always fails.  So I have had  
> to force
> > the lvremove in the backup script.  I am nervous about this, and  
> already asked
> > why this is the case.  When reading about the "active" flag, it  
> seems
> > to have something to do with shared SAN storage volume groups, so  
> perhaps we
> > are not supposed to deactivate LVs for simple single machine  
> systems.  But the
> > error from lvremove is disconcerting.  If I force it, what if  
> there is
> > a *different* error that I really *don't* want to force?
> Perhaps the command produces an errorlevel that you could test  
> against,
> and only continue when you get the expected error ?
>
> DaveT.
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>


[-- Attachment #2: Type: text/html, Size: 22101 bytes --]

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

end of thread, other threads:[~2007-07-20  6:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17 14:33 [linux-lvm] snapshots can't be deactivated Falko Zurell
2007-07-18 11:37 ` Joachim Banzhaf
2007-07-19  7:48   ` Falko Zurell
2007-07-19 14:52   ` Stuart D. Gathman
2007-07-19 21:50     ` David Timms
2007-07-20  6:24       ` Falko Zurell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).