how to create file without using extent allocation
Greg Freemyer
greg.freemyer at gmail.com
Thu Mar 22 11:45:53 EDT 2012
On Thu, Mar 22, 2012 at 11:10 AM, Akshay Nehe <akshaynehe785 at gmail.com> wrote:
> On 3/22/12, Greg Freemyer <greg.freemyer at gmail.com> wrote:
<snip>
>> 2) I assume you see it is a mkfs option that controls this. So you
>> can't control it on a file by file basis as far as I know. I don't
>> think you can even control it by re-mounting. Instead you have to
>> reformat, so it is a fundamental change.
>>
> Actually I want to create files which uses indirect block mapping
> on ext4 file-system. I have mounted loop device with ext4 file-system,
> can I create files on it using indirect block mapping?
What is a "ext4 file-system"?
If you mean a file-system the ext4 kernel code can read and write,
then yes, the ext4 kernel code is backward compatible to either a ext2
or ext3 feature set file-system, including filesystems created years
ago as ext2 or ext3.
Via mkfs you can either get a group of features via "-t ext3" or
control individual features via -O.
So as stated in Vlad's reply you can reformat your loopback file via:
mkfs -O ^extent -F test1
or possibly more clearly: mkfs -t ext3 -F test1
where test1 is the name of your loopback file. Note ^ mean not in the syntax.
I believe both of the above will create a legacy ext3 style filesystem
that both the ext3 and ext4 kernel module can read.
The key thing is mkfs -t ext3 merely sets a default set of options.
You can override them something like:
mkfs -t ext3 -O extents,dir_index,flex_bg -F test1
Test1 will be a "ext3" filesystem that only the ext4 kernel module can
read/write.
See the mkfs man page and the -t and -O args in particular.
fyi: As you see, the fs type of a partition is less important than the
discreet feature flags. Basically I don't know how mkfs currently
sets the fs_type field, but I do know the feature flags are what you
need to pay extra attention to.
Greg
More information about the Kernelnewbies
mailing list