[parted-devel] [PATCH] Detect Ext4 (Parted Alioth #188)

Bryn M. Reeves bmr at redhat.com
Fri Jan 9 13:12:04 UTC 2009


Colin Watson wrote:
> On Fri, Jan 09, 2009 at 12:41:21PM +0000, Colin Watson wrote:
>> Here's a version of my patch merged with yours. Although I have not yet
>> been able to test them extensively, the block count patches are
>> particularly important; without them, parted will detect the wrong
>> geometry for a >2TB ext4 filesystem.
> 
> And of course it turns out to be rather hard to test these, because
> ext3's maximum file size is 2TB and we need 2^32 4KB blocks (i.e. 16TB)
> before needing to use the high longword of the block count, so it's
> rather hard to create this situation with the sparse loopback file
> approach that would work reasonably in parted's test suite. I can't even
> create an ext4 filesystem and put a loopback file in that (not that that
> would be viable in parted's test suite) because ext4's maximum file size
> is 16TB. Any ideas?
> 

How about using a sparse block device instead of a loopback device 
backed by a sparse file?

The principal is the same but it uses device-mapper's COW target to 
provide the sparsness rather than the file system sparse file support.

You just need to set up a relatively small writable backing store and a 
very large device that uses the device-mapper zero target (a block 
version of /dev/zero). You then snapshot the zero device using the 
backing store and snapshot target and this gives a writable block device 
that is the same size as the zero device used.

I've used this heavily for testing file systems much larger than 16T - 
obviously, it won't work if you need to fill the fs with lots of data 
but should cover the same set of situations as a loopback device can.

This approach was used during the development of ext4 and worked quite 
well there.

Heinze Mauelshagen has a pair of scripts that automate the setup/remove 
steps:

http://www.bullopensource.org/ext4/files/sparse_remove
http://www.bullopensource.org/ext4/files/sparse_create
http://www.bullopensource.org/ext4/files/sparse.txt

Regards,
Bryn.



More information about the parted-devel mailing list