• Rustmilian@lemmy.world
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            1 year ago

            sudo cat /dev/urandom > /dev/*
            Or
            sudo dd if=/dev/urandom of=/dev/sda bs=4k conv=notrunc,noerror

            P.s. sudo cat /dev/urandom > /dev/* can cause physical damage to all hardware components, not just destroy your drives data.

              • Rustmilian@lemmy.world
                link
                fedilink
                English
                arrow-up
                3
                ·
                edit-2
                1 year ago

                It blasts all virtual device files that directly represent the hardware of the system; from disks to audio devices and so on; with extremely random data potentially causing irreversible damage.

              • z3bra@lemmy.sdf.org
                link
                fedilink
                arrow-up
                1
                ·
                1 year ago

                Well as I see it, it will just do a lot of write operations to your disk, which might eventually damage it if you do it a lot (just like any write operation done on a disk). However, this specific command isn’t bad per se, and is even technically a good thing to do for preparing to full disk encryption.

                • barsoap@lemm.ee
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  1 year ago

                  We aren’t in the days of olde any more were disks would execute every random order you give them without thought… also, writing to /dev isn’t going to do that it’s simply going to give the disks write orders, /dev is quite a bit less raw than the firmware interfaces (SATA etc).

                  What you’re really doing here is fuzzing both the kernel and device firmware. You might find a bug but finding bugs doesn’t break things it just lays bare how stuff was always broken. Typically nothing a hard reset won’t fix.

                  • z3bra@lemmy.sdf.org
                    link
                    fedilink
                    arrow-up
                    2
                    ·
                    edit-2
                    1 year ago

                    I didn’t come up with this idea myself, this is straight from OpenBSD disk setup guide (which I personally trust as a good source of info) :

                    Encrypting External Disks

                    This section explains how to set up a cryptographic softraid volume for an external USB drive. An outline of the steps is as follows:

                    • Overwrite the drive’s contents with random data

                    […]

                    # dd if=/dev/urandom of=/dev/rsd3c bs=1m
                    
              • Rustmilian@lemmy.world
                link
                fedilink
                English
                arrow-up
                1
                ·
                edit-2
                1 year ago

                Sudo is for getting the necessary perms to write the data to the location after the > operator. Cat is just super fast, faster than dd infact as it’s not actually intended to write to disks, only to stout. We want as much speed as possible to do as much damage as possible by increasing our chances of trigging bugs.