arter97 / exfat-linux

EOL exFAT filesystem module for Linux kernel. Everyone should be using https://github.com/namjaejeon/linux-exfat-oot instead.
Other
262 stars 61 forks source link

Slow truncate with exFAT #31

Open josephernest opened 3 years ago

josephernest commented 3 years ago

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 :

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 !