zfsonfreebsd / ZoF

ZFS on FreeBSD - the official out of tree OpenZFS implementation for FreeBSD
https://freebsd.org
Other
100 stars 8 forks source link

FEATURE IDEA - Write Counters per Device/Pool/Dataset/... #151

Open vermaden opened 4 years ago

vermaden commented 4 years ago

The SSD drives specifications have TBW (Tera Bytes Write) field.

For example its 1440TB for Samsung 860 QVO 4TB and 2400TB for Samsung 860 EVO 4TB drives.

It would be great to introduce a field in zfs command that will 'gather' amount of data written to VDEV and POOL, preferably also for DATASET.

Having this information will greatly ease buy of new drives when you know how much writes you have.

For example -w flag for zpool status command:


# zpool status
  pool: zroot
 state: ONLINE
  scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM
        zroot         ONLINE       0     0     0
          ada2p3      ONLINE       0     0     0

... and with theoretical -w flag:


 # zpool status -w
  pool: zroot
 state: ONLINE
  scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM    TBW
        zroot         ONLINE       0     0     0   2.1T
          ada2p3.eli  ONLINE       0     0     0   2.1T

There already is written property in zfs dataset for amount of referenced space written to this dataset since the previous snapshot so new name should be different, it can also be tbw for example.

# zfs get tbw zroot
NAME   PROPERTY  VALUE    SOURCE
zroot  tbw       2.1T      -

If the idea is not clear enough then let me know

Regards, vermaden

philmb3487 commented 4 years ago

Isn't this already part of the SMART structure? It makes no sense to have this at the pool level, because in ZFS the disks can come and go ... you'd want more locality for mitigating drive failure, and that layer is SMART.

vermaden commented 4 years ago

@sinetek

Yes and no.

That depends how much do you trust the firmware or the company that made that firmware.

For example Samsung 860 1TB mSATA SSD had no specification for their sector size on manufacturers page: https://www.samsung.com/semiconductor/minisite/ssd/product/consumer/860evo/

The S.M.A.R.T tool thinks its 512:

# smartctl /dev/ada2 --all | grep 'Sector Size'
Sector Size:      512 bytes logical/physical

... but its probably 4096 under the hood.

The Total_LBAs_Written value is 8372333275 according to smartctl tool:

# smartctl -a /dev/ada2 | grep -E 'ATTRIBUTE_NAME|Total_LBAs_Written'
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
241 Total_LBAs_Written      0x0032   099   099   000    Old_age   Always       -       8372333275

Theoretically I should multiply 8372333275 by 512 which gives 3.89 TB written ... but multiplied by 4096 instead of 512 its 31.18 TB already.

I also think about bugs in firmware when you 'reset' the SSD maybe this counter will also get a reset?

If you think this feature is not needed, then please close it, its just an idea :)

Regards.