Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Testing a used hard drive to make SURE it is good.
Date: Wed, 17 Jun 2020 09:47:44
Message-Id: CAGfcS_=keQoB07s7BwRtJAkraewa_H7uEncHWEFa__1ENgimuQ@mail.gmail.com
In Reply to: Re: [gentoo-user] Testing a used hard drive to make SURE it is good. by antlists
1 On Tue, Jun 16, 2020 at 7:38 PM antlists <antlists@××××××××××××.uk> wrote:
2 >
3 > On 16/06/2020 13:25, Rich Freeman wrote:
4 > > And of course the problem with these latest hidden SMR drives is that
5 > > they generally don't support TRIM,
6 >
7 > This, I believe, is a problem with the ATA spec. I don't understand
8 > what's going on, but something like for these drives you need v4 of the
9 > spec, and only v3 is finalised. Various people have pointed out holes in
10 > this theory, so you don't need to add to them :-) But yes, I do
11 > understand that apparently there is no official standard way to send a
12 > trim to these drives ...
13
14 You might be right, but I thought that some drive-managed SMR drives
15 did support TRIM. It seems just as likely that TRIM support was not
16 implemented to conceal the fact that the drives are SMR.
17
18 >
19 > > so even repeated sequential writes
20 > > can be a problem because the drive doesn't realize that after you send
21 > > block 1 you're going to send blocks 2-100k all sequentially. If it
22 > > knew that then it would just start overwriting in place obliterating
23 > > later tracks, since they're just going to be written next anyway.
24 >
25 > No it can't do that. Because when it overwrites the end of the file it
26 > will be obliterating other random files that aren't going to be
27 > overwritten ...
28
29 Yes and no.
30
31 First, all but the last few tracks can definitely be written without
32 worry. The last few tracks might need to be cached but that is far
33 less seeking than caching the whole thing.
34
35 Second, if the writes end on an SMR zone boundary, then nothing will
36 need rewriting. This is of course how things are handled on
37 host-managed SMR drives - you just try to avoid the partial writes in
38 the first place.
39
40 >
41 > > Instead this drive is going to cache every write until it can
42 > > consolidate them, which isn't terrible but it still turns every seek
43 > > into three (write buffer, read buffer, write permanent - plus updating
44 > > metadata).
45 >
46 > Which IS terrible if you don't give the drive down-time to flush the
47 > buffer ...
48
49 It is less terrible than completely random writes, which is my point.
50 The drive requires far less time to flush the buffer if it is doing
51 large sequential writes, because only tail ends of a few regions might
52 need to be preserved.
53
54 >
55 > > If they weren't being sneaky they could have made it
56 > > drive-managed WITH TRIM so that it worked more like an SSD where you
57 > > get the best performance if the OS uses TRIM, but it can fall back if
58 > > you don't. Sequential writes on trimmed areas for SMR should perform
59 > > identically to writes on CMR drives.
60 >
61 > You're forgetting one thing - rewriting a block on SSD or CMR doesn't
62 > obliterate neighbouring blocks
63
64 Actually, SSDs have exactly the same problem - you cannot rewrite one
65 block on an SSD without obliterating neighboring blocks. The
66 differences are:
67
68 1. The size of these regions is much smaller, so the amount of data
69 that needs to be read and rewritten is much smaller. One block of
70 rewrite might be amplified to hundreds of kilobytes, not hundreds of
71 megabytes.
72 2. SSDs have no seek penalties, so the cost of these extra
73 reads+writes are much lower in absolute terms, but you're still
74 getting write amplification.
75 3. The SSDs aren't accumulating a large cache over time that can
76 cause performance to hit a wall for a long time. The SSD just delays
77 every write it gets as needed, because these write delays all the time
78 aren't as noticeable.
79 4. SSDs clearly advertise these issues and filesystems were updated
80 to support TRIM and mitigate them before they were adopted en masse.
81
82 #4 is really a big one. Filesystems that aren't optimized for SSD can
83 have very noticeable performance drops. Now, that is all relative - a
84 non-aware filesystem on SSD is still going to perform way better than
85 it does on any hard drive, so people switching to SSD from hard drives
86 are still going to be very happy. If you are doing benchmarking
87 though you'll definitely see an issue if you're doing random writes on
88 SSDs without a filesystem that supports TRIM/etc.
89
90 > ... with SMR for every track you rewrite
91 > you have to salvage the neighbouring track too ...
92
93 More than just one neighboring track. It really is the same issue as
94 SSD, except:
95
96 1. All the issues are amplified by the seek latency of hard drives.
97 2. The overall move from CMR->SMR is 100% downside in performance,
98 compared to the move from CMR->SSD where the downside is offset by a
99 much larger upside, so even a dumb implementation feels like a massive
100 improvement.
101
102 In any case, none of this really changes the fact that drive-managed
103 SMR really shouldn't be a thing at all, and it certainly shouldn't be
104 an unlabeled "feature." SMR should have just been introduced as
105 host-managed as a way to offer cheaper storage for those who have the
106 use cases and filesystems that can manage it. There is nothing wrong
107 with tape for storage, but if you stuck a tape drive preloaded with a
108 tape in a box that could speak ATA and called it a USB3 external "hard
109 drive" you'd drive people crazy.
110
111 --
112 Rich