BLOG UPDATE 08-NOV-2011 : After posting and handling comments I realize the title is drawing readers’ attention to the wrong thing. I am aware that ls(1) and du(1) can and should disagree about file size and space utilization because they are two different things (e.g., sparse files and non-file data associated with the file). The point of this blog was just to show that within microseconds (or less) ls(1) reported my file was zero bytes and du(1) reported it occupied nearly 300GB space in the file system. That is the “oddity”–or is it? The original post follows:
I love XFS.
I’ve been doing some, shall we say, rather unseemly sorts of things to one of my XFS file systems. Things are generally holding up, however, a little something made me crabby today so I think another installment in my Little Things Doth Crabby Make series is in order.
I don’t think I even need to explain why the following is something which hath crabby made:
# uname -r 2.6.18-194.26.1.el5 # df -h . Filesystem Size Used Avail Use% Mounted on /dev/sdb2 2.0T 1.7T 236G 88% /data1 # ls -l foo -rw-r--r-- 1 root root 0 Nov 7 10:53 foo # du -sh foo 287G foo # rm -f foo $ ls -l foo ls: foo: No such file or directory # df -h . Filesystem Size Used Avail Use% Mounted on /dev/sdb2 2.0T 1.7T 236G 88% /data1
I’ll blog more on what’s happening here as soon as I can. In the meantime, I’m crabby. Not really, that’s just the theme of this blog series.