1 |
2013/5/6 Alan McKinnon <alan.mckinnon@×××××.com> |
2 |
|
3 |
> On 06/05/2013 20:36, Hinnerk van Bruinehsen wrote: |
4 |
> > On Mon, May 06, 2013 at 07:34:20PM +0200, Volker Armin Hemmann wrote: |
5 |
> >> emm - no. Wear leveling does not need any spare blocks. A lot of drives |
6 |
> >> do have spare blocks, but those are never the same size of the original |
7 |
> >> size (at least not on drives you can buy for a sensible amount of |
8 |
> >> money). More like 120+8 or 160+16 or 256+16. |
9 |
> >> |
10 |
> >> The spare blocks are used like on a hdd: some block goes bad, another |
11 |
> >> one is mapped in. |
12 |
> >> |
13 |
> >> Since the sdd firmware does not know if something was deleted or not* - |
14 |
> >> it does know shit about filesystems**, you can of course dd an image, if |
15 |
> >> you want to. Just like on a hdd. |
16 |
> >> |
17 |
> >> *there are drives that do garbage collection without TRIM for fat and or |
18 |
> >> ntfs.. so they seem to know a bit about filesystems. |
19 |
> >> |
20 |
> >> ** and this is why TRIM exists in the first place. To tell the drive: |
21 |
> >> yes, this data is gone. You don't need to care about it anymore. |
22 |
> > |
23 |
> > |
24 |
> > The actual numbers were made up to make the point (maybe I should have |
25 |
> > stated that in my OP). According to [1] they are normally between 7% - |
26 |
> > 37%. |
27 |
> > Linux supports TRIM since Kernel 2.6.28. It's supported for several |
28 |
> > filesystems (Ext4, Btrfs, FAT, GFS2 and XFS) but must be enabled via the |
29 |
> > discard mount option. I don't have definitive information for Windows |
30 |
> > but it seems to be supported by at least Windows 7 (as far as I can tell |
31 |
> > without any user interaction). |
32 |
> > Since the "deletion" happened under Windows I made a guess that it is |
33 |
> > not totally unreasonable that dd may not work (if the deleted data would |
34 |
> > have been "TRIMed"). |
35 |
> > |
36 |
> > |
37 |
> > |
38 |
> > [1] |
39 |
> http://www.lsi.com/downloads/Public/Flash%20Storage%20Processors/LSI_PRS_FMS2012_TE21_Smith.pdf |
40 |
> > |
41 |
> |
42 |
> |
43 |
> |
44 |
> A delete on an SSD is a very expensive operation, to my mind it seems |
45 |
> completely unreasonable to think that Windows would try and clear many |
46 |
> tens of GB just because it trashed a partition table. It would take |
47 |
> _hours_ to clear those blocks. |
48 |
> |
49 |
> By far the easiest route would be to just do what is done for spinning |
50 |
> disks - write the partition table, leave whatever junk is in the cells |
51 |
> intact until the partition is formatted and actual data is written to |
52 |
> the fs. |
53 |
> |
54 |
> As your results show, this is indeed what did happen. |
55 |
> |
56 |
> -- |
57 |
> Alan McKinnon |
58 |
> alan.mckinnon@×××××.com |
59 |
> |
60 |
> |
61 |
> |
62 |
|
63 |
Ok, let me sum up what I understood about the working of SSDs, please |
64 |
correct me if I'm wrong at some point. |
65 |
|
66 |
- The SSD stores what internal cell is allocated as a sector for the block |
67 |
device representation on the SATA port. |
68 |
- When a file is deleted the file system marks the block device sectors as |
69 |
free and sends the TRIM command to the SSD and the SSD really frees the |
70 |
underlying cell / breaks the cell - section allocation. |
71 |
- Some SSDs have idle TRIM as described in http://en.wikipedia.org/wiki/TRIM to |
72 |
use the advantage at systems that doesn't have the file system option |
73 |
- A write operation can write to sectors which are not TRIMed jet |
74 |
|
75 |
- When some program overwrites the partition table the sectors of the |
76 |
partition aren't touched, so the SSD must be aware of the partition table |
77 |
to trim these sectors |
78 |
- A new partition can be formatted without trimming the sectors |
79 |
|
80 |
- So when creating a new partition on the same sectors used before, the |
81 |
sector cell allocation in the SSD is still the same, and no data is lost, |
82 |
except the SSD is aware of the partition table to know which sectors can be |
83 |
TRIMed |
84 |
|
85 |
|
86 |
|
87 |
-- |
88 |
Mit freundlichen Grüßen / Best regards |
89 |
|
90 |
Randolph Maaßen |