Jean-Pierre André wrote: > Hi, > > Amit Uttamchandani wrote: >> Hello, >> >> I understand that fuse has implemented fallocate support. I have >> obtained the latest sources of ntfs-3g from git and noticed this is not >> implemented yet. Are there any plans to support this? >> >> In the meantime, I tried to simulate an fallocate by using ntfscp code >> and instead of doing copy just create the file, change the size using >> ntfs_attr_truncate_solid(). Then, I close the attr, inode, and unmount >> the volume. >> >> The file gets created with the correct size (4GB). However, this is not >> reflected in the filesystem. Checking the free space, shows the same >> amount of free space as before the 4GB file creation. Am I missing a >> step here? > > This is a bug in ntfs_attr_truncate_solid() leading to a sparse file > instead > of a file whose space is fully allocated, which occurs when the data > is resident initially. You can avoid the bug by writing 4K bytes before > calling ntfs_attr_truncate_solid(). Attached is a patch to fix the bug. > > With this procedure you will allocate disk space without writing to the > allocated space. However data previously written to the same space can > be read, so providing a fallocate() on a similar base is not acceptable. > You will get a better result by issuing a command such as > dd if=/dev/zero of=allocated_file bs=65536 count=65536 > > Now, NTFS has a limited possibility to allocate space to a file without > writing to it, still making the space appearing as zeroed. The probable > consequence would be that only sequential writing from the beginning > of the file would be allowed. I have not examined further.
I found that Windows behaves badly when writing to files which have preallocated clusters not written to, it may : - deallocate the clusters not written to, - loop to no end, - or crash (BSOD) This could be a bug in Windows, as chkdsk makes no changes and does not complain about hidden preallocated clusters with no meaningful data. ntfs-3g however behaves fine when using preallocated clusters. > Can you explain why you want to allocate space without writing to that > space, and how you would use the allocated space ? > > Regards > > Jean-Pierre -- JP André email [email protected] ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ ntfs-3g-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel
