Hacker News new | ask | show | jobs
by undersuit 8 days ago
SMR drives are the worst, even had issue resilvering a 2TB mirror.

What's frustrating is even just a little info from the manufactures would be beneficial, like the size of a shingle so the computer could batch writes, or even if the drive is shingled!

3 comments

That's why libzbc exists. Host-aware and host-managed SMR give you the tools to optimize I/O around the batching needed. It doesn't change the fundamental outlook - you still have to organize writes in these huge blocks and do some math to figure out the best timing to commit cache to re-writes - but it's at least a tractable problem compared to chucking everything over the wall with device-managed SMR.

In any case, I don't think hobbyists get to play with the non-disk-managed drives, and anyone with the money and the special disks is probably not using ZFS because it's a bit of an uphill battle to fit SMR to a copy-on-write filesystem.

+1 SMR drives are really great if you pack your data into large enough groups so that you occupy exacly N SMR zones, and allocate your files to specific SMR zones that you then only rewrite atomically. The sibling comment is on point - it's pretty similar to how to work effectively with SSDs.

The drive doesn't have enough information to do this itself, we need SMR aware filesystems.

What we need is host-based SMR. SMR-aware filesystems exist (e.g. Zoned XFS, btrfs' zone mode, f2fs' zone mode).
How come copy-on-write is not easier with SMR? Each SMR zone a.k.a. shingle or flash erase block is effectively a tiny tape drive. It is basically append only.

Shouldn't this be especially useful with ZFS doing copy-on-write with linked lists as a reversed heap?

EDIT: So apparently, ZFS ashift is capped at 16 and values along 28 would be necessary to cover entire 256MiB (octet) shingles. Bummer.

EDIT2: The basic problem seems to stem from the exact same assumption that SQLite3 [1] makes: The sector write size for random write access is 512B or 4KiB, or whatever. With SMR and flash erase blocks, random write sector size and random read sector size are vastly different. Will take ages for filesystems to be updated to this new reality and then validated on real workloads.

[1] https://www.sqlite.org/atomiccommit.html, section 2 Hardware Assumptions.

It seems like posix_fadvise a.k.a. fcntl only has provisions for forward read ahead a.k.a. prefetching and random access. The latter disables prefetching to free up disk read operations and dram memory otherwise used for read ahead.

With a reverse B-tree heap it may be fruitful to prefetch a back offset from the end of the file that ends with the top of the heap inclusive and then switch to random single reads for the sparser read access "down" the heap towards the beginning of the file.

Then comes the question of write access. Flash storage seems to be able to write small read-sized sectors into the empty remainders of erase blocks. With SMR the question becomes, whether there is a third sector size like a single track layer where the next overlapping track can be written later. For erasing, the whole shingle needs to be replaced kind of like a flash erase block.

Maybe OpenZFS ashift can be adjusted to single track sizes within a shingle. That would curb write amplification to the physical limitations. At 60 to 150 tracks that still requires ashift between roughly 22 and 20.5 which are both larger than 16. Seems like it is especially bad if there are no common divisors or other rounding problems.

Maybe non-temporal writes and write coalescing like in CPUs become relevant now. Dan Luu seems to be right here. The read(2), write(2), and fsync(2) bedrock of Unix may be forced to be updated to CPU-like caches where barriers, write-backs, etc. are handled separately.

Land of contrasts, even compared to usual engineering trade offs.

Maybe Donald Knuth should keep the paper foldout on tape access patterns in TAOCP instead of removing it in the next revision as he mentioned in an interview somewhere. The problem domain seems to be resurfacing.
There are very good deals currently on eBay for 14TB HM-SR drives! I just got quite a few - should be interesting to see how the current zone aware filesystems perform. XFS with an optane metadata device? Could be pretty okay!
Handling SMRs well probably would require a custom replacement for SPA (block layer) component in ZFS, talking directly with DMU (object storage).

Could also expose the drives as SCSI object storage devices

While we are at it, let us also redesign the important application of NFS. The actual implementation of NFS seems to have, ummm..., impedance mismatches for a lot of people using it casually in university computer networks and SLURM clusters.

If we take a new hard look at open(2), read(2), and write(2), then let us look at real-world use cases. (Yes, yes, distributed systems. But the demand for at least decent errors is real.)

And all of that for a pretty paltry gain in capacity.
Uh, they do advertise zone size. At least, host-aware SMR. Yes, yes, host-unaware SMR is even more terrible.