RE: reiserfsck with LVM read-only snapshot

2006-11-10 Thread Roger Lucas
Thanks - I'll go digging :-)

> -Original Message-
> From: David Masover [mailto:[EMAIL PROTECTED]
> Sent: 10 November 2006 17:45
> To: Roger Lucas
> Cc: reiserfs-list@namesys.com
> Subject: Re: reiserfsck with LVM read-only snapshot
> 
> Roger Lucas wrote:
> 
> > Hmmm.  I'm not sure about dm_snapshot having not used it before and LVM 
> > seems to work pretty well
> (at least as far as its
> > capabilities allow).  I'm open to all suggestions, however.
> 
> I'm not sure exactly where to point you to, though. The scary thing
> about dm_snapshot is that there's so little documentation.
> 
> No, wait, looks like there is. Check a copy of the kernel source:
> 
> Documentation/device-mapper/snapshot.txt
> 
> You should be able to get it to work, even on top of LVM. But, if you're
> only using LVM for snapshots, you might consider using device-mapper
> directly instead.
> 
> Try it out on some loop devices first to get an idea of how it works.
> You know, little 10 meg files with an ext2 fs, set up with losetup (not
> mount -o loop), then you can play with dmsetup. As far as I know, any
> device-mapper device can be created from any block device, period --
> dmraid works by creating dm_linear devices to represent the partitions
> of, say, a dm_stripe device. No performance hit that I can tell.
> 
> If you need more help with that, let me know.



RE: reiserfsck with LVM read-only snapshot

2006-11-10 Thread Roger Lucas
Hi David,

Thanks for the reply - see my comments below...

> -Original Message-
> From: David Masover [mailto:[EMAIL PROTECTED]
> Sent: 10 November 2006 16:54
> To: Roger Lucas
> Cc: reiserfs-list@namesys.com
> Subject: Re: reiserfsck with LVM read-only snapshot
> 
> Roger Lucas wrote:
> 
> > I have tried adding the "--no-journal-available" option to tell it *not* to 
> > replay the journal,
> but it insists on trying to replay
> > the journal, even though I have told it not to.  When it does this, the 
> > same error occurs.
> 
> Is there any way you can force reiserfsck to do this read-only?

That's what I would like to know.  I don't mind if I have to give reiserfsck 
somewhere else to write the rebuilt journal to (e.g. a
file or similar), but I absolutely do not want it writing *back* to the 
snapshot.

> 
> > I understand that Reiser3 is a journalling file system and you would 
> > normally replay the journal,
> but I want to check my read-only
> > copy of the snapshot so that I know it is valid.
> 
> It isn't.
> 
> By definition, assuming this is a snapshot of a live (mounted)
> filesystem, it's not really valid -- it's as if you pulled the plug. I
> can understand why you'd want to do this, but any way you run
> reiserfsck, it's going to tell you that something's wrong, even if that
> "something" is only that it hasn't replayed the journal yet.
> 

I understand what you mean.  I appreciate that snapshotting a live (i.e. 
mounted read-write) filesystem will give you just that, a
snapshot, and individual files may be in a state of flux such that their 
contents are invalid or inconsistent.

In this situation, however, the disk is mounted read-only so it *shouldn't* be 
changing.  I'm just "snapshot"ing the read-only
mounted image because I am paranoid.  

> > I don't want to change the snapshot in any way (e.g. such as writing the 
> > journal
> > changes to it) so that I know the checksum and image data match.  If I take 
> > a R/W snapshot then
> run reiserfsck, it writes changes to
> > the snapshot.
> 
> I see where you're going with this.
> 
> I don't use LVM for snapshots, but I do use dm_snapshot sometimes, for
> exactly this sort of thing -- I have one device I don't want to touch,
> so I grab a chunk of spare space (my swap partition) to use as a
> snapshot device, and take a read/write snapshot and mess with that. My
> original partition is untouched, but I can run fsck.reiser4 on the
> snapshot, try to recover deleted files, etc.
> 
> Now, bear with me. I know you want a read-only snapshot.
> 
> What you want to do is create a read/write snapshot of your read-only
> snapshot. That way, you can still have your checksum run on the
> read-only snapshot, and it will match what you expect, but you can also
> run reiserfsck on the read/write snapshot, and throw it away when you're
> satisfied.

Yep.  That's what I would like too, but LVM cannot do snapshots-of-snapshots 
yet.

> 
> I don't know the procedure for doing this with LVM, but I may be able to
> show you how I'd do it directly with dm_snapshot. It's a bit more
> cumbersome than if reiserfsck cooperated, but you're using a script
> anyway, so it shouldn't be too bad.

Hmmm.  I'm not sure about dm_snapshot having not used it before and LVM seems 
to work pretty well (at least as far as its
capabilities allow).  I'm open to all suggestions, however.

- Roger



reiserfsck with LVM read-only snapshot

2006-11-10 Thread Roger Lucas
I am sure that this question must have been asked before, but I have searched 
the lists and googled with no success.

I have a system that uses Reiser and LVM.  I would like to be able to take a 
snapshot of the system, verify the snapshot is correct,
then save the snapshot elsewhere.  I take SHA1 checksums of the backed up 
images so it is important that the snapshot is read-only.

My test script is:

lvcreate --snapshot -p r --size 128M --name snaptest1 /dev/serverstore/test1
reiserfsck --check -q -y /dev/serverstore/snaptest1
dd if=/dev/serverstore/snaptest1 bs=16M | openssl sha1 > copyImageSHA1
dd if=/dev/serverstore/snaptest1 of=copyimage bs=16M

In this situation, reiserfsck always fails with error

Trans replayed: mountid 10, transid 10, desc 18, len 199, commit 218, next 
trans offset 201
bwrite: write 4096 bytes returned -1 (block=16, dev=3): Operation not permitted

I have tried adding the "--no-journal-available" option to tell it *not* to 
replay the journal, but it insists on trying to replay
the journal, even though I have told it not to.  When it does this, the same 
error occurs.

I understand that Reiser3 is a journalling file system and you would normally 
replay the journal, but I want to check my read-only
copy of the snapshot so that I know it is valid.  I don't want to change the 
snapshot in any way (e.g. such as writing the journal
changes to it) so that I know the checksum and image data match.  If I take a 
R/W snapshot then run reiserfsck, it writes changes to
the snapshot.  Sometimes these changes take time to propagate down to the LVM 
image.  When this happens, the SHA1 checksum may be
done on the old data whilst the copy is done using the new data.  I don't want 
to take the SHA1 checksum on the destination of the
copy - in the real system, this is a remote machine, and I want the SHA1 
checksum done locally to detect any link errors (yes, I am
paranoid).

Is there any way to get reiserfsck to analyse a read-only LVM snapshot, even if 
the journal isn't replayed, etc etc?

Thanks,

Roger