I'm wondering if there is a way to write a file in contiguous extent, to completely avoid fragmentation in certain file of the filesystems.
I mean, XFS filesystem under Linux.
I'm wondering if there is a way to write a file in contiguous extent, to completely avoid fragmentation in certain file of the filesystems.
I mean, XFS filesystem under Linux.
In general, no - you have no direct control over the allocator.
You can use the fallocate(2) syscall to pre-allocate all blocks, and depending on free space available, that may give you contiguous blocks to write into.
(Note that you can check the actual fragmentation/layout of an existing file using the xfs_bmap command.)