<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Priyanka Singh on Medium]]></title>
        <description><![CDATA[Stories by Priyanka Singh on Medium]]></description>
        <link>https://medium.com/@priyanka_singh_?source=rss-c9af7cd36ede------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*200JflCGzqNpskbILD2Flw.jpeg</url>
            <title>Stories by Priyanka Singh on Medium</title>
            <link>https://medium.com/@priyanka_singh_?source=rss-c9af7cd36ede------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 12:38:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@priyanka_singh_/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Inodes in a Nutshell: What Every Engineer Should Know]]></title>
            <link>https://medium.com/@priyanka_singh_/inodes-in-a-nutshell-what-every-engineer-should-know-b18c2ab88308?source=rss-c9af7cd36ede------2</link>
            <guid isPermaLink="false">https://medium.com/p/b18c2ab88308</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops-interview-question]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[devops-interview]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Priyanka Singh]]></dc:creator>
            <pubDate>Wed, 10 Sep 2025 11:56:51 GMT</pubDate>
            <atom:updated>2025-09-10T11:56:51.873Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve been preparing for Linux or DevOps interviews, chances are you’ve already come across questions like:</p><ul><li><em>“What is an inode?”</em></li><li><em>“What information does an inode store?”</em></li><li><em>“What happens if your system runs out of inodes?”</em></li></ul><p>Inodes often come up in interviews because they sit at the very core of how Linux/Unix filesystems work. Let’s break it down in a way that prepares you both for theory and real-world troubleshooting.</p><h3>🔹 What is an Inode?</h3><p>An <strong>inode (index node)</strong> is a data structure in Unix-like filesystems that stores <strong>metadata</strong> about a file or directory. Every file has exactly one inode, identified by an <strong>inode number</strong> unique within a filesystem.</p><p>👉 Think of the filesystem like a library:</p><ul><li>The <strong>bookshelves</strong> are the data blocks (actual file contents).</li><li>The <strong>catalog entries</strong> are the inodes (metadata about each book).</li><li>The <strong>book titles</strong> are filenames (stored in directories and mapped to inode numbers).</li></ul><h3>🔹 What Does an Inode Contain?</h3><p>An inode stores everything <em>about</em> a file <strong>except its name</strong>. This typically includes:</p><ul><li>File type (regular file, directory, symlink, device, etc.)</li><li>Ownership (UID, GID)</li><li>Permissions (rwx)</li><li>File size</li><li>Timestamps:</li><li><strong>atime</strong> — Last access</li><li><strong>mtime</strong> — Last content modification</li><li><strong>ctime</strong> — Last metadata change</li><li>Number of hard links</li><li>Pointers to data blocks</li><li><strong>Direct pointers</strong> (point directly to file data)</li><li><strong>Indirect pointers</strong> (single, double, triple) → allow very large files</li></ul><p>Filename → inode number mapping is stored in <strong>directories</strong>, not in the inode.</p><h3>🔹 How Filesystem Uses Inodes (Step by Step)</h3><p>When you access a file /home/user/file.txt:</p><ol><li>Kernel looks up the directory /home/user/.</li><li>Finds file.txt entry → retrieves its <strong>inode number</strong>.</li><li>Reads the inode structure → gets metadata + block pointers.</li><li>Fetches file content from data blocks.</li></ol><p>This separation of <strong>name vs metadata vs data</strong> is why features like hard links are possible.</p><h3>📌 Important Inode Commands</h3><p>For the examples below, assume we have a file file.txt.</p><p>1. ls -i → Show Inode Number</p><pre>$ ls -i file.txt<br>131072 file.txt</pre><ul><li><strong>131072</strong> → inode number of file.txt.</li><li>Useful to identify files uniquely inside a filesystem.</li><li>If two filenames have the same inode number → they are <strong>hard links</strong> to the same file.</li></ul><p>2. stat → Detailed Inode Metadata</p><pre>$ stat file.txt<br>  File: file.txt<br>  Size: 1024       Blocks: 8          IO Block: 4096   regular file<br>Device: 803h/2051d Inode: 131072      Links: 1<br>Access: (0644/-rw-r--r--)  Uid: ( 1000/ user)   Gid: ( 1000/ user)<br>Access: 2025-09-10 10:22:33.000000000 +0530<br>Modify: 2025-09-10 10:20:10.000000000 +0530<br>Change: 2025-09-10 10:21:45.000000000 +0530<br> Birth: -</pre><p>🔎 <strong>Important fields:</strong></p><ul><li><strong>Inode:</strong> 131072 → inode number.</li><li><strong>Links:</strong> 1 → number of hard links.</li><li><strong>Access / Modify / Change:</strong></li><li>Access (atime) → last read.</li><li>Modify (mtime) → content change.</li><li>Change (ctime) → inode metadata change.</li><li><strong>Permissions / UID / GID</strong> → ownership and access control.</li></ul><p>3. df -i → Filesystem Inode Usage</p><pre>$ df -i<br>Filesystem      Inodes  IUsed   IFree IUse% Mounted on<br>/dev/sda1     65536000 152000 65384000    1% /</pre><p>🔎 <strong>Important fields:</strong></p><ul><li><strong>Inodes</strong> → total inodes in the filesystem.</li><li><strong>IUsed</strong> → number of inodes consumed (files + dirs).</li><li><strong>IFree</strong> → available inodes.</li><li><strong>IUse%</strong> → inode usage percentage.</li></ul><p>👉 Even if df -h shows free space, if IUse% is 100% → you <strong>cannot create new files</strong>.</p><p>4. ls -li → Inode + Detailed Listing</p><pre>$ ls -li<br>131072 -rw-r--r-- 1 user user 1024 Sep 10 10:20 file.txt</pre><ul><li>Combines ls -l and inode number.</li><li>Helps confirm inode number along with permissions, owner, size.</li><li>Useful when checking <strong>hard links</strong>.</li></ul><p>5. find → Search by Inode</p><pre>$ find . -inum 131072<br>./file.txt</pre><ul><li>Finds a file by inode number.</li><li>Useful when a filename has <strong>corrupted characters</strong> or is hard to type.</li></ul><p>6. lsattr → Show File Attributes (Uses Inode Info)</p><pre>$ lsattr file.txt<br>----i--------e-- file.txt</pre><ul><li>Shows attributes like i (immutable), a (append-only).</li><li>These are stored in inode-level flags (ext file systems).</li><li>Example:</li><li>If i is set, file cannot be deleted/modified until attribute is removed.</li><li>Change attributes: chattr +i file.txt.</li></ul><p>7. debugfs → Low-Level Inode Info (ext Filesystems)</p><pre>$ sudo debugfs /dev/sda1<br>debugfs:  stat &lt;131072&gt;<br>Inode: 131072   Type: regular   Size: 1024<br>Links: 1   Blockcount: 8<br>Fragment:  Address: 0<br>Direct blocks: 101 102 103</pre><ul><li>debugfs lets you inspect raw inode details.</li><li>Shows <strong>direct/indirect block mapping</strong>, inode flags, etc.</li><li>Used for recovery/troubleshooting at low level.</li></ul><p>8. ls -ld on a Directory → Directory Inode</p><pre>$ ls -ld /home/user<br>131073 drwxr-xr-x 2 user user 4096 Sep 10 10:25 /home/user</pre><ul><li>Directories have <strong>inodes too</strong>.</li><li>They store mapping of filenames → inode numbers.</li></ul><p>9. df -ih → Inodes in Human Readable Form</p><pre>$ df -ih<br>Filesystem     Inodes IUsed IFree IUse% Mounted on<br>/dev/sda1        64M  152K   63M    1% /</pre><ul><li>-h flag makes inode counts human-readable (K/M/G).</li></ul><h3>📌 Interview Tips on Outputs</h3><ul><li><strong>If inode usage (IUse%) = 100%</strong> → can’t create new files, even if space is free.</li><li><strong>stat output</strong> is often asked: the difference between atime, mtime, and ctime. <strong>(It was asked in a FAANG company)</strong></li><li><strong>Hard vs Soft links</strong> → check inode numbers:</li><li><em>Hard links → same inode number.</em></li><li><em>Soft links → different inode number.</em></li><li><strong>debugfs</strong> → advanced tool; good to mention in interviews.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b18c2ab88308" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>