Pascal via ntfs-3g-devel wrote:
Thank you.  I can confirm the truncate trick works.  Unfortunately, I suspect I will end up with a heavily fragmented disk if I use truncate to create 50,000 files and then ntfsfallocate to expand them all at once.

No, applying truncate to a void file yields a sparse file
with no cluster allocated for data.

Now, ntfsallocate allocates clusters the usual way, and there
is no attempt to search for the minimal fragmentation.
However if you create all your files on an initially empty
device (and you never change their sizes), you will probably
get no fragmentation while the device is moderately filled.

Jean-Pierre

  It would be nice if ntfsfallocate was able to create files too.

There is a write-up of what I am trying to accomplish at https://unix.stackexchange.com/questions/566038/simultaneous-copy-from-multiple-sources-without-fragmenting-destination

I will try to get your patch working.

-Pascal


On 2/6/2020 2:43 AM, Jean-Pierre André wrote:
There is indeed a bug in ntfsfallocate when there is initially
no allocation at all.
In your example a possible workaround is to allocate a sparse
cluster after the touch ("truncate -s 4096 /12tb/test/6")
Of course, in a real situation you would have to insert a
test to avoid truncating valid data.

Attached is a proposed patch which you might apply to fix
the case.

Jean-Pierre

Pascal via ntfs-3g-devel wrote:
I can't seem to get ntfsfallocate to do anything:

# mount /dev/sdq1 /12tb/
# ll /12tb/test/6
ls: cannot access /12tb/test/6: No such file or directory
# touch /12tb/test/6
# umount /12tb
# ntfsinfo -v /dev/sdq1 -F test/6 > 0
# ntfsfallocate -l 537308676 /dev/sdq1 test/6
ntfsfallocate v2017.3.23 (libntfs-3g)
ntfsfallocate completed successfully. Have a nice day.
# ntfsinfo -v /dev/sdq1 -F test/6 > 1
# diff 0 1
#

Fully patched CentOS 7
ntfs-3g.x86_64     2:2017.3.23-11.el7    @epel
ntfsprogs.x86_64   2:2017.3.23-11.el7    @epel
WD Easystore 12TB External USB 3.0 Hard Drive

-Pascal



_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel






_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to