LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I want to 'dd' my 1TB drive (https://www.linuxquestions.org/questions/linux-newbie-8/i-want-to-dd-my-1tb-drive-4175459611/)

junior-s 04-25-2013 08:26 PM

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.

John VV 04-25-2013 09:00 PM

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

junior-s 04-25-2013 09:11 PM

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.

John VV 04-25-2013 09:53 PM

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

syg00 04-25-2013 10:01 PM

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

junior-s 04-25-2013 10:09 PM

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.

hilyard 04-25-2013 10:24 PM

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!

junior-s 04-25-2013 10:32 PM

Quote:

Originally Posted by hilyard (Post 4939013)
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 :D

Regards

syg00 04-25-2013 11:13 PM

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.

junior-s 04-26-2013 12:03 AM

So, what's the command to do so? I want to fill it with zeros, the fastest way.

John VV 04-26-2013 12:26 AM

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

pan64 04-26-2013 01:26 AM

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.

hilyard 04-26-2013 02:07 AM

Quote:

Originally Posted by junior-s (Post 4939063)
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)

TobiSGD 04-26-2013 03:53 AM

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

junior-s 04-26-2013 08:01 AM

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?


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