Syncing fragments hard drive, badly


gte166n

Recommended Posts

I've noticed BitTorrent Sync appears to fragment my hard drive pretty badly.

Setup:

  • 2 Laptops (Laptop A and Laptop B), both with 500 GB hard-disk (5400 RPM disk)
  • Laptop A has Windows 7, various programs, and 4 30+ GB folders (each with 10,000+ files)
  • Laptop B has Windows 7, few programs, and few files

Steps to reproduce:

  • Step 1) Defragment both Laptops A & B
  • Step 2) Sync 1 30+ GB folder from Laptop A to Laptop B
  • Step 3) Check fragmentation of Laptop B.
  • It is now over 10%
  • If you repeat steps 2 & 3, then the fragmentation is over 20%.

 

Any ideas on what can be done to prevent this fragmentation?

Thanks!

 

Link to comment
Share on other sites

fragmentation appears when a file is written to the disk, if the disk doesn't have enough space to save the file as a unit. It's not Sync that decides where to write the file, it's OS that does it. Some file systems are more resistant to fragmentation than others. which is yours? 

If you sync a lot of small files there is a bigger chance that they'll be split into fragments, unlike syncing a few big files. Also, you can partition your disk and allocate a special partition for the files that change more frequently to separate them from more or less static files. 

Link to comment
Share on other sites

2 hours ago, Helen said:

fragmentation appears when a file is written to the disk, if the disk doesn't have enough space to save the file as a unit. It's not Sync that decides where to write the file, it's OS that does it. Some file systems are more resistant to fragmentation than others. which is yours? 

If you sync a lot of small files there is a bigger chance that they'll be split into fragments, unlike syncing a few big files. Also, you can partition your disk and allocate a special partition for the files that change more frequently to separate them from more or less static files. 

 

This is only part of the story, virtually all modern operating systems will attempt to avoid fragmentation when applications pre-allocate files with the appropriate sizes. However, if an application creates a bunch of tiny files and then appends data to them (without pre-allocating), you'll end up with substantial fragmentation as the file system was optimizing placement for small files.

This frequently happens with log files, which by their nature, don't have a size that can be known in advance, but for applications which know the size of the file when it starts, an application developer can greatly reduce fragmentation (and in some cases, increase write performance) by pre-allocating files.

(Why would this increase write performance? Because in some cases, file systems need to zero space before it can be used, if you pre-allocate the entire file, the file system will zero using a low-priority task whereas if you append to a file, it needs to be zeroed just a few blocks ahead of the write. Again, file systems try to optimize by completing your write and then zeroing the remainder of the block, but if the block size you're writing doesn't match the file system, you'll end up with weird effects)

Now to be clear, I have not looked at how Sync creates large files, whether it pre-allocates files or not, but my point is that the application layer is a major factor, not just the file system.

Edited by The Dave
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.