du and ls give conflicting results on VERITAS File System (tm).

book

Article ID: 100015357

calendar_today

Updated On:

Resolution

This can happen when a space reservation is set on the file in question.  

The following example demonstrates how du and ls can differ because setext was used to pre-allocate or reserve space for a file and how to use setext-r to resolve the difference.

1.  Create a file and check its size using ls and du .  Note that both commands show 0 bytes:
 
#touch test
 
# ls-l test
-rw-------  1 root     other          0 Jun 11 16:01test
 
# du-k test
0      test


2.  Use setext to pre allocate space for the file and check ls and du again.  Note this time du shows 1024 Kbytes allocated to the file while ls still shows 0 bytes:
 
#/usr/lib/fs/vxfs/bin/setext -r 1024k test
 
# du-k test
1024    test
 
# ls-l test
-rw-------  1 root     other          0 Jun 11 16:01test


3.  The getext command can be used to check the space reservation of a file:
 
#/usr/lib/fs/vxfs/bin/getext test
test:          Bsize  1024  Reserve    1024  ExtentSize       0


4.  The setext command also can be used to clear a space reservation for a file:
 
#/usr/lib/fs/vxfs/bin/setext -r 0 test
 
#/usr/lib/fs/vxfs/bin/getext test
test:          Bsize  1024  Reserve       0  ExtentSize       0
 
# du-k test
0      test


A relatively common occurrence of a file with a space reservation is a VERITAS Quick I/O file for a database like Oracle. A file that is created as a Quick I/O file by qiomkfile will have a space reservation associated with it. Even if this file is converted to a regular VERITAS FileSystem (VxFS) file, the space reservation will persist. However, a file that is converted from a regular VxFS file to Quick I/O manually or using the conversion script will not have a space reservation associated with it.

Issue/Introduction

du and ls give conflicting results on VERITAS File System (tm).