2009-03-03 23:12:53

by Jan Engelhardt

[permalink] [raw]
Subject: mkfs.ext4: high default -i value undocumented

Hi,


Creating an ext4 filesystem on a 4 GB image file (to be loop-mounted
later) gives me 256K inodes. Choosing -i 4096 instead gives 1M, which
would mean the default for -i is 16384. Besides me finding 16384 a
little unreasonable (XFS offers 2M inodes by default), the big
point is that the mke2fs manpage (belonging to util-linux, hence Cc)
does not mention this 16384 default.
Hope this can be addressed.

# rpm -q e2fsprogs util-linux
e2fsprogs-1.41.4-2.2
util-linux-2.14.2-2.2

Jan


2009-03-03 23:19:37

by Eric Sandeen

[permalink] [raw]
Subject: Re: mkfs.ext4: high default -i value undocumented

Jan Engelhardt wrote:
> Hi,
>
>
> Creating an ext4 filesystem on a 4 GB image file (to be loop-mounted
> later) gives me 256K inodes. Choosing -i 4096 instead gives 1M, which
> would mean the default for -i is 16384.

That's right, look in /etc/mke2fs.conf:

[defaults]
base_features =
sparse_super,filetype,resize_inode,dir_index,ext_attr
blocksize = 4096
inode_size = 256
inode_ratio = 16384

> Besides me finding 16384 a
> little unreasonable (XFS offers 2M inodes by default),

XFS is a totally different beast, because it dynamically allocates
inodes. It doesn't really offer *anything* by default.

Which part of a 16384-data-bytes-to-inode-count ratio do you find
unreasonable? Do you find it unreasonably high, or unreasonably low?

> the big
> point is that the mke2fs manpage (belonging to util-linux, hence Cc)

not so much:
$ rpm -qf /usr/share/man/man8/mke2fs.8.gz
e2fsprogs-1.41.3-2.fc10.x86_64

> does not mention this 16384 default.
> Hope this can be addressed.

You could send a patch :)

-Eric

2009-03-04 00:36:47

by Jan Engelhardt

[permalink] [raw]
Subject: Re: mkfs.ext4: high default -i value undocumented


On Wednesday 2009-03-04 00:19, Eric Sandeen wrote:
>>
>> Creating an ext4 filesystem on a 4 GB image file (to be loop-mounted
>> later) gives me 256K inodes. Choosing -i 4096 instead gives 1M, which
>> would mean the default for -i is 16384.
>
>That's right, look in /etc/mke2fs.conf:
>
>[defaults]
> base_features =
>sparse_super,filetype,resize_inode,dir_index,ext_attr
> blocksize = 4096
> inode_size = 256
> inode_ratio = 16384

Interesting - thanks for the hint.

>> Besides me finding 16384 a
>> little unreasonable (XFS offers 2M inodes by default),
>
>XFS is a totally different beast, because it dynamically allocates
>inodes. It doesn't really offer *anything* by default.
>
>Which part of a 16384-data-bytes-to-inode-count ratio do you find
>unreasonable? Do you find it unreasonably high, or unreasonably low?

I think it's a bit too high, causing the amount of usable inodes
to be a bit too low.

>> the big
>> point is that the mke2fs manpage (belonging to util-linux, hence Cc)
>
>not so much:
>$ rpm -qf /usr/share/man/man8/mke2fs.8.gz
>e2fsprogs-1.41.3-2.fc10.x86_64

Sorry, I had looked for man8/mkfs.ext2.8.gz. I am not quite sure
what makes some developers deviate(*) from the mkfs.$name/fsck.$name
scheme ;-)

(*) e2, reiser(3), dosfs

>> does not mention this 16384 default.
>> Hope this can be addressed.
>
>You could send a patch :)

parent b2ca48f40eb33bd86b8d53d4373e7fce96bced4a (v1.41.4)
commit ca28058c4004ceaa42edeb6ba61bc2aa53d7c03d
Author: Jan Engelhardt <[email protected]>
Date: Wed Mar 4 01:36:09 2009 +0100

doc: mention default for mke2fs -i

Signed-off-by: Jan Engelhardt <[email protected]>
---
misc/mke2fs.8.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 1605895..38ddf6d 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -276,7 +276,7 @@ be smaller than the blocksize of the filesystem, since in that case more
inodes would be made than can ever be used. Be warned that it is not
possible to expand the number
of inodes on a filesystem after it is created, so be careful deciding the
-correct value for this parameter.
+correct value for this parameter. The default value is 16384.
.TP
.BI \-I " inode-size"
Specify the size of each inode in bytes.
--
# Created with git-export-patch

2009-03-04 00:43:45

by Eric Sandeen

[permalink] [raw]
Subject: Re: mkfs.ext4: high default -i value undocumented

Jan Engelhardt wrote:
> On Wednesday 2009-03-04 00:19, Eric Sandeen wrote:
>>> Creating an ext4 filesystem on a 4 GB image file (to be loop-mounted
>>> later) gives me 256K inodes. Choosing -i 4096 instead gives 1M, which
>>> would mean the default for -i is 16384.
>> That's right, look in /etc/mke2fs.conf:
>>
>> [defaults]
>> base_features =
>> sparse_super,filetype,resize_inode,dir_index,ext_attr
>> blocksize = 4096
>> inode_size = 256
>> inode_ratio = 16384
>
> Interesting - thanks for the hint.
>
>>> Besides me finding 16384 a
>>> little unreasonable (XFS offers 2M inodes by default),
>> XFS is a totally different beast, because it dynamically allocates
>> inodes. It doesn't really offer *anything* by default.
>>
>> Which part of a 16384-data-bytes-to-inode-count ratio do you find
>> unreasonable? Do you find it unreasonably high, or unreasonably low?
>
> I think it's a bit too high, causing the amount of usable inodes
> to be a bit too low.

When we doubled the size of inodes by default, we halved the count. I
also have a sneaking suspicion that it may be too low for some
scenarios, but probably ok for most.

>>> the big
>>> point is that the mke2fs manpage (belonging to util-linux, hence Cc)
>> not so much:
>> $ rpm -qf /usr/share/man/man8/mke2fs.8.gz
>> e2fsprogs-1.41.3-2.fc10.x86_64
>
> Sorry, I had looked for man8/mkfs.ext2.8.gz. I am not quite sure
> what makes some developers deviate(*) from the mkfs.$name/fsck.$name
> scheme ;-)

$ rpm -qf /usr/share/man/man8/mkfs.ext2.8.gz
e2fsprogs-1.41.3-2.fc10.x86_64

:)

> (*) e2, reiser(3), dosfs
>
>>> does not mention this 16384 default.
>>> Hope this can be addressed.
>> You could send a patch :)
>
> parent b2ca48f40eb33bd86b8d53d4373e7fce96bced4a (v1.41.4)
> commit ca28058c4004ceaa42edeb6ba61bc2aa53d7c03d
> Author: Jan Engelhardt <[email protected]>
> Date: Wed Mar 4 01:36:09 2009 +0100
>
> doc: mention default for mke2fs -i

thanks :) (up to Ted now)

-Eric

2009-03-04 00:57:33

by Jan Engelhardt

[permalink] [raw]
Subject: Re: mkfs.ext4: high default -i value undocumented


On Wednesday 2009-03-04 01:43, Eric Sandeen wrote:
>>>> the big
>>>> point is that the mke2fs manpage (belonging to util-linux, hence Cc)
>>> not so much:
>>> $ rpm -qf /usr/share/man/man8/mke2fs.8.gz
>>> e2fsprogs-1.41.3-2.fc10.x86_64
>>
>> Sorry, I had looked for man8/mkfs.ext2.8.gz. I am not quite sure
>> what makes some developers deviate(*) from the mkfs.$name/fsck.$name
>> scheme ;-)
>
>$ rpm -qf /usr/share/man/man8/mkfs.ext2.8.gz
>e2fsprogs-1.41.3-2.fc10.x86_64
>:)

/me silently scrubs the cosmic particles from his room.

2009-03-04 02:49:09

by Theodore Ts'o

[permalink] [raw]
Subject: Re: mkfs.ext4: high default -i value undocumented

On Wed, Mar 04, 2009 at 01:36:44AM +0100, Jan Engelhardt wrote:
> >>
> >> Creating an ext4 filesystem on a 4 GB image file (to be loop-mounted
> >> later) gives me 256K inodes. Choosing -i 4096 instead gives 1M, which
> >> would mean the default for -i is 16384.
> >
> >Which part of a 16384-data-bytes-to-inode-count ratio do you find
> >unreasonable? Do you find it unreasonably high, or unreasonably low?
>
> I think it's a bit too high, causing the amount of usable inodes
> to be a bit too low.

So out of curiosity, what are you storing on the filesystem such that
you're worried about running out of inodes? The assumption was that
on most filesystems the average file size would indeed be bigger than
4k these days, although obviously things will vary depending on what
you plan to store. Even if you're using maildir stores, or squid
caches, it seemed like 16k was a good default.

> >> does not mention this 16384 default.
> >> Hope this can be addressed.
> >
> >You could send a patch :)

The problem is the default isn't as simple as 16384. See the
description under the -T option:

-T usage-type[,...]
Specify how the filesystem is going to be used, so that mke2fs
can choose optimal filesystem parameters for that use. The
usage types that are supported are defined in the configuration
file /etc/mke2fs.conf(5). The user may specify one or more
usage types using a comma separated list.

If this option is is not specified, mke2fs will pick a single
default usage type based on the size of the filesystem to be
created. If the filesystem size is less than or equal to 3
megabytes, mke2fs will use the filesystem type floppy. If the
filesystem size is greater than 3 but less than or equal to 512
megabytes, mke2fs(8) will use the filesystem small. Otherwise,
mke2fs(8) will use the default filesystem type default.


So for example, if you say "-T news" the default mke2fs.conf file will
cause the default inode ratio to be 4096. (As I said, that's probably
not right, since the average size for Usenet spools is probably way
over 8k these days; the fact that -T news uses a default inode ratio
of 4096 is historic, and dates back to before p0rn sites dropped huge
numbers of uuencoded image files in the alt.* hierarchy. :-)

As another example, if the file is smaller that 512 megabytes, the
"small" type will be used, and that causes the default inode ratio to
be 4096, the inode size to be 128, and the block size to be 1024.

- Ted

2009-03-04 03:11:30

by Jan Engelhardt

[permalink] [raw]
Subject: Re: mkfs.ext4: high default -i value undocumented


On Wednesday 2009-03-04 03:49, Theodore Tso wrote:
>On Wed, Mar 04, 2009 at 01:36:44AM +0100, Jan Engelhardt wrote:
>> >>
>> >> Creating an ext4 filesystem on a 4 GB image file (to be loop-mounted
>> >> later) gives me 256K inodes. Choosing -i 4096 instead gives 1M, which
>> >> would mean the default for -i is 16384.
>> >
>> >Which part of a 16384-data-bytes-to-inode-count ratio do you find
>> >unreasonable? Do you find it unreasonably high, or unreasonably low?
>>
>> I think it's a bit too high, causing the amount of usable inodes
>> to be a bit too low.
>
>So out of curiosity, what are you storing on the filesystem such that
>you're worried about running out of inodes? The assumption was that
>on most filesystems the average file size would indeed be bigger than
>4k these days, although obviously things will vary depending on what
>you plan to store. Even if you're using maildir stores, or squid
>caches, it seemed like 16k was a good default.

The source and module_prepare'd obj dirs for the trees
2.6.{17.14,18.8,19.7,20.21,21.7,22.19,23.17,24.7,25.20,26.8,27.8,28}.

Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/loop0 xfs 4184064 3676644 507420 88% /lo/kernel

Filesystem Type Inodes IUsed IFree IUse% Mounted on
/dev/loop0 xfs 2343280 313466 2029814 14% /lo/kernel

2009-03-09 14:17:28

by Goswin von Brederlow

[permalink] [raw]
Subject: Re: mkfs.ext4: high default -i value undocumented

Eric Sandeen <[email protected]> writes:

> Jan Engelhardt wrote:
>> Hi,
>>
>>
>> Creating an ext4 filesystem on a 4 GB image file (to be loop-mounted
>> later) gives me 256K inodes. Choosing -i 4096 instead gives 1M, which
>> would mean the default for -i is 16384.
>
> That's right, look in /etc/mke2fs.conf:
>
> [defaults]
> base_features =
> sparse_super,filetype,resize_inode,dir_index,ext_attr
> blocksize = 4096
> inode_size = 256
> inode_ratio = 16384
>
>> Besides me finding 16384 a
>> little unreasonable (XFS offers 2M inodes by default),
>
> XFS is a totally different beast, because it dynamically allocates
> inodes. It doesn't really offer *anything* by default.
>
> Which part of a 16384-data-bytes-to-inode-count ratio do you find
> unreasonable? Do you find it unreasonably high, or unreasonably low?

Too high for 4G, to low for 6 TiB.

MfG
Goswin

2009-03-09 15:56:37

by Eric Sandeen

[permalink] [raw]
Subject: Re: mkfs.ext4: high default -i value undocumented

Goswin von Brederlow wrote:
> Eric Sandeen <[email protected]> writes:
>
>> Jan Engelhardt wrote:
>>> Hi,
>>>
>>>
>>> Creating an ext4 filesystem on a 4 GB image file (to be loop-mounted
>>> later) gives me 256K inodes. Choosing -i 4096 instead gives 1M, which
>>> would mean the default for -i is 16384.
>> That's right, look in /etc/mke2fs.conf:
>>
>> [defaults]
>> base_features =
>> sparse_super,filetype,resize_inode,dir_index,ext_attr
>> blocksize = 4096
>> inode_size = 256
>> inode_ratio = 16384
>>
>>> Besides me finding 16384 a
>>> little unreasonable (XFS offers 2M inodes by default),
>> XFS is a totally different beast, because it dynamically allocates
>> inodes. It doesn't really offer *anything* by default.
>>
>> Which part of a 16384-data-bytes-to-inode-count ratio do you find
>> unreasonable? Do you find it unreasonably high, or unreasonably low?
>
> Too high for 4G, to low for 6 TiB.

I think it's hard to make a blanket statement like that; it depends very
much on the average size of the files on the fs.

The only thing that makes it too high or too low is whether the average
file size is significantly different than 16k, really (with the caveat
that we should bias towards overprovisioning vs. underprovisioning, by
default)

-Eric

> MfG
> Goswin