When you send (via Samba share) a 2GB file to an exfat partition, there is an initial truncate() to set the filesize, and then the real file content is written (see Samba source here). It is probably the same with many other sharing/syncing tools. See similar issue in exfat-fuse.
When doing this with exfat :
a first pass of writing 2 GB of "null bytes" is done
then the 2 GB file content data is written
So a total of 4 GB is written, and this doubles the file transfer time, and the GB written on disk!
*Question @arter97 : how to modify your driver such that a `f.truncate(2100010001000)` does not write 2 GB of null bytes immediately?**
Example 1 (NTFS)
with open('file.bin', 'wb') as f:
f.write(b'hello')
f.truncate(1000*1000*1000)
# takes < 1 second
Example 2 : same code with exFAT takes ... 30 seconds !
When you send (via Samba share) a 2GB file to an
exfat
partition, there is an initialtruncate()
to set the filesize, and then the real file content is written (see Samba source here). It is probably the same with many other sharing/syncing tools. See similar issue in exfat-fuse.When doing this with
exfat
:So a total of 4 GB is written, and this doubles the file transfer time, and the GB written on disk!
*Question @arter97 : how to modify your driver such that a `f.truncate(2100010001000)` does not write 2 GB of null bytes immediately?**
Example 1 (NTFS)
Example 2 : same code with exFAT takes ... 30 seconds !