Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-17-2013, 10:04 AM   #1
Registered: May 2011
Posts: 89

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

What happens if you write NULLs to a HDD?
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
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
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
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
Registered: May 2011
Posts: 89

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

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

$ 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.


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 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 12:06 AM.

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