LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 04-25-2013, 08:26 PM   #1
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Rep: Reputation: Disabled
I want to 'dd' my 1TB drive


Hello.

I bought a 1TB drive and I'm planning on doing DD on it. It's a WD, so I guess using a Seagate disk to wipe is not recommended.

What does it take? (what commands), How long? Does doing it very often hurts the drive? (my old 320GB drive had +4000 reallocated sectors)

All I'm used to do is:

* Erase the partition table with $sudo dd if=/dev/urandom of=/dev/sda count=1

* Create random size partitions with random file systems

* Delete all partitions

* Erase the partition table again and then create the partitions I needed.

Are those above enough, let's say, in a virus case, a bootloader virus or a MBR virus? WHY and in what cases are DD needed besides selling the drive? How is data recoverable? Can the FBI recover it? :P

Currently my partitions are:

- 320GB for Windows, used ONLY for games, nothing pirated
- 40GB for /
- 571GB for /home, encrypted.

Thanks in advance.
 
Old 04-25-2013, 09:00 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
What ?
Quote:
I'm planning on doing DD on it
????

what is it you want to do ?
some random guesses ? might be ?

overwrite the drive with /dev/rand ?
or what ?

Quote:
WHY and in what cases are DD needed besides selling the drive?
What ?

please read the help and manual page for dd
Code:
dd --help
------- then read ------
man 1 dd 
---- or -----
man 1p dd 
---- or -----
man dd
Quote:
How is data recoverable?
that answer will require 10,000+ small font pages on bookshelf
please google the subject of " data recovery"

Quote:
Can the FBI recover it?
yes AND no
 
Old 04-25-2013, 09:11 PM   #3
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Sorry for the lack of information, I'm on a hurry with my daughter so I had no time to write it down like it should.

Quote:
????

what is it you want to do ?
some random guesses ? might be ?

overwrite the drive with /dev/rand ?
or what ?
DD for what I know can also be used to wipe a HD with either zeroes (/dev/zero) or with random zeroes and ones (/dev/urandom), right?

Well, I want to wipe my disk and I want to know how long it could take. Info on google is not precise and guessing by my other (but failed) drive ins't gonna help since they're both distinct disks.

Quote:
What ?

please read the help and manual page for dd
Wiping the disk has many uses, but all I know about 'dd' is that it can copy/erase data. If I ever plan to sell my drive I don't want somebody seeing my personal information.

Quote:
that answer will require 10,000+ small font pages on bookshelf
please google the subject of " data recovery"
Yes. I just wanted to know if is it recoverable after doing "dd if=/dev/zero".

Sory for the inconvenience. Let me know if you need any information regarding the drive/my computer.

PS: Don't judge me, I'm not a Linux exper. Since I use Linux and 'dd' is a Unix command (if I recall) I thought this would be the perfect place to ask.

Last edited by junior-s; 04-25-2013 at 09:29 PM.
 
Old 04-25-2013, 09:53 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
just putting zeros only and in only one pass
will not make the drive "unrecoverable "
the forensics lab of the state police or fbi can recover it if they NEED TO


the average "joe" though will NOT be able to recover the data

if this is a usb drive this WILL TAKE A LONG TIME !!!
Warning:
one of these commands is VERY VERY DANGEROUS!!!!!!!!! ( the rm command )
use EXTREME CAUTION !!!!!!
make 100% sure that the drive location is 100% CORRECT!!!!



Code:
cd /to/ the/ 1 /tb /drive

rm -fR * 

dd if=dev/sd? of=OneBigFile.bin bs 1 count 1
 
shred -n 1 -zuv  OneBigFile.bin
replace /dev/sd? with the correct location you get from the command
Code:
su -
fdisk -l
the shread "n 1 " writes 1 time random numbers -- this can be changed to "1 to 37 "
the "-zuv" "zero the file" , then " uninstall/ remove the file" and the " v" is verbose " show what the program is doing

then go to bed
if this is a usb drive then in about 2 days it should be done

Last edited by John VV; 04-25-2013 at 09:57 PM.
 
Old 04-25-2013, 10:01 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
"dd" with a random generator and 512 byte blocks will take forever. Maybe longer.
I've used /dev/zero as a source when scrubbing laptops that need to go back to lease companies. Then allocate a single partition and use mkfs.ntfs - that writes zero blocks over the formatted filesystem as well.
Still takes a while - use "bs=1G" to speed things up. Maybe leave it running overnight.

Waste of time on a new (as in *new*) drive - if you bought it off a private seller, might be worthwhile. I've never done that.
 
Old 04-25-2013, 10:09 PM   #6
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
It's an internal drive, the model is WD10EARS-00Y5B1.

So besides it being unnecessary it will take forever? I was thinking about 3 hours tops, with "sudo dd if=/dev/zero of=dev/sda" <<- I don't know if any additional command (like bs=X) is necessary.

If the steps bellow are enough to make any data unreadable FROM ANY OPERATING SYSTEM (not from users), then I guess 'dd' is really not necessary. Plus I store all my important data on /dev/sda6 with drive encryption and strong passwords like "KejHA_@#$98&*!152OQ", so I guess I'm reasonable safe against a normal user.

Steps I use:

* Erase the partition table with $sudo dd if=/dev/urandom of=/dev/sda count=1

* Create random size partitions with random file systems

* Delete all partitions

* Erase the partition table again and then create the partitions I needed.
 
Old 04-25-2013, 10:24 PM   #7
hilyard
Member
 
Registered: Jan 2010
Location: Inland PNW
Distribution: Lite | siduction
Posts: 291

Rep: Reputation: 66
I had a WD750EARS (I call them WD EARS hdds) -- so slow I bought an enclosure and made it my external storage device, for which it has functioned admirably for over three years.

I think I'd just use gparted to first format entire drive to ext2, then do as you have stated in the last.

As stated by others more qualified than myself, random would take two days or more, zeros a little shorter.

Or divide like into 5 partitions and use dd on each one as is convenient, and make it a week-long project!

Best wishes!

Last edited by hilyard; 04-25-2013 at 10:29 PM. Reason: clarity
 
Old 04-25-2013, 10:32 PM   #8
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hilyard View Post
I had a WD750EARS (I call them WD EARS hdds) -- so slow I bought an enclosure and made it my external storage device, for which it has functioned admirably for over three years.

I think I'd just use gparted to first format entire drive to ext2, then do as you have stated in the last.

As stated, random would take two days or more, zeros a little shorter. Best wishes!
Thanks!

Sad to hear your story, the reviews on this green type of drive are really disappointing, but I guess mine's a 7200RPM and has 512B sectors instead of 4KB like it used to have. I don't know how to measure/compare to other so I can't complain on it so far

Regards
 
Old 04-25-2013, 11:13 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
You will need the bs= keyword. Even using /dev/zero it's likely to take days otherwise. That's days - plural.
And laptops have awfully slow drives.

There is an immense thread (may even have been split into multiple threads) here on LQ on using "dd". Read some of it for background.
 
Old 04-26-2013, 12:03 AM   #10
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
So, what's the command to do so? I want to fill it with zeros, the fastest way.
 
Old 04-26-2013, 12:26 AM   #11
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
bs= defaults to 512
so if it is left off it is auto set to 512

Code:
fdisk -l
will show the size that is used

Quote:
Or divide like into 5 partitions and use dd on each one as is convenient, and make it a week-long project!
4 primarys and that sounds very reasonable
and a lot more convenient

Last edited by John VV; 04-26-2013 at 12:28 AM.
 
Old 04-26-2013, 01:26 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
if that data is so dangerous just drop the device into fire and by a new disk. It will be much faster and much safer. Otherwise you will not need to wipe all the drive. as it was mentioned you can wipe the beginning, make new partitions and wipe those partitions one by one when you have time to do that. the speed highly depends on the hardware and the value of bs. You can try to execute dd on a 1 GB area to check speed.
 
1 members found this post helpful.
Old 04-26-2013, 02:07 AM   #13
hilyard
Member
 
Registered: Jan 2010
Location: Inland PNW
Distribution: Lite | siduction
Posts: 291

Rep: Reputation: 66
Quote:
Originally Posted by junior-s View Post
So, what's the command to do so? I want to fill it with zeros, the fastest way.
This is the command I use:
PHP Code:
dd if=/dev/zero of=/dev/sdaX bs=4096 conv=notrunc,sync 
X = the # of the partition on the device sda (your hard drive)

Last edited by hilyard; 04-26-2013 at 02:08 AM.
 
Old 04-26-2013, 03:53 AM   #14
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
I usually get the fastest writes with blocksizes between 4M and 32M, depending on the hardware, so mostly I use a blocksize of 16M:
Code:
dd if=/dev/zero of=/dev/sda bs=16M
 
Old 04-26-2013, 08:01 AM   #15
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
If I output the BS to 4M, how will the disk get it back to 512? Because:

Quote:
‘bs=bytes’
Set both input and output block sizes to bytes. This makes dd read and write bytes per block, overriding any ‘ibs’ and ‘obs’ settings. In addition, if no data-transforming conv option is specified, input is copied to the output as soon as it's read, even if it is smaller than the block size.
I imagine 'dd' will read and write 4M per whatever and make the disk blocksize as 4M, right? That will make the disk performance slower. How do I get it back to 512 after making 'dd' bs=4M?
 
  


Reply



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
Hard drive upgrade from 1TB to 2TB carneyc Linux - Hardware 4 06-16-2011 10:04 AM
which FS for 1TB usb backup drive? clifford227 Linux - Newbie 6 08-21-2010 11:31 AM
fast way to completley erase 1TB drive? fishjohn Linux - Security 19 04-22-2010 10:57 AM
Drive 99 Percent Full. I have got a New 1Tb External ...HELP!!! WHAT NEXT Wyatt Tuttle Linux - Desktop 21 08-18-2009 10:27 PM
Best 1TB external hard drive? tommytea Linux - Newbie 2 07-05-2009 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:28 PM.

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