Linux Internals

Linux Directories,
Inodes & LVM

What's in /bin vs /sbin? What is /etc? What's an inode? And how does Linux expand disk space without shutting down? All explained.

Sections

6

Read time

20 min

Level

Beginner

/bin and /sbin

/bin

User Binaries

Everyone can use these

  • /bin/ls → list files
  • /bin/cp → copy files
  • /bin/mv → move files
  • /bin/cat → read files
  • /bin/rm → delete files
/sbin

System Binaries

Admin / root only

  • /sbin/reboot → restart system
  • /sbin/fsck → check filesystem
  • /sbin/ip → network config
  • /sbin/useradd → create users
  • /sbin/iptables → firewall rules
💡
Think of it this way...
/bin = steering wheel, pedals — basic controls everyone uses
/sbin = mechanic's tools — for admin work under the hood
/etc = car settings and configuration
/var = dashboard logs and usage data
💡

Key Takeaway

When you type ls, Linux actually runs /bin/ls. When you sudo reboot, it runs /sbin/reboot. $PATH connects the short command name to the full path.

/etc — The Settings Folder

/etc stores configuration files for the entire system and installed programs. Think of it as the "settings folder" of Linux.

These files are mostly plain text — you can open, read, and edit them with a text editor. When you change a setting (SSH port, DNS server, user account), it happens in /etc.

👤
/etc/passwd

All user accounts on the system

🔑
/etc/ssh/sshd_config

SSH server settings — ports, auth methods

🌐
/etc/resolv.conf

Which DNS servers to use

📋
/etc/hosts

Local DNS overrides — map hostnames to IPs

/etc/crontab

System-wide scheduled tasks

💾
/etc/fstab

Which disks to mount at boot and where

🤯

Did You Know?

The name “etc” originally stood for “etcetera” — it was the catch-all folder for everything that didn't fit elsewhere. Now it's specifically for configuration files by convention.

/etc in Practice

/etc/passwd — User Accounts

Every user on the system has an entry in this file. Run cat /etc/passwd to see it:

charith:x:1000:1000:Charith:/home/charith:/bin/bash

charithusername
xpassword (stored elsewhere)
1000user ID (UID)
1000group ID (GID)
Charithdisplay name
/home/charithhome directory
/bin/bashdefault shell

/etc/ssh/sshd_config — SSH Server Config

Terminal
▶️

Click the Play button above to start!

Watch the commands execute step by step

/etc/resolv.conf — DNS Servers

Terminal
▶️

Click the Play button above to start!

Watch the commands execute step by step

💡

Key Takeaway

Almost every program you install on Linux has its config in /etc. Learning to read and edit these files is a core sysadmin skill.

Inodes — A File's Identity Card

Every file on Linux has two things stored on disk: the actual data (the content) and an inode (the identity card).

INODE — Metadata (identity card)

  • ✅ File size
  • ✅ Owner (charith)
  • ✅ Permissions (rw-r--r--)
  • ✅ Created / Modified / Accessed timestamps
  • ✅ WHERE on disk the data is stored
  • ❌ The filename (NOT here!)

DIRECTORY — Name lookup

"notes.txt" → inode #4521

"backup.sh" → inode #4522

"config.yml" → inode #4523

The directory maps name → inode number. The inode holds everything else.

💡
Think of it this way...
Patient file folder = inode (name, age, blood type, room number — metadata ABOUT the patient)
The actual patient = the file's data (the real content)
Hospital reception = directory ("John Smith is in room 204" — maps name to location)

See it yourself

Terminal
▶️

Click the Play button above to start!

Watch the commands execute step by step

🤯

Did You Know?

This is why hard links work — two filenames in different directories can point to the same inode number. Both "names" are the same file. Delete one name, the inode (and data) still exists until all names are removed.

LVM — Flexible Storage

LVM (Logical Volume Manager) solves one of the most painful problems in Linux administration: running out of disk space on a live server.

The Problem with Normal Partitions

YOUR HARD DISK (60GB) — fixed partitions:

┌─────────────┬────────────────┬────────┐

│ /boot (2GB)│ / Linux (30GB)│ ??? │

└─────────────┴────────────────┴────────┘

If / fills up → shut down → hours of work → data risk 😱

What LVM Does — The Pool System

WITH LVM — flexible pool:

┌─────────────────────────────────────┐

│ POOL OF STORAGE (60GB) │

│ ┌──────────────┐ ┌─────────────┐ │

│ │ Bucket A │ │ Bucket B │ │

│ │ / (Linux) │ │ /backups │ │

│ │ 30GB │ │ 10GB │ │

│ └──────────────┘ └─────────────┘ │

│ ~20GB FREE │

└─────────────────────────────────────┘

Bucket A getting full? Two commands, 10 seconds. ✓

The 3 LVM Terms

PV

Physical Volume

Your actual hard disk. The water source.

VG

Volume Group

The combined pool of storage. All disks merged together.

LV

Logical Volume

A bucket carved from the pool. What Linux mounts and uses.

Hard Disk (PV) → Pool (VG) → Buckets (LV)

LVM Commands

On your Ubuntu VM, half the disk is sitting unused in the LVM pool — ready whenever you need more space. Here's how to check and use it:

Terminal
▶️

Click the Play button above to start!

Watch the commands execute step by step

Expanding your disk — 2 commands, zero downtime

Terminal
▶️

Click the Play button above to start!

Watch the commands execute step by step

💡

Key Takeaway

Every production Linux server uses LVM. When you're working as a DevOps or sysadmin engineer, you will use these commands. This is why they matter.

Key Concepts Flashcards

Click any card to flip and reveal the definition.

What is /bin?

Essential commands for all users: ls, cp, mv, cat. Required for basic system operation. Even if nothing else is mounted, /bin must be available.

What is /sbin?

System administration tools, mostly for root: reboot, fsck (filesystem check), ip (network config). The 's' stands for system.

What is /etc?

The 'settings folder' of Linux. Configuration files for the system and all installed programs. Most files are plain text — administrators edit them directly.

What is /etc/passwd?

Stores basic info about all user accounts: username, user ID, group ID, home directory, default shell. View with: cat /etc/passwd

What is an inode?

A file's identity card. Stores size, owner, permissions, timestamps, and where on disk the data is stored. Does NOT store the filename — that's in the directory.

What is LVM?

Logical Volume Manager. Replaces fixed partitions with a flexible pool system. Hard Disk (PV) → Pool (VG) → Buckets (LV). Expand volumes in seconds with zero downtime.

How do you expand a Linux filesystem with LVM?

Two commands: 1) sudo lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv (make bucket bigger) 2) sudo resize2fs /dev/ubuntu-vg/ubuntu-lv (tell filesystem to fill the space)