What is a "sparse file", and can they be identified?

Solution Verified - Updated -

Issue

  • The file size is inconsistent between ls and df for a file.

  • This file reports a large size (128Gb) but the filesystem isn't even that big. How is this possible?

# ls -lah datafile
-rw------- 1 root root  137438953440 May 28 10:05 datafile

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda               20G  9.8G  9.0G  53% /

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.