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?
1 Answer
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)
-
-
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?– ishJul 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?– L01manJul 24, 2012 at 18:58
ls -l /home/{user}/nfts.txt
anddu /home/{user}/ntfs.txt
?