Register for the iXsystems Community to get an ad-free experience

ZFS Fragmentation with Torrents

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

SeaWolfX

Explorer
Joined
Mar 14, 2018
Messages
60
I've read a few places that downloading torrents onto a ZFS storage causes a lot of fragmentation (also a lot of fragmented free space even if the file is moved) and I have a few questions in that regard:

1) Is there any recommended ZFS tuning that can limit this (I've read recommendations for recordsize of 16K and 1M for torrent datasets so it is a bit confusing).
2) Is this an issue with SSD? And if using SSDs for torrents will it cause a lot of wear on the drives?
3) Can zpools be defragemented somehow?
3) Is the best option to just use a separate harddrive without ZFS for torrents?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
7,421
1) Is there any recommended ZFS tuning that can limit this (I've read recommendations for recordsize of 16K and 1M for torrent datasets so it is a bit confusing).
Depends on the size of the "parts" of the torrents. Try to match that (or at least use even multiples).

Can zpools be defragemented somehow?
Destroy pool, put contents back.

Is the best option to just use a separate harddrive without ZFS for torrents?
Maybe, but that isn't really an option in TrueNAS.

What you might want to do is:

Turn off the pre-allocation of torrent files as a pre-emptive write of the whole file and subsequent re-writes of all parts as they arrive would mean a lot of churn for a Copy on Write filesystem like ZFS. This is in the Torrent client, not TrueNAS itself.

Turn off/don't set/delete all snapshots for that dataset/pool.

Is this an issue with SSD? And if using SSDs for torrents will it cause a lot of wear on the drives?
HDDs usually have a higher TBW for a given size, so consider that, but it's not really any harder or easier on SSDs in terms of data written.
 
Last edited:

jgreco

Resident Grinch
Moderator
Joined
May 29, 2011
Messages
17,112
I've read a few places that downloading torrents onto a ZFS storage causes a lot of fragmentation (also a lot of fragmented free space even if the file is moved) and I have a few questions in that regard:

1) Is there any recommended ZFS tuning that can limit this (I've read recommendations for recordsize of 16K and 1M for torrent datasets so it is a bit confusing).
2) Is this an issue with SSD? And if using SSDs for torrents will it cause a lot of wear on the drives?
3) Can zpools be defragemented somehow?
3) Is the best option to just use a separate harddrive without ZFS for torrents?

Yes, there's a lot you can do. The torrent problem is a variation on the small block storage problem, which is discussed extensively at

https://www.truenas.com/community/threads/the-path-to-success-for-block-storage.81165/

You mitigate fragmentation for reads with heaps of ARC and L2ARC, meaning that you simply try really hard to avoid hitting the pool for reads. You mitigate fragmentation for writes by maintaining heaps of free space, as in, maybe only use 25% of your space.

This assumes you want it to be fast. If you don't, just don't worry about it and it'll be fine.

Combine this with the message from @sretalla for a complete-ish answer.
 
Top