Am 25.10.23 um 17:42 schrieb Simon Becherer:
Am 25.10.23 um 16:42 schrieb Aaron Digulla:
Am 25.10.23 um 15:36 schrieb Simon Heimbach:
Hi everybody,
does anyone know how to securely format a btrfs-partition[1]? I have an unused SSD with a former root partition that I have to return and I want to make sure that all data is erased before giving it back.
The SSD controller will map arbitrary regions to arbitrary blocks of the disk, so just overwriting every block isn't working as you'd expect - usually, the controller will send writes to new, unused blocks and leave the old data alone to spread wear evenly.
Only for my understanding: (i have no deeper idear how ssd's work) i know that ssd's have !some! size more to map bad parts. but: did a ssd have several times the size that is printed on the cover (and shown if i use partimage/gparted?)
Sorry, I didn't phrase that well. The SSD will have a small percentage (say 1-5%, I don't know for sure) of blocks as spares. Unlike normal hard disks, those spares are used all the time. In a traditional hard disk, when a block starts to fail, the controller will map a spare. So they are kept only for emergencies. With SSDs, the controller remembers how often each block was written to. When you write new data, it will find a free block with the least usage and write the data there and remember "I saved the data for block 15 in the real memory address 0x... + increment the usage counter; the old real memory is now in the free pool". That way, every memory block will get roughly the same number of writes, even if you write block 15 a million times. So when you write random data to the whole disk, the disk will look as it was erased but behind the scenes, the most used blocks will have been replaced by least used ones and some of the old data is still there. Usually, this is no problem unless you have strict security related rules. For example, there is a danger that small documents might fit into a single block and survive. That means somewhere in the storage hardware, you can still find some of your data. Note that there is no way to read this data using normal ATA commands. Only the controller knows where those are. But for high security scenarios, this is not acceptable because attackers will open the case and read the chips directly and then see everything. So for most people, overwriting the whole disk with random data should work well enough. The drawback is that this is slow and adds a lot of wear to the cells since the controller can't optimize this "erase" operation - it can't tell what you're trying to achieve. That is why the "secure erase" command exists. It allows to SSD controller to do this fast and secure way, whatever that means for your specific hardware. This should also clean any spare blocks, so nothing is left behind. Regards, -- Aaron "Optimizer" Digulla a.k.a. Philmann Dark "It's not the universe that's limited, it's our imagination. Follow me and I'll show you something beyond the limits." http://blog.pdark.de/