How to generate a large file allocating space

Bodo Thiesen bothie at
Fri Nov 5 11:32:49 UTC 2010

* Alex Bligh <alex at> hat geschrieben:
> I might have another look at using lvm as a blockstore, then running our
> stuff inside lvm. But I didn't think lvm was capable of running thousands
> of LVs per volume group. ext4 is just fine for that. Perhaps I am
> slating lvm unfairly.

The number of logical volumes you can create should be mostly dependand on
the size of the metadata area. A short look on man pvcreate revealed the
command line argument --metadatasize size. Besides of this, lvm should be
able to handle any arbitrary number of logical volumes as long as the
metadata area is big enough to hold the new config. (The same applies to
ext2 and ext3 - if you don't have inodes left, you can't create new files
even with thousands of free terabytes - don't know, if this limitation
still exists in ext4, I'd guess "yes".)

So, my tip would be to just create a pv with a very bit metadata
size (i.e. 512 MB or even bigger) and write a script to create a few
thousand pv on that pv, something like this

pvcreate --metadatasize 512M /dev/foobar
lvcreate foobars /dev/foobar
for i in $(seq 1 1 5000)
	lvcreate --size 256M -n foobar$i foobars

Either it works - or not ...

Regards, Bodo

More information about the Ext3-users mailing list