oxal.org

~/blog $ cat testing-my-sn7100-4tb-ssd.md

Testing my WD SN7100 4TB SSD

Mitesh aka ox 634 words · ~3 min

With the price of SSDs nowadays, I damn well had to check if Amazon delivered a legit SSD or not.

I looked into a few ways to check this and I came across this: A fake drive can get away with misreporting it’s capacity because its firmware lies about how much flash is actually inside.

Say there’s only 64GB of real flash but the controller reports 4TB to the OS. When you write past 64GB, the controller just maps the next block back onto the start of the flash and overwrites what was already there. Every write succeeds, but unless you read it back and VERIFY that what you wrote is what you’re now reading for the entire capacity you can’t be sure of the true capacity.

This is a really time consuming process for 4tb worth of flash.

f3probe works by figuring out how much real flash is behind the controller, without writing and verifying all 4TB.

Here’s the trick. It writes a known pattern to one block, then keeps writing to other blocks and checking whether the first block still holds the pattern you wrote. On a real drive, every block maps to a different physical location, so the first block stays intact no matter how much you write elsewhere. On a fake drive that wraps around, your writes eventually land back on the start of the flash, and the pattern in that first block gets clobbered.

Once f3probe sees that clobber, it knows exactly where the wrap happened, which tells it the true capacity. That’s why the probe finishes in seconds instead of hours: it only has to write enough to cross the point where a fake drive would wrap, and it finds that point with a binary search instead of writing the entire capacity.

--destructive is a heads up that this will trash whatever data is on the drive – it’s writing patterns directly to the raw block device, not to a filesystem. So only run it on a drive you don’t care about (a freshly bought one, in my case). If the device is genuine, you get “The device /dev/sde’ is the real thing” and the geometry it figured out. If it’s fake, f3probe` tells you the actual usable size it found.

Here comes f3probe’s --destructive

~ sudo f3probe --destructive --time-ops /dev/sde
F3 probe 9.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

WARNING: Probing normally takes from a few seconds to 15 minutes, but
         it can take longer. Please be patient.

Good news: The device `/dev/sde' is the real thing

Device geometry:
	         *Usable* size: 3.64 TB (7814037168 blocks)
	        Announced size: 3.64 TB (7814037168 blocks)
	                Module: 4.00 TB (2^42 Bytes)
	Approximate cache size: 0.00 Byte (0 blocks), need-reset=no
	   Physical block size: 512.00 Byte (2^9 Bytes)

Probe time: 5.30s
 Operation: total time / count = avg time
      Read: 73.8ms / 4822 = 15us
     Write: 4.96s / 4192321 = 1us
     Reset: 0us / 1 = 0us
~ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0 931.5G  0 disk
├─sda1        8:1    0   931G  0 part /mnt/windox
└─sda2        8:2    0   475M  0 part
sdb           8:16   0   3.6T  0 disk
└─sdb1        8:17   0   3.6T  0 part /mnt/blue1
sdc           8:32   0 931.5G  0 disk
└─sdc1        8:33   0 919.8G  0 part /mnt/andromeda
sdd           8:48   1 114.6G  0 disk
├─sdd1        8:49   1 114.6G  0 part
└─sdd2        8:50   1    32M  0 part
sde           8:64   0   3.6T  0 disk
└─sde1        8:65   0   3.6T  0 part
zram0       253:0    0  30.5G  0 disk [SWAP]
nvme1n1     259:0    0 931.5G  0 disk
└─nvme1n1p1 259:4    0 931.5G  0 part /mnt/biochip
nvme0n1     259:1    0   1.8T  0 disk
├─nvme0n1p1 259:2    0   300M  0 part /boot/efi
└─nvme0n1p2 259:3    0   1.8T  0 part /
nvme2n1     259:5    0   3.6T  0 disk
└─nvme2n1p1 259:6    0   3.6T  0 part /mnt/oxadrive

EOF

guest@ark: ~/blogzsh

$ whoami

Mitesh's photo

Mitesh Shah, aka oxalorg. I build things in Mumbai and write some of them down here.

$ rant --at

Did I waste your time? Come tell me about it. Or mail mitesh@oxal.org.

$ subscribe --rate "2 emails/year"

Plain-text life updates, no bullshit. Drop your email here, or follow the atom feed.