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

Slow truncate with exFAT #31

@josephernest

Description

@josephernest

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions