linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Snapshot questions
@ 2007-05-06  5:32 Ed Martin
  0 siblings, 0 replies; 18+ messages in thread
From: Ed Martin @ 2007-05-06  5:32 UTC (permalink / raw)
  To: linux-lvm

Hi,
	I have been looking into doing snapshots with LVM and i have found the 
documentation is very light on how they work. Sorry for all the 
questions, they are probably very easy and i realize its a lot but the 
documentation says almost nothing about this and i would really like to 
know. Even just pointing me to something that answers this would be 
nice. So far all i have found is tldp.org and that has about 1 page on 
snapshots and there are about 100 other sites listing the same text 
(almost word for word) So I'm going to ask my questions here and 
hopefully get an idea on how it all works.

First what exactly is the size of a snapshot used for? Is the the total 
difference (changed data) between the snapshot and the active LV that it 
was created against? What happens if i have multiple snapshots? are the 
snapshots changed data shared, so if i have LV1, make snap1 from LV1, 
then change LV1 it uses space in snap1 correct? what if i then add snap2 
created from LV1, does modifying LV1 remove free space from snap1 and 
snap2, or just snap2?

If snapshots only use the space that has been changed between it and the 
   LV it was created from then does that imply that a new snapshot uses 
zero space on the VG (if i made its size 1GB) and grow as data is 
changed, or does it use 1GB of space on the VG immediately, basically i 
want to know if the specified size of the snapshots is allowed to sum to 
more then the space on the VG (so if the VG is 200GB, and i put a 100GB 
LV on it, am i limited to 10 10GB snaps (to sum to the 100GB), or can i 
put 10 50GB snaps on it (which would probably only have a very small 
percent of usage) and let then get auto-deleted as space runs out?

I saw that snapshots are deleted when the LV is full, does this mean 
when the snapshot differers by more then the changes made since it was 
created? if so what snapshot gets deleted? is it just the one that ran 
out of space? what if there was a snapshot that came before it that has 
not run out of space?

What about fragmentation, does LVM handle 50 snapshots of a single VG 
(against a single LV), or will that cause massive fragmentation? does 
LVM have problems with high numbers of snapshots, or is 50+ considered 
normal?

And for the last question, I'm building a backup server, right now I'm 
taking a RAID, putting LVM on it, and I'm thinking about taking weekly 
snapshots of the backup data to allow me to rollback (for as far back as 
the disk can take me). does this sound like a good idea, or should i try 
something else? what is bad about this plan if its a bad idea? do you 
have any other recommendations to do something like that? the backup 
server is going to be very low load too with all disk idle almost all 
the time except when performing a backup (for a few hours every night)

Thanks in advance for answering any of these questions

	--Ed Martin

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: [linux-lvm] snapshot questions
@ 2001-11-02 17:49 Kenny Gorman
  2001-11-05 10:31 ` Jesus Manuel NAVARRO LOPEZ
  0 siblings, 1 reply; 18+ messages in thread
From: Kenny Gorman @ 2001-11-02 17:49 UTC (permalink / raw)
  To: khayes, linux-lvm

I use cooked file systems for Oracle not RAW.  I am not sure MySQL has
an similar function to Oracle Hot Backup.  Basically, oracle suspends
writes to the datafiles for the tablespaces in Hot Backup by keeping the
whole blocks in the redo logs.  Since MySQL (to my knowledge) doesn't do
something like this, your datafiles will get corrupted when you
snapshot.   I am not sure the 'flush to disk' idea will work... unless
(and maybe your saying this and I am not getting it) MySQL will suspend
writes until your snapshot is done.  I suppose that would work...

In Oracle, the files that are part of the snapshot are not consistent
(corrupted).  Thats just how it works.  Then when you use Oracle to
recover, it puts together the coherent database image using the System
Change Number and the blocks in the redo logs (recovery structures) and
archive logs.  It's pretty advanced in this regard.

We use Veritas in production with Sun.  I am evaluating using Linux in
production.  I am using a SuSE Linux box in production for another
project, and it's stable. Plan to start using snapshots soon in both
environments if the evaluation works out.  Currently snapshots are in
use on testing/dev boxes.

-kg


-----Original Message-----
From:	Kyle Hayes
Sent:	Fri 11/2/2001 3:05 PM
To:	linux-lvm@sistina.com; Kenny Gorman
Cc:	
Subject:	Re: [linux-lvm] snapshot questions

On Friday 02 November 2001 13:59, Kenny Gorman wrote:
> I will try to quicky summarize what _I_ do:
>
> - Yes snapshots work.
> - No, it's not a 1 to 1 disk usage ratio between the vg and the
snapshot
> vol.  It's much less.  I dont know how to test for fullness using
> Linux/LVM yet.
> - I use Oracle, your DB may be different.
> 1) put the tablespaces in hot backup mode
> 2) take a snapshot (mount the snapshot vol) of the volume/s that the
> tablespace is on
> 3) take the db out of hot backup mode.

I use MySQL in a mode that uses files in the filesystem.  Does your
Oracle installation use raw disk or files?  If it is raw disk, then
I probably need to do something that will flush disk changes somehow.
I am hoping that the VFS hooks will make the filesystem flush its 
buffers to disk so that I don't get a snapshot full of garbage.  I
suppose that Oracle will flush all buffers to disk (thus making a
coherent disk image) when you put it into hot backup mode.

When I tell MySQL to flush its tables, it simply writes out everything
it
can, closes and reopens the files.  Thus it is up to the filesystem/OS
to
get the data to the disk in a reasonable fashion.

Interestingly, this may imply (and this seems to be in line with some of
the responses I read) that journaling filesystems may actually be more
of a problem than non-journaling ones.  Weird, but seems to make sense.

> - I also do some checkpointing, etc in my script.

We keep live remote replicas, but sometimes the replica needs to be
rebuild.  In that case, it is very important to have a means of getting
a completely coherent database snapshot.  Right now, this process is
very
carefully done with lots of highly database specific code.  Ick.  It is
a
pain to maintain and has a lot of edge cases that we find from time to
time :-)  We'd like something a little simpler and more complete.

> - the tape drive can then get the backup from the snapshot.

In our case, we spool it off remotely, but I get the idea.

> - You would restore the image from tape, to a new or the orig. volume
> when you recover.
> - no noticable effect on end users, it's a 24/7 thing.  Restores work
> fine.

So you have this in production?

> It's really not all that scary. Sorry for not going into more
technical
> detail.

No problem.  I am still figuring out how to deal with LVM.  It looks
like
the solution to all our problems, but I want to make sure before we
spend 
more time on it.  Our existing solution works, but it costly to
maintain.

Best,
Kyle

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MicroTelco Services saves money on every Fax:
- Fax to email (FREE)
- Fax to PSTN based Fax (Up to 95% Savings)
- Fax Broadcasting: Send 100s of faxes to fax machines
and email addresses in the time it takes to send just one!
===========================================================
    So send a fax today and let us know what you think! 
       For more info. visit: www.internetfaxjack.com
===========================================================

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: [linux-lvm] snapshot questions
@ 2001-11-02 15:58 Kenny Gorman
  2001-11-02 17:04 ` Kyle Hayes
  0 siblings, 1 reply; 18+ messages in thread
From: Kenny Gorman @ 2001-11-02 15:58 UTC (permalink / raw)
  To: linux-lvm

I will try to quicky summarize what _I_ do:

- Yes snapshots work.
- No, it's not a 1 to 1 disk usage ratio between the vg and the snapshot
vol.  It's much less.  I dont know how to test for fullness using
Linux/LVM yet.
- I use Oracle, your DB may be different.
1) put the tablespaces in hot backup mode
2) take a snapshot (mount the snapshot vol) of the volume/s that the
tablespace is on
3) take the db out of hot backup mode.
- I also do some checkpointing, etc in my script.
- the tape drive can then get the backup from the snapshot.
- You would restore the image from tape, to a new or the orig. volume
when you recover.
- no noticable effect on end users, it's a 24/7 thing.  Restores work
fine.

It's really not all that scary. Sorry for not going into more technical
detail.

Kenny Gorman
DBA
Kenamea


-----Original Message-----
From:	Kyle Hayes
Sent:	Fri 11/2/2001 1:41 PM
To:	linux-lvm@sistina.com
Cc:	
Subject:	Re: [linux-lvm] snapshot questions


Hmm, seems to be quite a range of opinion.  However, I must say that
having so many negative options is not a good sign.  Do snapshots
work at all?

If I get a corrupted filesystem in my snapshot, then it doesn't work.

If I have to bend over backwards and change all my apps, then it does
not work.

It is good to hear that it works more like Veritas and less like the
SuSE whitepaper claims.  That paper claimed that the changes will go
to the snapshot partition.  This implied that there would be a terrible
IO hit when you deleted the snapshot partition and the changes need to
be written back to the original partition.

I am confused by the claim (see below) that you need the same amount
of space for the snapshot partition as you had on the original LV.
From what I understood in the HOWTOs and the whitepapers, you only need
as much space as you will have changes during the lifetime of the
snapshot LV.  And, if it works like Veritas, that implies that once
a PE was copied, any further data changes to it would not be copied.
This means that in situations like database systems, you'd actually
need less than the number of PEs that changed.  Is this correct?

Under what circumstances do snapshots work?  I am confused by the
claims that a snapshot partition is going to be "corrupt" as far as
the OS is concerned.  In my scenario, here is what I am planning on
doing:

1) lock all tables against writes.

2) flush all logs and tables to disk.

3) create a snapshot partition for the filesystem (ext2 or probably)
on which the database data resides.  These are not raw disks.

4) unlock the tables.

5) mount the snapshot partition and copy the database data out.

From what I have guessed so far (guesses, which makes me nervous),
if I make sure all changes are flushed to disk, then I am OK.  However,
the responses I have received are not clear on what conditions caused
the problems.

I am also not clear on which kernel and what patches I need to make
sure that the filesystems (ext2,ext3 and reiserfs) will deal with the
VFS patches.

We run 24/7 systems and it is not an option to take down a system to 
back it up.  We can handle slightly degraded performance, but even
that is a problem.

On Friday 02 November 2001 12:03, Brent Harding wrote:
> The only real issue with snapshots is needing a partition reserved for
> it, as you get more and more data, this gets difficult, once half the
> hard disk is full, you can't copy any more. I'd say it sounds easier
to
> just use whatever backup program with cron to execute late at night,
> maybe after midnight, depends how far backup is when a file changes,
> it'll get included if it wasn't backed up yet, otherwise if you change
> something the system already backed up, it gets done on the next run.

This is not what I understood from the HOWTO's and the SuSE whitepaper.
They are quite clear that you only need enough space to contain the
changes that occur while the snapshot partition exists.  

Best,
Kyle

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MicroTelco Services saves money on every Fax:
- Fax to email (FREE)
- Fax to PSTN based Fax (Up to 95% Savings)
- Fax Broadcasting: Send 100s of faxes to fax machines
and email addresses in the time it takes to send just one!
===========================================================
    So send a fax today and let us know what you think! 
       For more info. visit: www.internetfaxjack.com
===========================================================


_______________________________________________
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] 18+ messages in thread
[parent not found: <D880FFC9CFDBA84FA13E9B166D06A123B647FB@daedalus.kenamea.co m>]
* RE: [linux-lvm] snapshot questions
@ 2001-11-02 13:16 Kenny Gorman
  2001-11-05  3:27 ` Jesus Manuel NAVARRO LOPEZ
  0 siblings, 1 reply; 18+ messages in thread
From: Kenny Gorman @ 2001-11-02 13:16 UTC (permalink / raw)
  To: linux-lvm

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

Kyle,

I have the opposite opinion as Jesus.  File system level backups are the
way to go.  Maybe not on Linux (because of the robustness of the
snapshot facility), but for sure using Veritas.  See, file system level
database backups are fast, scalable, and simple.  However, if you can
not count on the data consistency, then I would agree with Jesus.

My personal opinion (as a DBA), is that the simplest approach to backup
and recover is best.  If you cant do the restore at 3:00am with one eye
closed and make 0 mistakes, then it's not worth it (that why I dont use
Oracle RMAN).  I use snapshots (Veritas/Sun) for backups of my
production DB's.  It's really nice to not to ever worry about a backup
window, just backup whenever!

That said, I am _evaluating_ how good Linux/LVM backups are in this
regard.  So far, it's been fine.  Also, as always, make sure you are, or
have a good DBA around. 8-)

2.5 cents.

Kenny Gorman
DBA
Kenamea


-----Original Message-----
From:	Jesus Manuel NAVARRO LOPEZ
Sent:	Fri 11/2/2001 10:52 AM
To:	linux-lvm@sistina.com
Cc:	
Subject:	Re: [linux-lvm] snapshot questions

Hi, Kyle:

Kyle Hayes wrote:
> 
> We are considering using LVM to do database snapshots for backups.
> 

It's so rare the case where this approach really works that it doesn't
even deserve to be taken into consideration, so: DON'T EVER BACKUP A
DATABASE THROUGH FILESYSTEM UTILITIES.  The database has for sure
methods to achieve this goal: use them.
-- 
SALUD,
Jesús
***
jesus_navarro@promofinarsa.es
***

_______________________________________________
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




[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 3475 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread
* [linux-lvm] snapshot questions
@ 2001-11-02 10:42 Kyle Hayes
  2001-11-02 11:28 ` Andreas Dilger
  2001-11-02 12:51 ` Jesus Manuel NAVARRO LOPEZ
  0 siblings, 2 replies; 18+ messages in thread
From: Kyle Hayes @ 2001-11-02 10:42 UTC (permalink / raw)
  To: linux-lvm

We are considering using LVM to do database snapshots for backups.

I have some questions that the HOWTO's etc. do not seem to answer.
My largest concerns are that we will end up with a read-only corrupt
filesystem.  This seems to be a problem reported in the mailing lists.

1) how does the snapshot actually work?  My understanding is that the
creation of a snapshot partition sets up a new LV on the same VG as
the "source" partition.  This new partition is then used for writes to
the "source" partition.  When the snapshot LV is removed, do I get
a disk IO hit as these changes are copied back to the "source" partition?
Or, does it work more like Veritas where the changed data go to the
"source" and the original values are copied to the snapshot partition?
The Veritas method is nice because dropping the snapshot partition
does not require any data copying.

2) are there any people using LVM for database snapshots?  The
Whitepaper from SuSE has examples for Oracle and the HOWTO's
talk about it, but is it used in production?  If so, what issues have you
found?

3) what is the overall stability of snapshot functions?  I have been following
the pvmove thread with some alarm as I thought that LVM functionality was
stable at this point.  Is there a place that I can see what functionality is
considered stable and what isn't?  The mailing list archives do not paint a rosy
picture of snapshot functionality.

4) It seems that most of the LVM work is going into 2.4.  We have not been
particularly pleased with the stability of 2.4 in general and would like to stay
with 2.2 for a while.  How does the stability of LVM on 2.2 compare to 2.4?

5) I have seen references to the VFS lock patch in the mailing list.  Is this
actually supported by any filesystems yet?  Is it in the kernel proper? 

Thanks.

Best,
Kyle


-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MicroTelco Services saves money on every Fax:
- Fax to email (FREE)
- Fax to PSTN based Fax (Up to 95% Savings)
- Fax Broadcasting: Send 100s of faxes to fax machines
and email addresses in the time it takes to send just one!
===========================================================
    So send a fax today and let us know what you think! 
       For more info. visit: www.internetfaxjack.com
===========================================================

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

end of thread, other threads:[~2007-05-06  7:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-06  5:32 [linux-lvm] Snapshot questions Ed Martin
  -- strict thread matches above, loose matches on Subject: below --
2001-11-02 17:49 [linux-lvm] snapshot questions Kenny Gorman
2001-11-05 10:31 ` Jesus Manuel NAVARRO LOPEZ
2001-11-02 15:58 Kenny Gorman
2001-11-02 17:04 ` Kyle Hayes
     [not found] <D880FFC9CFDBA84FA13E9B166D06A123B647FB@daedalus.kenamea.co m>
2001-11-02 13:59 ` Brent Harding
2001-11-02 15:40   ` Kyle Hayes
2001-11-02 16:39     ` Andreas Dilger
2001-11-02 18:20       ` Kyle Hayes
2001-11-05  4:38         ` Jesus Manuel NAVARRO LOPEZ
2001-11-05 10:50           ` Kyle Hayes
2001-11-05 14:21             ` Andreas Dilger
2001-11-05  4:15     ` Jesus Manuel NAVARRO LOPEZ
2001-11-02 13:16 Kenny Gorman
2001-11-05  3:27 ` Jesus Manuel NAVARRO LOPEZ
2001-11-02 10:42 Kyle Hayes
2001-11-02 11:28 ` Andreas Dilger
2001-11-02 12:51 ` Jesus Manuel NAVARRO LOPEZ

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).