Other dd vs. gshred for deleting disk

hruodr

Well-Known Member

Reaction score: 38
Messages: 250

Three nice commands:

dd if=/dev/zero of=/dev/ada1
pkg install coreutils
gshred --verbose /dev/ada1
gstat


I tried the first to delete an about 200 GB disk. I saw with the fourth that it will take about 17 hours, I installed with the second gshred and run the third, I saw with the fourth that it will take about 1 hour.

Why?! You can tell me it is about the (default) blocksize in dd, but why this enorm difference?!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,091
Messages: 29,244

You can tell me it is about the (default) blocksize in dd, but why this enorm difference?!
It probably also has to do with using random numbers or zeros. And how random those random numbers are. Generating a large amount of random numbers reliably is a rather slow process.
 
OP
OP
H

hruodr

Well-Known Member

Reaction score: 38
Messages: 250

SirDice, but it is the faster shred that use random numbers!
 

leebrown66

Well-Known Member

Reaction score: 128
Messages: 389

Try giving dd a larger blocksize to work with:
dd if=/dev/zero of=/dev/ada1 bs=1m
Otherwise it'll write single sectors at a time.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,091
Messages: 29,244

SirDice, but it is the faster shred that use random numbers!
I tried the first to delete an about 200 GB disk. I saw with the fourth that it will take about 17 hours, I installed with the second gshred and run the third, I saw with the fourth that it will take about 1 hour.
I can't make sense of this. Your order in the text doesn't add up. You refer to the "fourth" twice, with different times (17 hours and 1 hour), and "fourth" on your list is gstat(1).

I suggest you make a proper table, with the exact command on each line and specifying how long it took.
 

VladiBG

Aspiring Daemon

Reaction score: 212
Messages: 536

camcontrol(8)
Code:
sanitize     Issue the SCSI    SANITIZE command to the    named device.

         WARNING! WARNING! WARNING!

         ALL data in the cache and on the disk will be destroyed or
         made inaccessible.  Recovery of the data is not possible.
         Use extreme caution when issuing this command.

         The `sanitize'    subcommand takes several arguments that    modify
         its default behavior.    The -q and -y arguments    can be useful
         for scripts.

         -a operation
             Specify the sanitize operation    to perform.

             overwrite       Perform an overwrite    operation by
                       writing a user supplied data    pat-
                       tern    to the device one or more
                       times.  The pattern is given    by the
                       -P argument.     The number of times
                       is given by the -c argument.

             block           Perform a block erase operation.
                       All the device's blocks are set to
                       a vendor defined value, typically
                       zero.

             crypto           Perform a cryptographic erase oper-
                       ation.  The encryption keys are
                       changed to prevent the decryption
                       of the data.

             exitfailure       Exits a previously failed sanitize
                       operation.  A failed    sanitize oper-
                       ation can only be exited if it was
                       run in the unrestricted completion
                       mode, as provided by    the -U argu-
                       ment.

         -c passes
             The number of passes when performing an `overwrite'
             operation.  Valid values are between 1    and 31.     The
             default is 1.

         -I     When performing an `overwrite'    operation, the pattern
             is inverted between consecutive passes.

         -P pattern
             Path to the file containing the pattern to use    when
             performing an `overwrite' operation.  The pattern is
             repeated as needed to fill each block.

         -q     Be quiet, do not print    any status messages.  This
             option    will not disable the questions,    however.  To
             disable questions, use    the -y argument, below.

         -U     Perform the sanitize in the unrestricted completion
             mode.    If the operation fails,    it can later be    exited
             with the `exitfailure'    operation.

         -r     Run in    ``report only''    mode.  This will report    status
             on a sanitize that is already running on the drive.

         -w     Issue a non-immediate sanitize    command.  By default,
             camcontrol issues the SANITIZE    command    with the imme-
             diate bit set.     This tells the    device to immediately
             return    the sanitize command, before the sanitize has
             actually completed.  Then, camcontrol gathers SCSI
             sense information from    the device every second    to
             determine how far along in the    sanitize process it
             is.  If the -w    argument is specified, camcontrol will
             issue a non-immediate sanitize    command, and will be
             unable    to print any information to let    the user know
             what percentage of the    disk has been sanitized.

         -y     Do not    ask any    questions.  By default,    camcontrol
             will ask the user if he/she really wants to sanitize
             the disk in question, and also    if the default sani-
             tize command timeout is acceptable.  The user will
             not be    asked about the    timeout    if a timeout is    speci-
             fied on the command line.
 
OP
OP
H

hruodr

Well-Known Member

Reaction score: 38
Messages: 250

SirDice, perhaps I made some errors, but the sense must be clear: simple schred is faster than simple dd. That is all.

VladiBG, next time I try it.
 
Top