[SOLVED] Dude necessary time to do dd if=/dev/urandom of=/dev/sdx
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
With dd ram is pretty much irrelevant- and your question is open ended... You've left out BS= so are you writing 1kb, 1MB?
Guessing you are using kali and trying to figure things out for a question like this... sorry but it won't cut it around these parts. Maybe go to Ubuntu forums.
Edit to add: yes I know the default size before anyone jumps on me. But no one... I mean no one uses default size. 1TB drive would take an eternity.
Using /dev/urandom shouldn't be too bad, the bottleneck will most likely be the speed of your disk. 5400rpm disks tend not to be the fastest performers: my guess would be around 4-5 hours.
Use /dev/random and you'll see the heat-death of the universe before it completes.
P.S. Prefilling with random bytes is an extra step, that's not strictly necessary. You might want to consider skipping it.
Using /dev/urandom shouldn't be too bad, the bottleneck will most likely be the speed of your disk. 5400rpm disks tend not to be the fastest performers: my guess would be around 4-5 hours.
No, /dev/urandom is actually pretty slow. You'll get maybe 15 MB/s on a fast machine. I get 13 MB/s with an Intel Core i5 @ 3.5 GHz. That works out to over 20 hours to fill 1 TB.
You want to go faster? Encrypt zeros with a random key and use that to fill the disk.
Code:
cryptsetup open --type plain -d /dev/urandom /dev/<block-device> to_be_wiped
dd if=/dev/zero of=/dev/mapper/to_be_wiped bs=1M
cryptsetup close to_be_wiped
No, /dev/urandom is actually pretty slow. You'll get maybe 15 MB/s on a fast machine. I get 13 MB/s with an Intel Core i5 @ 3.5 GHz.
Hmm, I see 224 MB/s, am I counting wrong?
Code:
$ grep 'model name' /proc/cpuinfo
model name : Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz
model name : Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz
$ time dd if=/dev/urandom of=/dev/null bs=1MB count=1000
1000+0 records in
1000+0 records out
1000000000 bytes (1.0 GB, 954 MiB) copied, 4.46424 s, 224 MB/s
real 0m4.466s
user 0m0.000s
sys 0m4.440s
test@ws1:~$ time dd if=/dev/urandom of=/dev/null bs=1MB count=1000
1000+0 records in
1000+0 records out
1000000000 bytes (1.0 GB, 954 MiB) copied, 6.05859 s, 165 MB/s
real 0m6.065s
user 0m0.005s
sys 0m6.060s
My machine isn't quite that fast, but 165MB/s is still much faster than the write speed of my disk.
That's odd... maybe it's an AMD thing? Ryzen 7 1800x with an NVMe drive only getting around 75MB/s
Code:
jbhansen@craven-moorhead:/share/tv/documentary$ grep 'model name' /proc/cpuinfo
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
model name : AMD Ryzen 7 1800X Eight-Core Processor
jbhansen@craven-moorhead:/share/tv/documentary$ time dd if=/dev/urandom of=/dev/null bs=1MB count=1000
1000+0 records in
1000+0 records out
1000000000 bytes (1.0 GB, 954 MiB) copied, 13.6742 s, 73.1 MB/s
real 0m13.675s
user 0m0.000s
sys 0m13.663s
In comparison to writing a tempfile with 8GB of zeros:
Code:
jbhansen@craven-moorhead:~$ time dd if=/dev/zero of=tempfile bs=1M count=8096 conv=fdatasync,notrunc status=progress
8474591232 bytes (8.5 GB, 7.9 GiB) copied, 5.00032 s, 1.7 GB/s
8096+0 records in
8096+0 records out
8489271296 bytes (8.5 GB, 7.9 GiB) copied, 5.33874 s, 1.6 GB/s
real 0m5.340s
user 0m0.000s
sys 0m5.037s
I am jealous ... My Intel i7-6700K at 4GHz is ~5 x slower than your AMD Ryzen 7 1800X
-- kjh
Code:
$ uname -a
Linux kjhlt6 4.4.99.kjh #1 SMP Sat Nov 18 07:55:01 CST 2017 x86_64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz GenuineIntel GNU/Linux
$ count-proc
8 x Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
$ time dd if=/dev/urandom of=/dev/null bs=1MB count=1000
1000+0 records in
1000+0 records out
1000000000 bytes (1.0 GB, 954 MiB) copied, 68.1852 s, 14.7 MB/s
real 1m8.187s
user 0m0.001s
sys 1m8.180s
This is count-proc if you want it ...
Code:
#!/bin/sh
PrgNam="`basename $0`"
DirNam="`dirname $0`"
if [ "$DirNam" = "." ]
then
DirNam="`pwd`"
elif [ "$DirNam" = ".." ]
then
DirNam="`pwd`"
DirNam="`dirname $DirNam`"
elif [ "$DirNam" = "" ]
then
DirNam="`whichone $PrgNam`"
DirNam="`dirname $DirNam`"
fi
TabStop=0
Usage ()
{
ErrNum=$1
shift
[ $# -gt 0 ] && echo -e "\n$*" >&2
echo "usage: $PrgNam [ -t TabOver ] " >&2
cat <<Usage_EOF >&2
$PrgNam - count 'model name' lines in /proc/cpuinfo and
write a summary to stdout
Options:
-t <<TabStop>> - tab over <<TabStop>> spaces before printing summary.
default = $TabStop
Usage_EOF
exit $ErrNum
}
while getopts ht: junk 2>/dev/null
do
case $junk in
t) TabStop="$OPTARG"
;;
h) Usage 0
;;
*) Usage 1
;;
esac
done
shift `expr $OPTIND - 1`
[ ! -f /proc/cpuinfo ] && echo '' && exit 1
gawk '
BEGIN {
TabStop = "'"$TabStop"'" +0
Ind = ( TabStop > 0 ) ? sprintf( "%" TabStop "s", "" ) : ""
FS = ":" ;
LookFor = "^ *model name" ;
}
{
if ( ! match( $0, LookFor ))
{
next ;
}
CPU = $2 ;
gsub( / */, " ", CPU )
if ( ! ( CPU in CPUAry ))
{
CPUAry[ CPU ] = 0 ;
}
CPUAry[ CPU ] ++ ;
}
END{
for ( CPU in CPUAry )
{
printf( "%s%d x%s\n", Ind, CPUAry[ CPU ], CPU ) ;
}
exit( 0 )
}' /proc/cpuinfo
exit $?
Last edited by kjhambrick; 11-18-2017 at 02:52 PM.
Anyhow, more than I wanted to know but interesting none-the-less and reading between the lines, maybe it was the 4.7 Kernel that introduced the improvements in /dev/urandom ?
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
Doesn't /dev/urandom (and /dev/ramdom for that matter) run faster depending upon how much entropy there is to call upon, ie. how mnay "random" things the system is doing rather than being particularly processor or anything else bound?
Code:
$ grep 'model name' /proc/cpuinfo
model name : AMD FX-8370 Eight-Core Processor
model name : AMD FX-8370 Eight-Core Processor
model name : AMD FX-8370 Eight-Core Processor
model name : AMD FX-8370 Eight-Core Processor
model name : AMD FX-8370 Eight-Core Processor
model name : AMD FX-8370 Eight-Core Processor
model name : AMD FX-8370 Eight-Core Processor
model name : AMD FX-8370 Eight-Core Processor
$ time dd if=/dev/urandom of=/dev/null bs=1MB count=1000
1000+0 records in
1000+0 records out
1000000000 bytes (1.0 GB, 954 MiB) copied, 3.27047 s, 306 MB/s
real 0m3.273s
user 0m0.001s
sys 0m3.271s
If there is no data on the drive there's no need to overwrite with urandom. Even then I'd be tempted just to overwrite with zeros as, to my knowledge, nobody has been able to recover data overwritten with zeros on a modern hard drive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.