I understand traditional methods don’t work with modern SSD, anyone knows any good way to do it?

    • Goat@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      No, “overwritten” data doesn’t actually get erased right away due to wear levelling. As SSDs get esoterically smart with how they prevent unnecessary erase operations, there’s no way to be sure without secure erase.

    • Scholars_Mate@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      7 months ago

      No. Modern SSDs are quite sophisticated in how they handle wear leveling and are, for the most part, black boxes.

      SSDs maintain a mapping of logical blocks (what your OS sees) to physical blocks (where the data is physically stored on the flash chips). For instance, when your computer writes to the logical block address 100, the SSD might map that to a physical block address of 200 (this is a very simplified). If you overwrite logical block address 100 again, the SSD might write to physical block address 300 and remap it, while not touching the data at physical block address 200. This let’s you avoid wearing out a particular part of the flash memory and instead spread the load out. It also means that someone could potentially rip the flash chips off the SSD, read them directly, and see data you thought was overwritten.

      You can’t just overwrite the entire SSD either because most SSDs overprovision, e.g. physically have more storage than they report. This is for wear leveling and increased life span of the SSD. If you overwrite the entire SSD, there may be physical flash that was not being overwritten. You can try overwriting the drive multiple times, but because SSDs are black boxes, you can’t be 100% sure how it handles wear leveling and that all the data was actually overwritten.

  • Goat@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    A special feature known as SSD secure erase. The easiest OS-independent way is probably via CMOS setup – modern BIOSes can send secure erase to NVM Express SSDs and possibly SATA SSDs.

      • WhatAmLemmy@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        7 months ago

        Most SSD/flash secure erase methods involve the storage having full disk encryption enabled, and simply destroying the encryption key. Without the encryption key the data can’t be deciphered even with the correct password, as the password was only used to encrypt the encryption key itself. This is why you can “factory reset” an iPhone or Android in seconds.

      • mark3748@sh.itjust.works
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        It is the only approved method for data destruction for the several banks and government agencies I support. If they trust it, I trust it.

        I have checked a couple of times out of curiosity, after a secure erase the drive is as clean as if it had been DBANed. Sometimes things are standards because they work properly.

      • Skull giver@popplesburger.hilciferous.nl
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        7 months ago

        Secure Erase usually works by encrypting all data before writing it to disk, using a key stored in a special area on the SSD. Reading and writing to the drive is transparent, the OS doesn’t notice any encryption, but on a hardware level the data isn’t plainly readable.

        When you issue an erase command, the SSD throws out the old key and generates a new one. All data on the drive instantly becomes unreadable garbage.

        I say usually, because not all SSDs work that way. I wouldn’t trust Secure Erase on some crappy TEMU/Wish/Aliexpress SSD. Some drives will instead drain every cell, effectively erasing the contents in one single operation. As long as reserve space and relocated memory gets wiped as well (it should, if this is done at the hardware level), this is also perfectly safe.

        Encryption also protects data against the types of duplication and relocation an SSD will do by itself to balance write+erase cycles across the SSD’s cells. If you were to try to overwrite the SSD, a significant chunk of old cells would still contain data, because the OS doesn’t get access to the raw flash storage.

        With encryption, it doesn’t really matter how many bytes are still present on the drive, because unless someone cracked open the SSD and extracted the key before, there’s no making sense of any of that data.

        If you don’t trust your SSD’s encryption, you can use the same practice to protect your files: before you store any interesting files on it, enable disk encryption and use a TPM or VERY strong password for the encryption key (you may need to disable uploading a recovery key to the cloud depending on your OS for maximum security). Taken out of your PC, without some key backup in hand, the drive is completely unreadable and can be resold without worry. This also comes with the downside that if your PC breaks and your key is lost, you won’t be able to get to the data, of course.

        • User_already_exist@lemmy.worldOP
          link
          fedilink
          arrow-up
          0
          ·
          7 months ago

          Thanks for this informative answer. Then it would make sense that it took only 1 second, then again, I have a modern Asus motherboard (AM5) with a Western Digital NVMe drive, and that drive isn’t listed as Secure Erase compatible on Asus motherboard. I will download the WD dashboard and do it that way, I didn’t know it existed before I posted this question.

          • Skull giver@popplesburger.hilciferous.nl
            link
            fedilink
            English
            arrow-up
            0
            ·
            7 months ago

            SSD erasure is a standard(ish) command. It’s best not to assume it works if there’s no tested compatibility, but I also wouldn’t expect it not to work, unless you notice that the data on the drive still exists (i.e. you boot the machine and there’s already a partition on there).

            There are actually two types of erase commands for NVMe drives (“cryptographic erase” for the encryption method I mentioned, and “block erase” for actually wiping all cells). There’s a command for “user data erase” that lets the SSD decide which of the two options to use, which I assume most tools will do.

            I didn’t know WD had a tool, that’s probably your best bet! While you’re at it, also check for firmware updates, it may just help the next owner enjoy the drive for a while longer if you’ve got a buggy SSD that you didn’t know about.

  • Greg Clarke@lemmy.ca
    cake
    link
    fedilink
    English
    arrow-up
    0
    ·
    7 months ago

    Fill the drive 100% using data duplicator then delete everything on the drive. Repeat a few times to ensure you scrub all blocks. There is no need to physically destroy the drive.

    • ramble81@lemm.ee
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      That doesn’t work with SSDs anymore. Their controllers map “bad” blocks which are put in an RO state and writes no longer go there but data still exists. There is usually a buffer of extra space so you do see the capacity loss, but if you bypass the controller you can still read the data there.

      • Greg Clarke@lemmy.ca
        cake
        link
        fedilink
        English
        arrow-up
        0
        ·
        7 months ago

        That’s fair, I can appreciate an attack vector in cases where there are bad blocks and the drive was unencrypted. Luckily bad blocks are less common with modern SSDs and assuming the disk was encrypted, a few bad blocks are unlikely to expose any contents. So knowing the number of bad blocks and what data was stored would inform if a fill and empty approach would be suitable to sanitize the drive.

  • sylver_dragon@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    7 months ago

    This article covers several methods. Personally, I’d look for a BIOS based tool first, as that would be free and easiest. After that, the Diskpart Clean All command is probably fine for anything other than Top Secret data which a government based threat actor would be willing to put a lot of resources into recovering. If it’s just your tax documents and porn archive, no one is going to care enough to dig out anything which that command might have left behind.

    • Skull giver@popplesburger.hilciferous.nl
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      Secure Erase doesn’t need to happen from the BIOS, if your BIOS doesn’t offer it, there’s a good chance you can still do it from within your OS. Don’t do it to the drive your OS is running from, though, that’ll probably cause issues.

      • krash@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        If running linux, what command should be run? Shred isn’t viable on a SSD, as it will only tear them down. Shred was designed with HDD in mind.

        • Skull giver@popplesburger.hilciferous.nl
          link
          fedilink
          English
          arrow-up
          0
          ·
          7 months ago

          If you’re on a desktop or laptop, you should check the disk/partition manager tooling and see if there’s a button to do this for you. In Gnome, for example, it’s in Disks > three dots > Format Disk > Erase: secure erase. I’m sure KDE and other desktop environments with a complete suite of tools will also have something like this. If you find this option greyed out, check the instructions in the wiki article I link below about unlocking the drive. If it’s not there, there may be another GUI tool, or you could use the command line version.

          If you’re going command line, the exact procedure depends on the disk

          SATA disks

          Based on the Arch wiki

          Step 1: check if the disk is frozen

          Run sudo hdparm -I /dev/sdX | grep frozen (replace X with the drive name, of course, or use /dev/disk/by-* if you don’t know the right letter; should work with all of these commands) to check if it’s frozen. It should say “not frozen”, if it says “frozen”, put the computer to (S3) sleep and wake it again. That should usually do it.

          Step 2: set a password

          Simply put: sudo hdparm --user-master u --security-set-pass PasSWorD /dev/sdX. Don’t reboot without finishing all steps, some hardware is funky. Remember this password.

          Step 3: wipe the drive

          sudo hdparm --user-master u --security-erase PasSWorD /dev/sdX This can take a minute, it can take half an hour (less likely), don’t interrupt the process, definitely don’t turn off the computer.

          Step 4: remove the password

          To make sure people in the future can wipe the drive again, check if there’s still a password. Run sudo hdparm -I /dev/sdX and check for “not enabled” below “password”. If it’s still enabled, try running sudo hdparm --user-master u --security-disable PasSWorD /dev/sdX. With a password set, you will need to unlock the drive with the password you configured before the drive can be used, and most operating systems can’t deal with that automatically.

          NVMe disks

          Based on the same wiki article. Use /dev/nvmeX for the device specification, not /dev/nvmXnY, and obviously substitute for the device you actually want to wipe. You should be able to use paths like /dev/disk/by-id/nvme-Samsung_SSD_980_1TB_ABCDEFGHIJKLM as well, in case you don’t know the exact device name.

          Step 1: find capabilities

          sudo nvme id-ctrl /dev/nvmeX -H | grep -E 'Format |Crypto Erase|Sanitize' to find if the device supports formatting or sanitizing.

          Step 2.1: formatting

          Simply put: nvme format /dev/nvmeX -s 2 -n 0xffffffff to do a cryptographic erase. 0xffffffff will erase all namespaces, if multiple namespaces are supported; this is a bit mask, so you can select multiple individual namespaces if you want. If you don’t know what that means, just erase them all, or set use 1 instead of 0xffffffff if the command errors out.

          Step 2.2: sanitizing

          First run nvme sanitize-log /dev/nvmeX to check how long it’ll take, in estimated seconds, for a block erase or a crypto erase to finish, to help you estimate how long you’ll need to leave the computer on for.

          Step 2.2.a: cryptographic erase

          sudo nvme sanitize /dev/nvmeX -a start-crypto-erase will do a cryptographic erase. This should be pretty quick.

          Step 2.2.b: block erase

          sudo nvme sanitize /dev/nvmeX -a start-block-erase will do a block erase. This will can take multiple minutes, maybe longer, depending on your drive and the speed.

          Secure discard

          There’s also a tool called blkdiscard that can tell an SSD to securely discard blocks, if the device supports it, Something like sudo blkdiscard --secure /dev/disk/by-id/nvme-Samsung_SSD_980_1TB_ABCDEFGHIJKLM or sudo blkdiscard --secure /dev/disk/by-id/ata-Samsung_SSD_789_EVO_M.2_9999GB_ABCDEFGHIJLM should work for those.

  • frankyboi@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    6 months ago

    Install all your steam library to full your SSD. Should do the job. Empty the disk, rinse and repeat a few times.

  • Brkdncr@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago
    • Secure erase using the drive OEMs tool.
    • If you were using something like bitlocker then simply dump the key.
    • Wood chipper or some other form of absolute physical destruction.
  • WhatAmLemmy@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    7 months ago

    For all average user requirements that just involve backups, PII docs, your sex vids, etc (e.g. not someone who could be persecuted or prosecuted for their data) your best bet (other than physical destruction) is to encrypt every usable bit in the drive.

    1. Download veracrypt
    2. Format the SSD as exFAT
    3. Create a new veracrypt volume on the mounted exFat partition that uses 100% of available space (any format).
    4. open up a notepad and type out a long random ass throwaway password e.g. $-963,;@82??/@;!3?$.&$-,fysnvefeianbsTak62064$@/lsjgegelwidvwggagabanskhbwugVg, copy it, and close/delete without saving.
    5. paste that password for the new veracrypt volume, and follow the prompts until it starts encrypting your SSD. It’ll take a while as it encrypts every available bit one-by-one.

    Even if veracrypt hits a free space error at the end of the task, the job is done. Maybe not 100%, but 99.99+% of space on the SSD is overwritten with indecipherable gibberish. Maybe advanced forensics could recover some bits, but why the fuck would they go to that effort for a filthy commoner like yourself!?! You don’t really need to bother destroying the header encryption key (as apple and android products do when you wipe a device) as you don’t know the password and there isn’t a chance in hell you or anyone else is gonna guess, nor brute force, it.

    • Skull giver@popplesburger.hilciferous.nl
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      Because of wear management and the way flash storage works, overwriting disks is even more useless for wiping data than it was on hard drives. Even on spinning rust there were plenty of files in relocated sectors, but on SSDs you get relocation behaviour and copied files without any actual damage to the disk.

      You can overwrite a file on your SSD with random numbers supposedly filling the entire file’s space, but under the hood the SSD could be like “erasing this block would wear down the disk too much, let’s just copy the block some place else and map the data offset to this new set of cells”. Modern SSDs also have extra storage capacity so that wear leveling can be done without reducing your storage space in the process, and cells the SSD deems to be too unstable will be copied and unmapped. Their data will still be there, but it won’t be accessible to the computer, even if you overwrite the entire drive.

      If you want to erase data, physically destroy the disk. If you want to prevent having to erase data, encrypt it (it’s on by default in Windows, Mac, and most Linux distros) so you only need to destroy the encryption key to make the data unreadable.

      • otp@sh.itjust.works
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        If you want to keep/sell the drive…

        1. Fill up the rest of the usable space
        2. Encrypt the drive
        3. Throw away the encryption key/password
        4. Hard format (writing zeroes to every bit, sorry if that’s the wrong term

        Is that the best strategy? Or is anything outside of 2 and 3 redundant?

        • Skull giver@popplesburger.hilciferous.nl
          link
          fedilink
          English
          arrow-up
          0
          ·
          7 months ago

          “Best” depends on your needs.

          I’m not sure if filling up the entire drive is necessary. Nothing wrong with doing a dd if=/dev/urandom of=/dev/nvme1 to randomise the drive itself, but I don’t think most people are affected by the kind of information you can derive from what sectors are/aren’t written to.

          Writing zeroes to every bit is useless because of the automatic remapping; it mostly serves to wear down the device if you use decent encryption. There are only so many write+erase cycles each cell can go through before it breaks, so I try to avoid doing large writes on purpose. Try a secure erase from either your UEFI GUI, but good encryption prevents the need for a full format.

          Personally, I let my drives fill up over time. I trust LUKS enough to handle the encryption, and I don’t think anyone who’s going to be buying this SSD off me is going to send it off to a forensic data lab to analyse what the average size of the files I worked on was. So, my personal approach:

          1. Buy a drive from a reputable brand with no known obvious firmware bugs (Sandstorm, anyone?)
          2. Encrypt the drive
          3. Throw out backup key(s)
          4. Issue secure erase command
        • Brkdncr@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          7 months ago

          You can’t fill the drive. The drive decides when to use its buffered free storage blocks. It’s at the hardware level and only the Secure Erase command will clear it.

          • _edge@discuss.tchncs.de
            link
            fedilink
            arrow-up
            0
            ·
            7 months ago

            You fill up the usable space. Or the visible space. No one will disamble the device and read from the raw storage.

          • otp@sh.itjust.works
            link
            fedilink
            arrow-up
            0
            ·
            7 months ago

            Right, I read some more of the comments and realized that’s what some of the “unreported space” is used for. Makes sense, thanks!

      • WhatAmLemmy@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        7 months ago

        a) why the fuck would they go to that effort for a filthy commoner like yourself, and b) what are the chances that 0.01% of recoverable data contains anything useful!?!

        Nobody is gonna bother doing advanced forensics on 2nd hand storage, digging into megabytes of reallocated sectors on the off chance they to find something financially exploitable. That’s a level of paranoia no data supports.

        My example applies to storage devices which don’t default to encryption (most non-OS external storage). It’s analogous to changing your existing encrypted disks password to a random-ass unrecoverable throwaway.

        • Skull giver@popplesburger.hilciferous.nl
          link
          fedilink
          arrow-up
          0
          ·
          edit-2
          7 months ago

          When we’re talking SSDs, we’re not talking a fee megabytes of relocated sectors. We’re talking numbers between 4½-560GB of spare capacity, almost guaranteed to be used, especially if you start filling up the drive.

          If you’re assuming nobody is going to dig through the SSD, save yourself some time and issue a secure erase/crypto erase command and let the firmware figure it out. It’s faster and more reliable. If you have TRIM enabled (should be on by default on most operating systems), you may even be able to get away with simply clearing the recycling bin.

  • Skull giver@popplesburger.hilciferous.nl
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    Physical damage is the most reliable. Drill through the flash chips, chuck the whole thing into an old microwave, then throw it all in a fire.

    If you want to resell the SSD, use secure erase. If that doesn’t work (some broken firmware doesn’t erase on secure erase, you’ll know when you reboot and the data is still there), you can try overwriting all storage as a last resort.

    If the drive was encrypted, either with a hardware backed key or a very secure password, throw out the encryption key and delete the backup key. That should suffice, unless a powerful country with access to advanced quantum computers will be targeting you in the next ten or twenty years.

    Overwriting storage is rarely good enough to wipe all files, but there’s a good chance most of the files you want deleted will be gone. If all files on the drive are sensitive, you should’ve probably encrypted the drive (lesson for next time!) and shouldn’t rely on overwriting to actually erase the data you’re trying to destroy.