31

I am downloading a file with rtorrent,

When I check the folder that the file is located on, the filesize with ls command is 4.4GB but when I check the disk with du command it shows me 219MB, also the same problem with df command that seems just calculate the 219MB one.


Here is the my console result

root@SERVER:/home/.root/TMP/tnt/d1/xxx# dir -alh

total 219M
drwxr-xr-x  2 root root 4.0K 2010-01-10 15:30 .
drwxr-xr-x 15 root root 4.0K 2010-01-10 15:30 ..
-rw-r--r--  1 root root 4.4G 2010-01-11 10:55 yyy.mkv

root@SERVER:/home/.root/TMP/tnt/d1/xxx# du -h

219M    .

root@SERVER:/home/.root/TMP/tnt/d1/xxx# 
1
  • I ran across this same problem today after growing a disk image using qemu-img resize.
    – Pete
    Jul 30, 2014 at 14:35

1 Answer 1

49

It's a sparse file. ls is reporting the allocated size; du is reporting the amount of space actually used.

As your torrent client downloads more it will fill in the gaps and the du-reported size will grow to match what ls reports.

To force du and df to include sparces, from the man du the second option listed is --apparent-size:

du -s -B1 --apparent-size
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .