<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:38:16 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-3943] incorrect inode count in lfs df -i</title>
                <link>https://jira.whamcloud.com/browse/LU-3943</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;SFU recently reformatted their MDT to have more inodes, using -i. We did a file-level backup and restore. Everything looks good except client-side df and lfs df are both reporting the old inode count:&lt;/p&gt;

&lt;p&gt;client1# lfs df -i&lt;br/&gt;
UUID                      Inodes       IUsed       IFree IUse% Mounted on&lt;br/&gt;
lfs_scra-MDT0000_UUID   121693414    98842604    22850810  81% /global/scratch&lt;span class=&quot;error&quot;&gt;&amp;#91;MDT:0&amp;#93;&lt;/span&gt;&lt;br/&gt;
lfs_scra-OST0000_UUID   119472128    21603481    97868647  18% /global/scratch&lt;span class=&quot;error&quot;&gt;&amp;#91;OST:0&amp;#93;&lt;/span&gt;&lt;br/&gt;
...&lt;/p&gt;

&lt;p&gt;mds# df -i /dev/vg_lfs_scra/mdt&lt;br/&gt;
Filesystem            Inodes   IUsed   IFree IUse% Mounted on&lt;br/&gt;
/dev/vg_lfs_scra/mdt 251658240 98842604 152815636   40% /lustre/lfs_scra/mdt&lt;/p&gt;

&lt;p&gt;mds# dumpe2fs -h /dev/vg_lfs_scra/mdt&lt;br/&gt;
...&lt;br/&gt;
Inode count:              251658240&lt;br/&gt;
Block count:              62914560&lt;br/&gt;
Reserved block count:     3145728&lt;br/&gt;
Free blocks:              22850811&lt;br/&gt;
Free inodes:              152815677&lt;br/&gt;
...&lt;/p&gt;

&lt;p&gt;I&apos;m pretty puzzled by this. Is there something I&apos;m doing wrong? Any other information I can get you?&lt;/p&gt;</description>
                <environment></environment>
        <key id="20939">LU-3943</key>
            <summary>incorrect inode count in lfs df -i</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="6">Not a Bug</resolution>
                                        <assignee username="yujian">Jian Yu</assignee>
                                    <reporter username="kitwestneat">Kit Westneat</reporter>
                        <labels>
                    </labels>
                <created>Thu, 12 Sep 2013 21:31:33 +0000</created>
                <updated>Mon, 2 Jun 2014 16:57:00 +0000</updated>
                            <resolved>Fri, 27 Sep 2013 20:46:45 +0000</resolved>
                                    <version>Lustre 1.8.7</version>
                                    <fixVersion>Lustre 2.6.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="66660" author="pjones" created="Fri, 13 Sep 2013 22:31:47 +0000"  >&lt;p&gt;Yu, Jian&lt;/p&gt;

&lt;p&gt;Could you please advise on this one?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="67293" author="kitwestneat" created="Mon, 23 Sep 2013 20:25:20 +0000"  >&lt;p&gt;Any updates?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Kit&lt;/p&gt;</comment>
                            <comment id="67344" author="yujian" created="Tue, 24 Sep 2013 13:25:32 +0000"  >&lt;p&gt;Hi Kit,&lt;/p&gt;

&lt;p&gt;Am I correct that you changed the value of bytes-per-inode from 2048 to 1024 for the MDT?&lt;/p&gt;</comment>
                            <comment id="67376" author="yujian" created="Tue, 24 Sep 2013 15:48:40 +0000"  >&lt;p&gt;I just did an experiment on Lustre 1.8.7-wc1 and got the following results:&lt;/p&gt;

&lt;p&gt;Format the filesystem with &lt;b&gt;&quot;-i 2048&quot;&lt;/b&gt; by default for MDT:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[root@fat-amd-2 ~]# mkfs.lustre --mgs --mdt --fsname=lustre --device-size=240000000 --reformat /dev/sdc5
...
mkfs_cmd = mke2fs -j -b 4096 -L lustre-MDTffff  -J size=400 -I 512 -i 2048 -q -O uninit_bg,dir_nlink,huge_file,flex_bg -E lazy_journal_init -F /dev/sdc5 60000000
Writing CONFIGS/mountdata

[root@fat-amd-2 ~]# mkfs.lustre --ost --fsname=lustre --mgsnode=fat-amd-2@tcp --device-size=240000000 --reformat /dev/sdc6
...
mkfs_cmd = mke2fs -j -b 4096 -L lustre-OSTffff  -J size=400 -I 256 -i 69905 -q -O extents,uninit_bg,dir_nlink,huge_file,flex_bg -G 256 -E resize=4290772992,lazy_journal_init -F /dev/sdc6 60000000
Writing CONFIGS/mountdata

[root@fat-amd-2 ~]# mkdir -p /mnt/mds; mount -t lustre -o user_xattr /dev/sdc5 /mnt/mds
[root@fat-amd-2 ~]# mkdir -p /mnt/ost1; mount -t lustre /dev/sdc6 /mnt/ost1
[root@fat-amd-2 ~]# mount -t lustre -o user_xattr,flock fat-amd-2@tcp:/lustre /mnt/lustre

[root@fat-amd-2 ~]# lfs df /mnt/lustre
UUID                   1K-blocks        Used   Available Use% Mounted on
lustre-MDT0000_UUID    179966864      483840   167483384   0% /mnt/lustre[MDT:0]
lustre-OST0000_UUID    239105024      470300   226634660   0% /mnt/lustre[OST:0]

filesystem summary:    239105024      470300   226634660   0% /mnt/lustre

[root@fat-amd-2 ~]# df /mnt/lustre
Filesystem           1K-blocks      Used Available Use% Mounted on
fat-amd-2@tcp:/lustre
                     239105024    470300 226634660   1% /mnt/lustre

[root@fat-amd-2 ~]# df /mnt/mds
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdc5            179966864    483840 167483384   1% /mnt/mds

[root@fat-amd-2 ~]# lfs df -i /mnt/lustre
UUID                      Inodes       IUsed       IFree IUse% Mounted on
lustre-MDT0000_UUID    120003328          25   120003303   0% /mnt/lustre[MDT:0]
lustre-OST0000_UUID      3517440          56     3517384   0% /mnt/lustre[OST:0]

filesystem summary:    120003328          25   120003303   0% /mnt/lustre

[root@fat-amd-2 ~]# df -i /mnt/lustre
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
fat-amd-2@tcp:/lustre
                     3517409      25 3517384    1% /mnt/lustre

[root@fat-amd-2 ~]# df -i /mnt/mds
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sdc5            120003328      25 120003303    1% /mnt/mds
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Unmount and reformat the filesystem with &lt;b&gt;&quot;-i 1024&quot;&lt;/b&gt; for MDT:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[root@fat-amd-2 ~]# mkfs.lustre --mgs --mdt --fsname=lustre --mkfsoptions=&quot;-i 1024&quot; --device-size=240000000 --reformat /dev/sdc5
...
mkfs_cmd = mke2fs -j -b 4096 -L lustre-MDTffff -i 1024 -J size=400 -I 512 -q -O uninit_bg,dir_nlink,huge_file,flex_bg -E lazy_journal_init -F /dev/sdc5 60000000
Writing CONFIGS/mountdata

[root@fat-amd-2 ~]# mkfs.lustre --ost --fsname=lustre --mgsnode=fat-amd-2@tcp --device-size=240000000 --reformat /dev/sdc6
...
mkfs_cmd = mke2fs -j -b 4096 -L lustre-OSTffff  -J size=400 -I 256 -i 69905 -q -O extents,uninit_bg,dir_nlink,huge_file,flex_bg -G 256 -E resize=4290772992,lazy_journal_init -F /dev/sdc6 60000000
Writing CONFIGS/mountdata

[root@fat-amd-2 ~]# mkdir -p /mnt/mds; mount -t lustre -o user_xattr /dev/sdc5 /mnt/mds
[root@fat-amd-2 ~]# mkdir -p /mnt/ost1; mount -t lustre /dev/sdc6 /mnt/ost1
[root@fat-amd-2 ~]# mount -t lustre -o user_xattr,flock fat-amd-2@tcp:/lustre /mnt/lustre

[root@fat-amd-2 ~]# lfs df /mnt/lustre
UUID                   1K-blocks        Used   Available Use% Mounted on
lustre-MDT0000_UUID    119901352      487936   107414036   0% /mnt/lustre[MDT:0]
lustre-OST0000_UUID    239105024      470300   226634660   0% /mnt/lustre[OST:0]

filesystem summary:    239105024      470300   226634660   0% /mnt/lustre

[root@fat-amd-2 ~]# df /mnt/lustre
Filesystem           1K-blocks      Used Available Use% Mounted on
fat-amd-2@tcp:/lustre
                     239105024    470300 226634660   1% /mnt/lustre

[root@fat-amd-2 ~]# df /mnt/mds
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdc5            119901352    487936 107414036   1% /mnt/mds

[root@fat-amd-2 ~]# lfs df -i /mnt/lustre
UUID                      Inodes       IUsed       IFree IUse% Mounted on
lustre-MDT0000_UUID    240046264          25   240046239   0% /mnt/lustre[MDT:0]
lustre-OST0000_UUID      3517440          56     3517384   0% /mnt/lustre[OST:0]

filesystem summary:    240046264          25   240046239   0% /mnt/lustre

[root@fat-amd-2 ~]# df -i /mnt/lustre
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
fat-amd-2@tcp:/lustre
                     3517409      25 3517384    1% /mnt/lustre

[root@fat-amd-2 ~]# df -i /mnt/mds
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sdc5            240046264      25 240046239    1% /mnt/mds
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The inode count was increased from 120003328 to 240046264 properly.&lt;/p&gt;</comment>
                            <comment id="67377" author="kitwestneat" created="Tue, 24 Sep 2013 15:54:00 +0000"  >&lt;p&gt;Yes, bytes per inode was changed and then the contents of the old MDT was copied to the new MDT. Is the inode count stored somewhere on the MDT?&lt;/p&gt;</comment>
                            <comment id="67505" author="adilger" created="Wed, 25 Sep 2013 04:13:50 +0000"  >&lt;p&gt;The inode count isn&apos;t stored explicitly by Lustre anywhere (of course it is in the superblock of the underlying filesystem).&lt;/p&gt;

&lt;p&gt;I suspect the problem you are seeing is that &quot;lfs df -i&quot; and &quot;df -i&quot; are showing the worst case for the number of files that can be created in the filesystem.  In 1.8.7 there are several limits put on the statfs() value returned to the client to ensure that the reported number of free files can actually be created.  The free inode count is limited by:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;the total number of OST objects divided by the default stripe count, since it isn&apos;t practical to create more files in the filesystem than there are objects on the OSTs.&lt;/li&gt;
	&lt;li&gt;Until 1.8.7 the server limited the inode count by the number of free blocks on the MDT or OST, in case each MDT inode created needs an external xattr block (for a large LOV EA, user xattrs, ACLs, etc), and obviously each OST object should be able to store at least one data block.  In most cases, there are no external xattr blocks, and the MDT limit is meaningless, and OST files have more than a single block, so this was removed from the Lustre 2.x MDT code.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;/*
 * We need to hack the &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; value &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; the free inode counts because
 * the current EA code requires one filesystem block per inode with EAs,
 * so it is possible to run out of blocks before we run out of inodes.
 *
 * This can be removed when the ext3 EA code is fixed.
 */
&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; fsfilt_ext3_statfs(struct super_block *sb, struct obd_statfs *osfs)
{
        struct kstatfs sfs;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; rc;

        memset(&amp;amp;sfs, 0, sizeof(sfs));
        rc = ll_do_statfs(sb,&amp;amp;sfs);

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!rc &amp;amp;&amp;amp; sfs.f_bfree &amp;lt; sfs.f_ffree) {
                sfs.f_files = (sfs.f_files - sfs.f_ffree) + sfs.f_bfree;
                sfs.f_ffree = sfs.f_bfree;
        }

        statfs_pack(osfs, &amp;amp;sfs);
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; rc;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This was removed in 1.8.7 because it caused more confusion than necessary.  I believe that you must be running an older MDS server version that still has this code, because your free inode count exactly matches the free blocks count.&lt;/p&gt;

&lt;p&gt;If MDT inodes are created that do not consume OST objects (e.g. directories, internal log files, files explicitly striped with fewer than the default number of objects) or they do not consume extra MDT data blocks (e.g. most files excluding directories) then the number of &lt;em&gt;free&lt;/em&gt; inodes in the filesystem will not decrease, and instead the &lt;em&gt;total&lt;/em&gt; number of inodes will appear to &lt;em&gt;increase&lt;/em&gt;.  This was done because typically users of &quot;df&quot; or statfs() care about the free and used space and not the total space.&lt;/p&gt;

&lt;p&gt;See the comment in ll_statfs_internal():&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;        /* If we don&apos;t have as many objects free on the OST as inodes
         * on the MDS, we reduce the total number of inodes to
         * compensate, so that the &lt;span class=&quot;code-quote&quot;&gt;&quot;inodes in use&quot;&lt;/span&gt; number is correct.
         */
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (obd_osfs.os_ffree &amp;lt; osfs-&amp;gt;os_ffree) {
                osfs-&amp;gt;os_files = (osfs-&amp;gt;os_files - osfs-&amp;gt;os_ffree) +
                        obd_osfs.os_ffree;
                osfs-&amp;gt;os_ffree = obd_osfs.os_ffree;
        }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If more OSTs are added, or if the default stripe count is reduced (if not 1) then the number of files that can be created in the filesystem will appear to increase.  It is usually desirable for the MDT to be over-provisioned with inodes so that it will not run out before the OSTs run out of space.&lt;/p&gt;</comment>
                            <comment id="67878" author="kitwestneat" created="Fri, 27 Sep 2013 20:32:42 +0000"  >&lt;p&gt;Ah you&apos;re right, they are actually running 1.8.6, my fault. Thanks for the explanation, I think this can be closed.&lt;/p&gt;</comment>
                            <comment id="67883" author="pjones" created="Fri, 27 Sep 2013 20:46:45 +0000"  >&lt;p&gt;ok thanks Kit!&lt;/p&gt;</comment>
                            <comment id="73735" author="adilger" created="Wed, 18 Dec 2013 07:49:20 +0000"  >&lt;p&gt;I found a patch on one of my systems to fix the &quot;lfs df -i&quot; inode summary to match &quot;df -i&quot; if the OST free objects count is less than the MDT free inode count:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://review.whamcloud.com/8614&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/8614&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzw25z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>10432</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>