2

In home/{user}, I have a file called ntfs.txt whose total size of files is 83,3GB and whose size on disk is 0B. Its owned and group are both root. The last time it was accessed is the 24/07/2012. ls -l /home/romain/ntfs.txt outputs -rw------- 1 root root 83346727424 janv. 15 2012 /home/{user}/ntfs.txt and du /home/romain/ntfs.txt gives 0 /home/{user}/ntfs.txt. Previously, I had a Wubi install which I moved to a separated partition later. I also just got rid of Windows, but the file is still here. What's with its strange size? Can I delete it?

4
  • Could you open a terminal and edit the question with the output of ls -l /home/{user}/nfts.txt and du /home/{user}/ntfs.txt ? Jul 24, 2012 at 5:05
  • I added their output.
    – L01man
    Jul 24, 2012 at 5:19
  • So according to du there's nothing in the file at all. If there's nothing there it should be safe to delete but please wait for a second opinion on that in case I am wrong. I found this question: superuser.com/a/94220/133718 which discusses why ls and du can give differing values. Jul 24, 2012 at 5:34
  • Thanks for your help. If no one else answers I'll just move the file and see what happends. I don't think it can harm the system.
    – L01man
    Jul 24, 2012 at 8:17

1 Answer 1

2

It's probably a sparse file

The most common case where du and ls return wildly different sizes is for sparse files, which are often created by download accelerators or bittorrent clients. ls gives you the size allocated (which the application will gradually fill up), while du gives you the actual size used.

If the actual size is 0, then there really is no data in it and it's safe to move or delete it (not that it would save you any disk space, since it's using none).

Experiment yourself with sparse files:

You can duplicate this weird scenario easily enough, with a 1-gigabyte file that takes ZERO space:

$ dd if=/dev/zero of=SparseFile bs=1 seek=1G count=0
$ ls -l SparseFile
-rw-rw-r-- 1 izx izx 1073741824 Jul 24 03:53 SparseFile
$ du SparseFile
0 SparseFile
$ stat SparseFile
  File: `SparseFile'
  Size: 1073741824  Blocks: 0          IO Block: 4096   regular file
Device: 805h/2053d  Inode: 400321      Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/     izx)   Gid: ( 1000/     izx)

3
  • I deleted it and everything if fine. Does Wubi use sparse files?
    – L01man
    Jul 24, 2012 at 12:24
  • Not to my knowledge; Wubi preallocates the entire "disk" size when you install; besides, IIRC 35 GB or so is the max the Windows installer allows?
    – ish
    Jul 24, 2012 at 17:30
  • I don't know. I remember resizing the partition, but not to a size this big. Is it possible a NTFS partition was once mounted in this file?
    – L01man
    Jul 24, 2012 at 18:58

You must log in to answer this question.

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