Unsolved

This post is more than 5 years old

19 Posts

3774

February 24th, 2015 15:00

NTFS file attribute support - sparse

My google/support searches are not turning up information about NTFS sparse file attribute support on OneFS.

I have found info on how to create a sparse file using the linux dd command and this worked.  The file is sparse and I can see the file size the file system reports and how much disk space the file is actually taking.  However accessing this file via SMB client the file takes up more disk space than the file size.

I have tried copying a sparse file from a windows machine to the share on the Isilon cluster (7.1.0.5) and the file is copied taking up the full amount of space and the sparse attribute (P) is not set on the file on the Isilon cluster.  I can successfully copy the same sparse file to shares on NetApp ONTAP 7, 8.x Cluster VSM, VNX5300 and VNX5200.  All of these will show the sparse attribute on the destination file.  The VNX5200 however will show the disk usage the same as the file size even though the sparse attribute is set.

So the question is how can I get the NTFS file attribute set for a sparse file?  Any ideas or links to docs about this?  If possible what actually is supported for NTFS attributes would be helpful too like NTFS encryption, compression, etc...

125 Posts

February 25th, 2015 10:00

I'm pretty sure that OneFS ignores the FILE_ATTRIBUTE_SPARSE_FILE bit (as well as a few other bits). So your sparse file copy is likely just resulting in a file full of zeros on OneFS.

I'm not 100% sure on this, so your best course of action is to connect with Isilon Support so one of our Windows/SMB engineers can comment with more specifics...

--kip

122 Posts

February 25th, 2015 23:00

Hello,

FILE_ATTRIBUTE_SPARSE_FILE

The FSCTL_SET_SPARSE IOCTL (see [MS-FSCC]) is used to mark a given file as sparse or not sparse. When a file system that supports sparse files, i.e. NTFS, receives an FSCTL_SET_SPARSE IOCTL request on a file, it should set or unset the FILE_ATTRIBUTE_SPARSE_FILE attribute of the specified file.

If you attempt to clear the FILE_ATTRIBUTE_SPARSE_FILE attribute, the operation is valid only if there is no sparse region in the file. The FSCTL_QUERY_ALLOCATED_RANGES (see [MS-FSCC]) control code is used to determine whether there are sparse regions in a file.

In Windows NTFS file systems, files are not made sparse by default. The application or user needs to explicitly mark the file sparse via the FSCTL_SET_SPARSE control code.  Unlike Unix or Linux file systems, when a file is created on Windows and some data is written at an offset, let assume at 1 MB offset, NTFS will allocate clusters and fill in all space from 0 to 1 MB.  This means, the file has to be explicitly marked sparse before it becomes sparse.

Marking a file as sparse

This can be done by calling DeviceIoControl() with the FSCTL_SET_SPARSE file system control code.

For example:

A file can be associated with more than one application at a time, such as Microsoft® Word and Microsoft® WordPad. For instance, a file structure like the following illustrates file association, but not multiple files:

program:source_file

:doc_file

:object_file

:executable_file

Reason could be because NTFS is not supported on floppy disks, when you copy an NTFS file to a floppy disk, data streams and other attributes not supported by FAT are lost without warning.

I have  pasted link below which will help you answer your query.

https://technet.microsoft.com/en-us/library/cc938926.aspx

http://blogs.msdn.com/b/openspecification/archive/2010/11/05/notes-on-sparse-files-and-file-sharing.aspx

http://www.flexhex.com/docs/articles/sparse-files.phtml

Thanks

Hemant

19 Posts

February 26th, 2015 08:00

Hemant,

Thank you for the information.  My question may not have been as clear as I thought.  I am looking for sparse attribute support on OneFS in the SMB world.  I can create a sparse file in a share on a Windows server.  I have been able to copy that file with a data migration tool to other NAS devices and the sparse attribute is maintained.  Using a share on an Isilon cluster as the destination the sparse attribute is not maintained.

I have opened a SR with EMC and research is being done.  So far OneFS 7.0.x does not support the sparse file attribute for SMB.  Still waiting to find out about OneFS 7.1.x.

19 Posts

February 26th, 2015 09:00

Thanks kipcranford!

125 Posts

February 26th, 2015 09:00

I checked out our latest "head" code, and FILE_ATTRIBUTE_SPARSE_FILE is in a data structure that implies it's being ignored.  So now I'm 99.9% sure we won't set that bit (and this applies to all OneFS releases)...

Top