LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-26-2013, 08:20 AM   #16
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled

Just noticed that my default BS is 4096bytes, so I guess I'm OK doing bs=4K.

Quote:
junior@junior-desktop:~$ sudo hdparm -I /dev/sda | grep -i physical
[sudo] password for junior:
Physical Sector size: 4096 bytes
 
Old 04-26-2013, 08:26 AM   #17
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,843

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
instead of guessing you can try, that would give you a result much faster...
 
Old 04-26-2013, 11:14 AM   #18
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by junior-s View Post
If I output the BS to 4M, how will the disk get it back to 512? [...] How do I get it back to 512 after making 'dd' bs=4M?
No worries. You don't have to do anything. The block-size parameter 'bs' only affects the size of the data block passed in memory to/from the hard drive. It does not actually change the hard drive's physical sector size, or the sector size as it might be defined/formatted in the filesystem. The reason we are talking about 'bs' is that the data transfer is supposed to be more efficient (there is less overhead in setting up the transfer) if you pass fewer large blocks rather than a large number of small blocks.

If you are curious, you can experiment. I wrote this little script:
Code:
#!/bin/bash
dd if=/dev/zero of=/media/sea2tb/erase-me/512.bin bs=512 count=512000
dd if=/dev/zero of=/media/sea2tb/erase-me/4k.bin bs=4k count=64000
dd if=/dev/zero of=/media/sea2tb/erase-me/64k.bin bs=64k count=4000
dd if=/dev/zero of=/media/sea2tb/erase-me/256k.bin bs=256k count=1000
This is not exactly the same as you are doing, but it's close. I am writing files to a FAT filesystem on a USB hard drive. Here is my output:
Code:
512000+0 records in
512000+0 records out
262144000 bytes (262 MB) copied, 7.66652 s, 34.2 MB/s
64000+0 records in
64000+0 records out
262144000 bytes (262 MB) copied, 9.29928 s, 28.2 MB/s
4000+0 records in
4000+0 records out
262144000 bytes (262 MB) copied, 9.27168 s, 28.3 MB/s
1000+0 records in
1000+0 records out
262144000 bytes (262 MB) copied, 9.04747 s, 29.0 MB/s
Wait a second... It's faster with 512-byte blocks. Go figure!

If I repeat the exercise with if=/dev/urandom, larger blocks go significantly (about 2x) faster than small blocks, but of course not as fast as /dev/zero.
 
Old 04-26-2013, 12:10 PM   #19
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Would there be a problem to use Seagate's Disk Wizzard to do this Zero-Fill operation?
 
Old 04-26-2013, 12:11 PM   #20
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by junior-s View Post
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.
If you want to erase the drive, you don't have to do all that with random partitions and random file systems. All the user information, and that includes the partition table, filesystems, directories, and files, is laid out in /dev/sdX (where 'X' is the hard drive index, for example 'a' in /dev/sda). If you simply overwrite the entire space of /dev/sdX, you have done it all.
 
Old 04-26-2013, 12:15 PM   #21
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Beryllos View Post
If you want to erase the drive, you don't have to do all that with random partitions and random file systems. All the user information, and that includes the partition table, filesystems, directories, and files, is laid out in /dev/sdX (where 'X' is the hard drive index, for example 'a' in /dev/sda). If you simply overwrite the entire space of /dev/sdX, you have done it all.
But that would take too long. All I'm doing in the above steps is making data inaccessible to the system, because even after erasing the MBR my data was accessible to the system. So creating random sizes partitions, deleting them all, deleting the partition table and then creating the partitions I need make it impossible for any OS to see what was in there.
 
Old 04-26-2013, 12:25 PM   #22
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by junior-s View Post
Would there be a problem to use Seagate's Disk Wizzard to do this Zero-Fill operation?
After a quick look at the Seagate DiscWizard User Guide, I would say it looks good. It has some useful options (multipass overwriting, overwrite with random numbers or defined bit patterns), and it has some safeguards against accidental erasure of the wrong drive. Try it and see how it works.
 
Old 04-26-2013, 01:36 PM   #23
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by junior-s View Post
But that would take too long. All I'm doing in the above steps is making data inaccessible to the system, because even after erasing the MBR my data was accessible to the system. So creating random sizes partitions, deleting them all, deleting the partition table and then creating the partitions I need make it impossible for any OS to see what was in there.
Repartitioning makes it harder, but even in the absence of a valid partition table or directory, many types of files (I'm thinking of photo, video, and music) can be reconstructed by recognizing standard file headers and internal data structures. If the file is contiguous (not fragmented), this should be easy. If it's fragmented, it may still be possible, though I don't imagine it would be easy or certain.

If my money or reputation depended on files being unrecoverable, I would wipe the entire drive space. For my 2TB with USB 2.0, that would take about 20 hours per pass. I would set aside a weekend, or a week, and just do it.
 
Old 04-26-2013, 02:43 PM   #24
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
Edit: Sorry, I didn't notice the block size question was already answered.

The dd block size is logical. It doesn't have any bearing on the physical sector size on the disk. It's just the number of bytes that dd writes in each i/o operation.

Last edited by Z038; 04-26-2013 at 02:45 PM. Reason: already answered
 
Old 04-26-2013, 05:53 PM   #25
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Beryllos View Post
After a quick look at the Seagate DiscWizard User Guide, I would say it looks good. It has some useful options (multipass overwriting, overwrite with random numbers or defined bit patterns), and it has some safeguards against accidental erasure of the wrong drive. Try it and see how it works.
Tried. Result: "At least one Seagate Drive must be installed". LOL

I guess a generic tool would work too?
 
Old 04-26-2013, 05:55 PM   #26
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Beryllos View Post
Repartitioning makes it harder, but even in the absence of a valid partition table or directory, many types of files (I'm thinking of photo, video, and music) can be reconstructed by recognizing standard file headers and internal data structures. If the file is contiguous (not fragmented), this should be easy. If it's fragmented, it may still be possible, though I don't imagine it would be easy or certain.

If my money or reputation depended on files being unrecoverable, I would wipe the entire drive space. For my 2TB with USB 2.0, that would take about 20 hours per pass. I would set aside a weekend, or a week, and just do it.
I was talking about being recoverable automaticly by the system =)

Some day I had conflicting files on a Ubuntu install. I wiped out the partition table, and after formatting and installing the system those files were still there causing me problems. That's why I do partitioning at random sizes, this way I guarantee the system will not recognize those files in the future.
 
Old 04-26-2013, 05:58 PM   #27
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
Check out DBAN (Darik's Boot and Nuke). http://sourceforge.net/projects/dban/

It may not fit your requirement of being fast. I suspect it'll run for a couple of days on a 1TB drive.
 
Old 04-26-2013, 06:04 PM   #28
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Z038 View Post
Check out DBAN (Darik's Boot and Nuke). http://sourceforge.net/projects/dban/

It may not fit your requirement of being fast. I suspect it'll run for a couple of days on a 1TB drive.
Filling my old 320GB with zeros took 1 hour, filling with ones and then zeros took 2 ours. I SUSPECT this drive will take about 9 hours. Correct me if I'm wrong.
 
Old 04-27-2013, 06:18 AM   #29
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
I Left it over night and the output was:

Quote:
ubuntu@ubuntu:~$ sudo dd if=/dev/zero of=/dev/sda bs=16M
dd: writing `/dev/sda': No space left on device
59617+0 records in
59616+0 records out
1000204886016 bytes (1.0 TB) copied, 12274.5 s, 81.5 MB/s
Those of you who did already, did it go OK? Why the no space left message? I suppose it went OK since the copied size was 1.0TB.

Last edited by junior-s; 04-27-2013 at 06:26 AM.
 
Old 04-27-2013, 07:36 AM   #30
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by junior-s View Post
Those of you who did already, did it go OK? Why the no space left message? I suppose it went OK since the copied size was 1.0TB.
Yes, it went OK. Apparently dd doesn't bother to check the disk size (or file size, if you choose to output to a file). It just keeps rolling until it runs out of space.

For output to a pre-existing file, you need to use the count= parameter, and set count*bs equal to the file size. If you don't use count=X, it will keep going, and the file will grow until the disk (or filesystem) is full.
 
  


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 12:25 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
Open Source Consulting | Domain Registration