What is a Holey File (Reported by "snfsdefrag") ?

What is a Holey File (Reported by "snfsdefrag")?


Sometimes when you execute snfsdefrag you can get a response saying that you have "holey file(s)".


Holey files are files with data holes in them. They are typically crated by a database-type application.

These files actually occupy less space on the disk then their reported size. This can be seen by comparing the output of ls –lh vs. du –h on a holey file. Holey files can't be treated by snfsdefrag, and sometimes can't be copied, because the copy zero-fills the holes that were in the original and could cause the copy to exceed the available disk space.

The following example shows these characteristics of holey files.

To create a holey file, you need to sparsely write the file. The file will report its allocated size, but will occupy a different (smaller) size on disk :


[root@snfs1-433 snfs1]# dd if=/var/log/messages of=file1 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000141909 s, 3.6 MB/s
[root@snfs1-433 snfs1]# dd if=/var/log/messages of=file1 count=1 seek=1K
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000198384 s, 2.6 MB/s
[root@snfs1-433 snfs1]# ls -lh file1
-rw-rw-r-- 1 root root 513K Dec 17 16:17 file1
[root@snfs1-433 snfs1]# du -h file1
32K file1
[root@snfs1-433 snfs1]# snfsdefrag -c file1
file1: holey file


Holey files can't be defragged:

[root@snfs1-433 snfs1]# snfsdefrag file1 -m1
1 file visited: 0 defragged, 1 skipped


To check how holey a file is (to see the size of the hole[s]), use snfsdefrag -e <file>:


[root@snfs1-433 snfs1]# snfsdefrag -e file1
file1:
# group frbase fsbase fsend kbytes depth
0 4 0x0 0x2ee6d 0x2ee6d 16 1
HOLE @ frbase 0x4000 for 31 blocks (496 kbytes)
1 4 0x80000 0x2ee6e 0x2ee6e 16 1


File1 is holey, since data has only been written to some of the allocated space for the file, but if you read file1, the hole(s) will be filled with 0’s.

Copying the file will also zero-fill the holes, which is why the actual disk blocks used by the copied file will be greater than for the original holey file.

[root@snfs1-433 snfs1]# cp file1 file1.new
[root@snfs1-433 snfs1]# ls -lh file1*
-rw-rw-r-- 1 root root 513K Dec 17 16:17 file1
-rw-rw-r-- 1 root root 513K Dec 17 16:18 file1.new

Both files report a file size of 513K, but file1.new uses more actual disk space than file1, since the holes have been zero-filled.

[root@snfs1-433 snfs1]# du -h file1*
32K file1
528K file1.new

[root@snfs1-433 snfs1]# stat file1*
File: `file1'
Size: 524800 Blocks: 64 IO Block: 1048576 regular file
Device: fc04h/64516d Inode: 8121665 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-12-17 16:25:41.579176505 +0100
Modify: 2014-12-17 16:17:50.110176995 +0100
Change: 2014-12-17 16:17:50.110176995 +0100
File: `file1.new'
Size: 524800 Blocks: 1056 IO Block: 1048576 regular file
Device: fc04h/64516d Inode: 8121666 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-12-17 16:25:41.582176505 +0100
Modify: 2014-12-17 16:18:54.012176930 +0100
Change: 2014-12-17 16:18:54.012176930 +0100

[root@snfs1-433 snfs1]# snfsdefrag -e file1*
file1:
# group frbase fsbase fsend kbytes depth
0 4 0x0 0x2ee6d 0x2ee6d 16 1
HOLE @ frbase 0x4000 for 31 blocks (496 kbytes)
1 4 0x80000 0x2ee6e 0x2ee6e 16 1

holey file, skipping.
file1.new:
# group frbase fsbase fsend kbytes depth
0 4 0x0 0x2ee6f 0x2ee8f 528 1

A checksum of the two files will provide identical results:


[root@snfs1-433 snfs1]# md5sum file1 file1.new
ad09986b411a6771a72f1d8dac03e404 file1
ad09986b411a6771a72f1d8dac03e404 file1.new


 KEYWORDS: SNFS, SN5, SN4, SN3, LINUX, MAC


 KEYWORD POOL:


SNFS, SNSM, SNCONNECT, M330, M440, M660, G300, SN5, SN4, SN3, PERFORMANCE, LOG,  RAS, TROUBLESHOOTING, DATABASE, LINUX, MAC, WINDOWS, SAN, NFS, CIFS, SNFX, SNAPI, WSAPI, QD, QX, QXS, LATTUS, BROCADE, XSAN, PFR, ADVANCED REPORTING, LSI, QLOGIC, FSM, FSMPM, TSM, MSM, MYSQL, LINTER, MULTIPATH, LIBRARY, TAPE DRIVE, DDM


 


 


 


 

Audience: 
Public Unrestricted
Review/Evaluate: 
2016-01-02
Document Type: