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, 6, 7, 8, and 9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content