[linux-lvm] Snapshots and disk re-use
Jonathan Tripathy
jonnyt at abpni.co.uk
Tue Apr 5 23:19:54 UTC 2011
On 06/04/2011 00:11, James Hawtin wrote:
>
>> James,
>>
>> That's fantastic! Thanks very much! I have a couple of questions:
>>
>> 1) If I wanted to create a script that backed up lots of
>> customer-data LVs, could I just do one zero at the end (and still
>> have no data leakage)?
>
> Yes you could, because COW means COPY ON WRITE, so the original block
> is copied onto the COW with the data from the original disk
> overwritting any data currently on it. Before that point any data on
> it was not addressable from the snapshot lv (* see my final point)
>> 2) On average, each of my data LVs are 20GB each, and if I were to
>> create a snapshot of 20GB, this would take about 20 mins to erase. If
>> I made the snapshot only 1GB, that means it would be quick to erase
>> at the end (however only 1GB of data could be created on the respect
>> origin, correct?)
>
> You are right you only have to erase the snapshot cow space, which is
> normally only 10-15% of the whole original disk. 2GB is pretty fast to
> over right on any system I have used these days. To be sure though you
> do need to overwrite the whole cow even if only a few percent was used
> as you cannot tell which few percent that was.
Actually, I meant just making a snapshot of 1GB, not just erase the
first 1GB of a 20GB snapshot. Bu tthis may be moot (See below)
>
> * I do wonder why you are so worried, leakage is only a problem if the
> COW is assigned to a future customer LV. If you always used the same
> space for backups perhaps had a PE just for backups it would never be
> used in a customer lv therefore you could argue that you never have to
> erase it. If its on a pe you only use for snapshotting you also don't
> need to hog the space as any bit of that disk is ok.
Excellent point! As long as I use the same PEs for making the snapshot
everytime, I don't need to ever erase it (And it can be a nice big size
like 50GB, so even my largest customers won't outgrow the snapshot).
However though, wouldn't I need to keep the "hog" around just to make
sure that the snapshot PEs don't get assigned to a new customer LV in
the future (Currently, we don't specify PEs to use when creating normal
LVs)?
An even better question: Does the snapshot have to be on the same
physical disk as the LV its mirroring?
More information about the linux-lvm
mailing list