<br><div class="gmail_quote">On 16 June 2010 18:26, Bill Watson <span dir="ltr"><<a href="mailto:bill@magicdigits.com">bill@magicdigits.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
So, with LVM's if I create 1,000 1 meg files, then add 1 meg to each of<br>
those files once a day, the files will be physically automagically<br>
contiguous? That is soooo coool!!!<br><br></blockquote><div><br></div><div>Create files in what?  LVM deals with extents in volumes, you don't create a file in a logical volume.</div><div><br></div><div>What you could do is create 1000 logical volumes and put data in each of those 1000 logical volumes, but that doesn't make sense.  The smallest possible size of a logical volume is a physical extent, the size of a physical extent depends on the size of the physical volume, but on my 180GB disk the physical extent is 4MB; I seem to recall on a rather larger disk on another system its 32MB.</div>
<div><br></div><div>So you could put 1MB data in each of those 1000 minimum size logical volumes, and add another 1MB data at the end until you've filled up the logical volume.  At that stage you can add another physical extent to the logical volume and put data in that.   If you're starting with nice big physical volumes then you've got, say, 64MB in two physical extents.  That's two 32MB physically contiguous areas of disk (subject to the drive not remapping bad sectors under you).</div>
<div><br></div><div>The whole point about logical volumes is that they are mostly physically contiguous on the disk (subject to remapping, striping, etc),   You have a lot of choice about the physical layout.  "lvdisplay -m" will show you the physical extents used by the logical volume.  Whether data is linearly arranged through those or striped across multiple physical volumes or mirrored or whatever is a property of the physical volume.</div>
<div><br></div><div>Now, if you shrink, grow, allocate, delete and generally mess with logical volumes enough then you _can_, given sufficient determination, fragment your logical volumes so that they're spread through the physical volumes.   It takes some doing, it's possible, and I"m sure some people have managed it.</div>
<div><br></div><div>Whether that fragmentation matters depends on your disks.   If you're allocating logical volumes on a SAN which has a few hundred disk drives it won't make any difference at all.   If you've managed to fragment a logical volume on a single physical volume (and it's not especially easy) then it will make a small difference and this (and only this) is where you would want to consider defragmenting your logical volumes.  You can do it on-line and it a few commands if you have a second disk handy (it's merely tricky otherwise).</div>
<div><br></div><div>No, on the other hand, if you have ext3 file system and you abuse it by running it almost full almost all the time then you'll get fragmentation problems and you'll see a marked drop in performance.  Especially when you're doing a backup (I speak from experience here).   That, of course, is nothing to do with whether the file system is on a bare disk, a logical volume or carried by a flock of carrier pigeons.</div>
<div><br></div><div>btrfs unifies the physical volumes with the file system to provide striping, redundancy, snapshots  and all that good stuff at -- and this is important -- an object level, not a volumelevel.  Because it's dealing with files which are dynamic and often titchy and because btrfs is an extent-based file system (with variable size extents) then fragmentation is a fact of life and you can't get away from it.  Which is why btrfs has on-line defragmentation.</div>
<div><br></div><div>Now can we get back to some sanity without all the misinformation and confusion about logical volumes and file systems?</div><div><br></div><div>Please.</div><div><br></div><div>Pretty please.</div><div>
<br></div><div>jch</div><div> </div></div>