LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-17-2013, 10:04 AM   #1
cristi92b
Member
 
Registered: May 2011
Posts: 86

Rep: Reputation: Disabled
Question about dd and /dev/null


What happens if you write NULLs to a HDD?
ex:
Code:
dd if=/dev/null of=/dev/sda
Will you damage the drive?
If the answer is yes, can you repair the drive after that?

Last edited by cristi92b; 01-17-2013 at 10:08 AM.
 
Old 01-17-2013, 11:08 AM   #2
soppy
Member
 
Registered: Mar 2008
Location: In your head!
Distribution: Arch Linux
Posts: 165
Blog Entries: 1

Rep: Reputation: 28
No, it won't cause damage. All /dev/null does it "zero" out the device erasing all data permanently. If you need to wipe a device to give to someone else, this is highly recommended.

The only reason you would do this to a hard drive is because it is corrupted or you need to really format the crap out of it. However, once the operation is done, you can re-partition and write to it just like normal.

Hope I helped!
 
Old 01-17-2013, 11:10 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
If you want to write zeroes to a disk you don't use /dev/null, you use /dev/zero. /dev/null is meant for writing to it, /dev/zero for reading from it.
 
2 members found this post helpful.
Old 01-17-2013, 12:11 PM   #4
cristi92b
Member
 
Registered: May 2011
Posts: 86

Original Poster
Rep: Reputation: Disabled
Thank you!
 
Old 01-17-2013, 12:16 PM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
I'm pretty sure nothing would happen:

Code:
$ dd if=/dev/null of=~/nullfile
0+0 records in
0+0 records out
0 bytes (0 B) copied, 2.6905e-05 s, 0.0 kB/s
$ ls -l ~/nullfile
-rw-rw-r-- 1 user user 0 Jan 17 10:15 /home/user/nullfile
Nothing happens when you try to read from /dev/null. See soppy's response if you want to know what would happen if you were to do this with /dev/zero instead.
 
1 members found this post helpful.
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Why is there a need for /dev/null, /dev/zero and other special device (files) in /dev suttiwit Linux - General 13 08-07-2012 01:26 AM
I got a question about redirecting to /dev/null trist007 Linux - Newbie 3 12-13-2009 07:34 PM
LXer: /dev/null And /dev/zero On Linux And Unix: What's The Difference? LXer Syndicated Linux News 0 04-29-2009 11:50 AM
Startx Permission problems on /dev/null and /dev/mem on freshly compiled 2.6.22.1 Eric_Cartman Linux - Kernel 2 09-09-2007 02:42 AM
What is meant by " file > /dev/null 2>&1 </dev/null " attockonian Linux - Newbie 5 06-30-2006 11:51 PM


All times are GMT -5. The time now is 06:53 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration