this post was submitted on 05 Feb 2024
46 points (97.9% liked)

Selfhosted

40663 readers
164 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
46
Best Filesystem for NAS? (self.selfhosted)
submitted 10 months ago* (last edited 10 months ago) by Trincapinones to c/selfhosted
 

A year ago I set up Ubuntu server with 3 ZFS pools on my server, normally I don't make copies of very large files but today I was making a copy of a ~30GB directory and I saw in rsync that the transfer doesn't exceed 3mb/s (cp is also very slow).

What is the best file system that "just works"? I'm thinking of migrating everything to ext4

EDIT: I really like the automatic pool recovery feature in ZFS, has saved me from 1 hard drive failure so far

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 36 points 10 months ago* (last edited 10 months ago) (1 children)

ZFS is a very robust choice for a NAS. Many people, myself included, as well as hundreds of businesses across the globe, have used ZFS at scale for over a decade.

Attack the problem. Check your system logs, htop, zpool status.

When was the last time you ran a zpool scrub? Is there a scrub, or other zfs operation in progress? How many snapshots do you have? How much RAM vs disk space? Are you using ZFS deduplication? Compression?

[–] Trincapinones 3 points 10 months ago* (last edited 10 months ago) (1 children)

I don't even know what a zpool scrub is lol, do you have some resources to learn more about ZFS? 1TB pool and 2 500GB pools, with 32GB of RAM, No deduplication and LZ4 compression

[–] [email protected] 7 points 10 months ago (2 children)

Yeah, you should be scrubbing weekly or monthly, depending on how often you are using the data. Scrub basically touches each file and checks the checksums and fixes any errors it finds proactively. Basically preventative maintenance.
https://manpages.ubuntu.com/manpages/jammy/man8/zpool-scrub.8.html

Set that up in a cron job and check zpool status periodically.

No dedup is good. LZ4 compression is good. RAM to disk ratio is generous.

Check your disk's sector size and vdev ashift. On modern multi-TB HDDs you generally have a block size of 4k and want ashift=12. This being set improperly can lead to massive write amplification which will hurt throughput.
https://www.high-availability.com/docs/ZFS-Tuning-Guide/

How about snapshots? Do you have a bunch of old ones? I highly recommend setting up a snapshot manager to prune snapshots to just a working set (monthly keep 1-2, weekly keep 4, daily keep 6 etc) https://github.com/jimsalterjrs/sanoid

And to parrot another insightful comment, I also recommend checking the disk health with SMART tests. In ZFS as a drive begins to fail the pool will get much slower as it constantly repairs the errors.

[–] BobsAccountant 2 points 10 months ago* (last edited 10 months ago) (2 children)

Adding on to this:

These are all great points, but I wanted to share something that I wish I'd known before I spun up my array... The configuration of your array matters a lot. I had originally chosen to use RAIDZ1 as it's the most efficient with capacity while still offering a little fault tolerance. This was a mistake, but in my defense, the hard data on this really wasn't distributed until long after I had moved my large (for me) dataset to the array. I really wish I had gone with a Striped Mirror configuration. The benefits are pretty overwhelming:

  • Performance is better than even RAIDZ2, especially as individual disk size increases.
  • Fault tolerance is better as you could have up to 50% of the disks fail, so long as one disk in a mirrored set remains functional.
  • Fault recovery is better. With traditional arrays with distributed chunks, you have to resilver (rebuild) the entire array, requiring more time, costing performance and shortening the life of the unaffected drives.
  • You can stripe mismatched sets of mirrored drives, so long as the mirrored set is identical, without having the array default to the size of the smallest member. This allows you to grow your array more organically, rather than having to replace every drive, one at a time, resilvering after each change.

Yes, you pay for these gains with less usable space, but platter drives are getting cheaper and cheaper, the trade seems more worth it than ever. Oh and I realize that it wasn't obvious, but I am still using ZFS to manage the array, just not in a RAIDZn configuration.

load more comments (2 replies)
load more comments (1 replies)
[–] [email protected] 27 points 10 months ago (4 children)

Ext4 does not have snapshots, COW or similar features. I am very happy with BTRFS. It just "works" out of the box.

[–] [email protected] 14 points 10 months ago (1 children)

I use BTRFS on everything too nowadays. The thing that made me switch everything to BTRFS was filesystem compression.

[–] [email protected] 2 points 10 months ago (1 children)

Yes compression is cool. Zstd level 3 to 6 is very quick too 😋

[–] [email protected] 2 points 10 months ago

I use zstd too, didn't specifiy a level tho, so it's just using the default. I only use like ⅔ of the disk space I used before and I don't feel any difference in performance at all.

[–] [email protected] 6 points 10 months ago (1 children)

FWIW lvm can give you snapshots and other features. And mdadm can be used for a raid. All very robust tools.

[–] [email protected] 6 points 10 months ago (1 children)

Yes but BTRFS can this out of the box without extra tools. Both ways have their own advantage, but I would still prefer BTRFS

[–] Paragone 4 points 10 months ago (1 children)

I'm in BTRFS, and wish I wasn't.

Booting into a failed mdadm RAID1 is normal,

whereas booting into a failed BTRFS RAID1 requires competent manual intervention, and special parameters given to the boot-kernel.

mdadm & lvm, with a fixed version of ZFS would be my preference.

ZFS recently had a bug discovered that was silently corrupting data, and I HOPE a fix has been got in.

Lemme see if I can find something on both of these points..


https://linuxnatives.net/2015/using-raid-btrfs-recovering-broken-disks

https://www.theregister.com/2023/11/27/openzfs_2_2_0_data_corruption/


_ /\ _

[–] [email protected] 2 points 10 months ago

Never had problems, but I wish you all the best for your ZFS problem 🤗

[–] TCB13 3 points 10 months ago (12 children)

Yes and BTRFS, unlike Ext4, will not go corrupt on the first power outage of slight hardware failure.

[–] [email protected] 5 points 10 months ago

Wut? Ext4 is quite reliable.

[–] [email protected] 3 points 10 months ago

I've run btrfs for years and never had a issue. They one time my system wouldn't boot it was due to a bad drive. I just swapped the drive and rebalanced and I was back up and running in less than a half an hour.

[–] devfuuu 2 points 10 months ago

Corruption on power only regularly happened to me on xfs a few years ago. That made me swear to never use that fs ever again. Never seen it on my ext4fs systems which are all I have for years in multiple computers.

load more comments (9 replies)
load more comments (1 replies)
[–] [email protected] 16 points 10 months ago (1 children)

3mb/s sounds more like there is something else going on.

[–] Trincapinones 3 points 10 months ago (1 children)

Yeah, but I don't know how to diagnose it...

[–] [email protected] 3 points 10 months ago (1 children)

You could try to redo the copy and monitor the system in htop, for example. Maybe there's a memory or CPU bottleneck. Maybe one of your drives is failing, maybe you've got a directory with tons of very small files, which causes a lot of overhead.

[–] TheWilliamist 2 points 10 months ago

Yes, file size, drive types, the amount of RAM in the server, in the source and destination of the operation, can all have an effect on Performance. But generally if he’s moving within the same pool, it should be pretty quick.

[–] [email protected] 10 points 10 months ago (2 children)

Most filesystems should "just work" these days.

Why are you blaming the filesystem here when you haven't ruled out other issues yet? If you have a drive failing a new FS won't help. Check out "smartctl" to see if it reports errors in your drives.

[–] KpntAutismus 3 points 10 months ago

they may be using really slow hard drives or an SSD without DRAM.

or maybe a shitty network switch?

maybe the bandwidth is used up by a torrent box?

there's a lot of possible causes.

load more comments (1 replies)
[–] [email protected] 9 points 10 months ago (1 children)

How full is your ZFS? ZFS doesn't handle disk filling and fragmentation well.

[–] Trincapinones 4 points 10 months ago (1 children)

Around 70% full with 10% fragmentation

[–] [email protected] 2 points 10 months ago

At around 70%, fragmentation issues start becoming apparent with ZFS IIRC. Though they shouldn't be this apparent.

[–] [email protected] 9 points 10 months ago (8 children)

XFS has "just worked" for me for a very long time now on a variety of servers and desktop systems.

[–] [email protected] 8 points 10 months ago* (last edited 10 months ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
LVM (Linux) Logical Volume Manager for filesystem mapping
NAS Network-Attached Storage
PSU Power Supply Unit
SSD Solid State Drive mass storage
ZFS Solaris/Linux filesystem focusing on data integrity

5 acronyms in this thread; the most compressed thread commented on today has 9 acronyms.

[Thread #486 for this sub, first seen 5th Feb 2024, 15:05] [FAQ] [Full list] [Contact] [Source code]

[–] [email protected] 6 points 10 months ago

I host my array of HDD drives with btrfs, works well and is Linux native.

[–] nezbyte 5 points 10 months ago* (last edited 10 months ago)

MergerFS + Snapraid is a really nice way to turn ext4 mounts into a single entry point NAS. OpenMediaVault has some plugins for setting this up. Performance wise it will max out the drive of whichever one you are using and you can use cheap mismatched drives.

[–] PedanticPanda 5 points 10 months ago (2 children)

Make sure you don't have SMR drives, if they are spinning drives. CMR drives are the I ly ones that should be used in a NAS, especially with ZFS. https://vermaden.wordpress.com/2022/05/08/zfs-on-smr-drives/

[–] [email protected] 2 points 10 months ago (1 children)

From the article it looks like zfs is the perfect file system for smr drives as it would try to cache random writes

[–] PedanticPanda 2 points 10 months ago

Possibly, with tuning. Op would just have to be careful about reslivering. In my experience SMR drives really slow down when the CMR buffer is full.

load more comments (1 replies)
[–] Unyieldingly 5 points 10 months ago (2 children)

ZFS is by far the best just use TrueNAS, Ubuntu is crap at supporting ZFS, also only set your pool's VDEV 6-8 wide.

load more comments (2 replies)
[–] [email protected] 4 points 10 months ago (1 children)

ZFS should have better performance if you set it up correctly.

[–] [email protected] 4 points 10 months ago (3 children)

That's exactly their gripe: out of the box performance.

load more comments (3 replies)
[–] [email protected] 4 points 10 months ago (1 children)

Where are you copying to / from?

Duplicating a folder on the same NAS on the same filesystem? Or copying over the network?

For example, some devices have a really fast file transfer until a buffer files up and then it crawls.

Rsync might not be the correct tool either if you're duplicating everything to an empty destination...?

[–] Trincapinones 1 points 10 months ago (1 children)

Same NAS, same filesystem on an SSD without redundancy

load more comments (1 replies)
[–] ikidd 2 points 10 months ago

Use zfs sync instead of rsync. If it's still slow, it's probably SMR drives.

load more comments
view more: next ›