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
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
07-16-2006, 08:29 AM
#1
Member
Registered: Sep 2005
Posts: 75
Rep:
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.
07-16-2006, 09:32 AM
#2
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,164
Use strace to find out what dd is (perhaps not) doing:
Code:
# strace dd if=/dev/urandom of=/dev/hda2 bs=1M
07-16-2006, 11:51 AM
#3
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: back to Arch
Posts: 16,659
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.
07-16-2006, 12:20 PM
#4
Moderator
Registered: Nov 2004
Location: Kennesaw, GA
Distribution: Ubuntu
Posts: 8,502
Rep:
Also, make sure the disk is not mounted when you attempt this: that could cause a number of problems.
07-16-2006, 05:35 PM
#5
Member
Registered: Sep 2005
Posts: 75
Original Poster
Rep:
/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
07-16-2006, 05:49 PM
#6
Moderator
Registered: Nov 2004
Location: Kennesaw, GA
Distribution: Ubuntu
Posts: 8,502
Rep:
60GB will take quite a while. That shows that 2MB have been copied to the disk. How far along was that strace ouput captured?
07-16-2006, 06:51 PM
#7
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,164
And by the way, why are you filling this partition with random data ?
07-16-2006, 06:53 PM
#8
Senior Member
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,408
Rep:
07-16-2006, 06:56 PM
#9
Moderator
Registered: Nov 2004
Location: Kennesaw, GA
Distribution: Ubuntu
Posts: 8,502
Rep:
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.
Thread Tools
Search this Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT -5. The time now is 09:56 PM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News