LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 07-16-2006, 08:29 AM   #1
Melsync
Member
 
Registered: Sep 2005
Posts: 75

Rep: Reputation: 15
dd if=/dev/urandom of=/dev/hda2 bs=1M doesn't work


I'm following the instructions to setup a loop device but I fail to fill a partition with random data.
Code:
dd if=/dev/urandom of=/dev/hda2 bs=1M
as root doesn't do anything, the command line stops there and nothing is written to /dev/hda2.

/etc/fstab mounts the device at boot:
Code:
/dev/hda2               /mnt/styo               vfat    user,defaults,umask=000 0 0
/mnt/styo remains unchanged.
Why? Thank you.
 
Old 07-16-2006, 09:32 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,164

Rep: Reputation: 238Reputation: 238Reputation: 238
Use strace to find out what dd is (perhaps not) doing:
Code:
# strace dd if=/dev/urandom of=/dev/hda2 bs=1M
 
Old 07-16-2006, 11:51 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: back to Arch
Posts: 16,659

Rep: Reputation: 425Reputation: 425Reputation: 425Reputation: 425Reputation: 425
How big is the partition that you are writing to? It may be that the command will take some time. Check and see that the disk access light starts flashing when you issue the command---that tells you that something is happening.
 
Old 07-16-2006, 12:20 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: Kennesaw, GA
Distribution: Ubuntu
Posts: 8,502

Rep: Reputation: 110Reputation: 110
Also, make sure the disk is not mounted when you attempt this: that could cause a number of problems.
 
Old 07-16-2006, 05:35 PM   #5
Melsync
Member
 
Registered: Sep 2005
Posts: 75

Original Poster
Rep: Reputation: 15
/dev/hda2 is 60 GB big. I unmounted it. The command has been running for more than an hour now.
The output of strace dd if=/dev/urandom of=/dev/hda2 bs=1M is
Quote:
execve("/bin/dd", ["dd", "if=/dev/urandom", "of=/dev/hda2", "bs=1M"], [/* 24 vars */]) = 0
brk(0) = 0x9c27000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=144382, ...}) = 0
old_mmap(NULL, 144382, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f07000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\212~\177"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1485672, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f06000
old_mmap(0x417e3000, 1215452, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x417e3000
old_mmap(0x41906000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x123000) = 0x41906000
old_mmap(0x4190a000, 7132, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4190a000
close(3) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f05000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f056c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0x41906000, 8192, PROT_READ) = 0
mprotect(0x4101a000, 4096, PROT_READ) = 0
munmap(0xb7f07000, 144382) = 0
brk(0) = 0x9c27000
brk(0x9c48000) = 0x9c48000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=49618608, ...}) = 0
mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7d05000
close(3) = 0
close(0) = 0
open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 0
close(1) = 0
open("/dev/hda2", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 1
rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x80495cd, [], 0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {0x80495cd, [], 0}, NULL, 8) = 0
rt_sigaction(SIGPIPE, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {0x80495cd, [], 0}, NULL, 8) = 0
rt_sigaction(SIGUSR1, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGUSR1, {0x8049638, [], 0}, NULL, 8) = 0
mmap2(NULL, 1060864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7c02000
read(0, "\2\347\336\2648\n#\353\355\346\277\331\266\360{v\206\304"..., 1048576) = 1048576
write(1, "\2\347\336\2648\n#\353\355\346\277\331\266\360{v\206\304"..., 1048576) = 1048576
read(0, "g\t\356\311\2144\272\266\204q+\347\240\267\272)w\333Nj"..., 1048576) = 1048576
write(1, "g\t\356\311\2144\272\266\204q+\347\240\267\272)w\333Nj"..., 1048576) = 1048576
and the disk led keeps on blinking. The processor is an Athlon 1100 MHz
 
Old 07-16-2006, 05:49 PM   #6
Matir
Moderator
 
Registered: Nov 2004
Location: Kennesaw, GA
Distribution: Ubuntu
Posts: 8,502

Rep: Reputation: 110Reputation: 110
60GB will take quite a while. That shows that 2MB have been copied to the disk. How far along was that strace ouput captured?
 
Old 07-16-2006, 06:51 PM   #7
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,164

Rep: Reputation: 238Reputation: 238Reputation: 238
And by the way, why are you filling this partition with random data ?
 
Old 07-16-2006, 06:53 PM   #8
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,408

Rep: Reputation: 104Reputation: 104
http://www.linuxquestions.org/questi...hreadid=366442

Let me add that.
 
Old 07-16-2006, 06:56 PM   #9
Matir
Moderator
 
Registered: Nov 2004
Location: Kennesaw, GA
Distribution: Ubuntu
Posts: 8,502

Rep: Reputation: 110Reputation: 110
Quote:
Originally Posted by jlliagre
And by the way, why are you filling this partition with random data ?
I'd guess (and I'm sure the OP will correct me) that he's either trying to thoroughly wipe a drive before selling it/giving it away or he's preparing to setup some sort of cryptoloop setup that would work better with a partition full of random data.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/dev/random and /dev/urandom pool(s)? kpeirce Linux - Software 2 01-31-2006 06:54 AM
merging /dev/hda2 and /dev/hda3 aggiridharan Linux - General 2 01-06-2006 01:31 AM
reading from /dev/urandom in c djgerbavore Programming 5 10-04-2005 12:54 PM
swap, /dev/hda2 by /dev/hands :) kaN5300 Slackware 2 09-13-2004 03:45 AM
/dev/urandom Moszer Slackware 3 09-09-2003 09:06 PM


All times are GMT -5. The time now is 09:56 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration