Explain Why du and df Report Different Disk Usage

Last updated: August 16, 2026

Quick Overview

Explain the differences between the 'du' and 'df' commands in Linux and why they report different disk usage figures.

Hudson River Trading
Software Engineering Fundamentals
Site Reliability Engineer
Hudson River Trading
August 16, 2026
Site Reliability Engineer
Technical Screen
Software Engineering Fundamentals
Medium

2

0

34 solved


Explain the differences between the 'du' and 'df' commands in Linux and why they report different disk usage figures.

This question is typically asked during the technical screening round for Site Reliability Engineer candidates at Hudson River Trading. The interviewer is evaluating the candidate's understanding of Linux command-line tools, their ability to troubleshoot disk usage discrepancies, and their knowledge of file system behavior. A solid grasp of these concepts is essential for maintaining system reliability and performance.

What the Interviewer Expects
  • Clearly explain the purpose of 'du' and 'df' commands.
  • Discuss how 'du' measures disk usage versus how 'df' reports available space.
  • Identify scenarios where the reported values may differ.
  • Provide insights into filesystem structures and how they affect reported usage.
  • Mention potential troubleshooting steps for discrepancies.
Key Topics to Cover
Linux Commands
Disk Usage
File System
Troubleshooting
System Reliability
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • Can you explain the significance of inodes in disk usage?
  • What are some common file system types in Linux?
  • How would you troubleshoot a disk space issue on a server?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Understanding 'du' and 'df'

The du (disk usage) command is used to estimate file space usage on a directory and its subdirectories, while the df (disk free) command reports the amount of disk space used and available on file...

Why They Report Differently

The discrepancy in reported values between du and df can arise from several factors. For example, du counts the actual disk blocks used by files, including those in directories, while df repor...


Submit Your Answer
Markdown supported

Related Questions