[linux-lvm] How exactly does LVM's get written?

Clint Byrum cbyrum at spamaps.org
Fri Nov 5 23:37:45 UTC 2004


On Fri, 2004-11-05 at 17:16 -0600, Kevin Richard wrote:
> I have searched many topics in archive and even randomly scanned for any
> info related to this but have only come away with a "I think it works this
> way" feeling.
> 
> I set up two 80gig drives as one 160gig VG  /dev/VG1/LV1  I then proceeded
> to copy about 93 gigs of data from a 100gig drive that I will hopefully add
> to the LV to make it 260gigs.
> 
> My questions are:
> 
> 1. Is this a "spill over" type of write method where it will fill up hde1
> (first 80gig) and then move to hdf1 (other 80gig) and then of coarse on to
> hdg1 (100gig)?  Which would allow me the convenience of having one HUGE
> mount and thus not having to constantly monitor and move data to 3 different
> drives as space is needed.  Yet it keeps the data somewhat separated (except
> for the "spill over" that might get wrote to two drives at some point) so if
> I lose a hard drive I only lose what is on that drive and can just replace
> the drive and recreate the VG and salvage all the data on the other two
> drives.  Is this a correct assumption?  I am trying to avoid the disaster of
> a Raid 0 type of system where if you lose one drive you have lost all 3
> drives!
> 

I'm no LVM expert, but I see this question a lot. I think its because of
a misunderstanding of the seperation of filesystem from block device.

Each volume group has a number of physical volumes in it. When you add a
logical volume, the PE's in each PV are allocated in a pretty much
linear fashion, unless you specify striping. So if you allocate 90G from
your original 160G VG, you'll get 80G on the first disk, and then 10G
from the second. The idea behind LVM is that you don't care which drives
the PE's come from, they're just there and available with your data on
them.

> 2. Is there any way to tell what PE's contain what data?  or to see how the
> volumes are filling up?  This would essentially allow me to answer my own
> first question and also verify that it is doing as I want it to do.  To
> clarify, I would be able to tell that Datafile.X which is a 1gig file is
> written to PE's stored on hde1 or hde1 AND hdf1.
> 

My first inclination would be "no". LVM thinks the PE's are "filled"
when they're allocated. It doesn't really care what is writing to each
PE, and whether or not its data, journal, new filesystem, etc.

This is why I personally think its a really bad idea to use LVM without
some sort of disk redundancy. Even if "I can lose the data and it won't
matter", how much is your time worth? They're so darn cheap now... just
use RAID5 and you'll be much happier.

-- 
Clint Byrum <cbyrum at spamaps.org>




More information about the linux-lvm mailing list