Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Slow truncate with exFAT #31

Open
josephernest opened this issue Dec 7, 2020 · 0 comments
Open

Slow truncate with exFAT #31

josephernest opened this issue Dec 7, 2020 · 0 comments

Comments

@josephernest
Copy link

josephernest commented Dec 7, 2020

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(2*1000*1000*1000) 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 !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant