LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-18-2017, 06:02 AM   #1
Gugur
Member
 
Registered: Apr 2017
Location: Spain
Distribution: Debian
Posts: 58

Rep: Reputation: 7
Dude necessary time to do dd if=/dev/urandom of=/dev/sdx


I want to encrypt my slackware in my notebook (i5 2520, 1TB HDD 5400rpm , 8 GB ram).

How approximate time it is necesarry to urandom 1 TB of disk?

Thanks.
 
Old 11-18-2017, 06:10 AM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
I hope you understand you don't encrypt the disk, but overwrite it with random characters.

The specific answer to your question is "long", likely "very long", and maybe even "extremely long".

Why don't you just try to fill, say a 100 MB, file with random characters. You measure that period of time and multiply it with 10,000.

Really, LQ is not the GUI version of dc.

jlinkels
 
2 members found this post helpful.
Old 11-18-2017, 08:01 AM   #3
tazza
Member
 
Registered: Jul 2005
Distribution: Slackware64 -current
Posts: 114

Rep: Reputation: 31
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.

Last edited by tazza; 11-18-2017 at 08:04 AM.
 
Old 11-18-2017, 08:37 AM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
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.

Last edited by GazL; 11-18-2017 at 08:38 AM.
 
Old 11-18-2017, 09:10 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by GazL View Post
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
That will run at the speed of your disk.
 
3 members found this post helpful.
Old 11-18-2017, 09:47 AM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by rknichols View Post
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
 
Old 11-18-2017, 10:05 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Intel(R) Core(TM) i3-5157U CPU @ 2.50GHz

Code:
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.

Last edited by GazL; 11-18-2017 at 10:10 AM.
 
Old 11-18-2017, 10:27 AM   #8
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,177

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
hmmmm -- 8-core AMD?
Attached Thumbnails
Click image for larger version

Name:	urandom.png
Views:	204
Size:	83.8 KB
ID:	26338  
 
Old 11-18-2017, 10:44 AM   #9
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by Gerard Lally View Post
hmmmm -- 8-core AMD?
Very old kernel. /dev/urandom has probably undergone much change since 4.4.
 
Old 11-18-2017, 12:27 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by GazL View Post
Very old kernel. /dev/urandom has probably undergone much change since 4.4.
That must be the explanation. Yes, the CentOS 6 machine I used for my test is based on a really old kernel (2.6.32).
 
Old 11-18-2017, 12:48 PM   #11
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
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
 
Old 11-18-2017, 02:43 PM   #12
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
bassmadrigal --

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.
 
Old 11-18-2017, 04:08 PM   #13
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Rep: Reputation: 201Reputation: 201Reputation: 201
Strange with the AMD times posted in this threads.
I tried on my AMD laptop from 2013 with AMD A10-5750M Richland 4-core APU.
Code:
time dd if=/dev/urandom of=/dev/null bs=1MB count=1000
1000+0 poster in
1000+0 poster ut
1000000000 byte (1,0 GB, 954 MiB) kopierade, 6,08544 s, 164 MB/s

real    0m6,140s
user    0m0,005s
sys     0m6,047s
 
Old 11-19-2017, 06:27 AM   #14
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
All --

The common denominator for the speed of the dd on /dev/urandom seems to be the Kernel Version ?

My 4.4.99 kernel consistently gets only 14.7 MB/sec while other users with newer kernels are getting much greater rates.

I've done a little reading and this Article on lwn.net: Replacing /dev/urandom was a good jumping off point.

Some of the links were especially handy ( https://lwn.net/Kernel/Index/#Random_numbers, and https://lkml.org/lkml/2016/5/2/52 )

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 ?

-- kjh
 
4 members found this post helpful.
Old 11-19-2017, 07:14 AM   #15
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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.
 
  


Reply

Tags
random



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dd if=/dev/urandom of=/dev/hda2 bs=1M doesn't work Melsync Linux - General 16 05-19-2014 06:36 PM
udev rule to rename /dev/sdx as /dev/sdr does not work :-( on OS 11.2 tkmbe SUSE / openSUSE 2 05-10-2012 01:53 AM
[SOLVED] Stupidly ran "cat /dev/urandom > /dev/mem", worried I broke firmware crosstalk Linux - Hardware 2 10-25-2010 05:27 PM
[SOLVED] wiping HDD using /dev/urandom versus /dev/zero, a theoretical question H_TeXMeX_H Linux - General 6 06-29-2009 06:55 AM
/dev/random and /dev/urandom pool(s)? kpeirce Linux - Software 2 01-31-2006 06:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration