LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-27-2019, 01:00 AM   #1
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Rep: Reputation: 21
Wipe HDD


Whats the current way to wipe a HDD? I have been using DD. I read somewhere that was "old school" I 'm not wiping for security reasons.
 
Old 01-27-2019, 02:30 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by borgward View Post
I 'm not wiping for security reasons.
then dd it is.

about it being oldschool: that's just bs.
hammers (or any number of tools) are also oldschool yet i don't see them going away anytime soon.

PS:
you don't even neeed to wipe the whole drive, just the first few kB, and the filesystem becomes unusable (not the drive itself), empty.

Last edited by ondoho; 01-27-2019 at 12:47 PM.
 
1 members found this post helpful.
Old 01-27-2019, 02:45 AM   #3
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
They basically all do the same thing, therefore dd is good as you don't need to install anything. The only thing with dd is that it defaults to 512 byte sectors which takes too long as most file systems write data to blocks of many 512 byte sectors. Dcfldd will default to block size. By defaulting to block size, the process is much faster, and if you're not concerned about "secure wipe" for security, block size is the way to go.

To find the block size of the file system, simply issue command: sudo blockdev --getbsz /dev/partition. Most often it will be 4K blocks, an example from my current Fedora is below after running sudo fdisk -l command to show /dev/partition:
Code:
Disk /dev/mapper/fedora-root: 16.8 GiB, 18039701504 bytes, 35233792 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/fedora-swap: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[jo@localhost ~]$ sudo blockdev --getbsz /dev/mapper/fedora-root
4096
[jo@localhost ~]$
It uses 4K blocks (4096), so run dd command with that size in one of the two methods below:
Code:
sudo dd if=/dev/zero of=/dev/mapper/fedora-root bs=4096
sudo dd if=/dev/urandom of=/dev/mapper/fedora-root bs=4096
You can also change the "bs=4096" to "bs=4K". The first example zero fills, the second writes random fill.
No other utility will be faster, as they all do the same thing and if they all default to block size, the speed is determined by your computer resources and drive speed.

Last edited by Brains; 01-27-2019 at 02:49 AM. Reason: corrected incorrect command
 
1 members found this post helpful.
Old 01-27-2019, 04:05 AM   #4
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,498

Rep: Reputation: Disabled
As it's not for security reasons, I'd just use dd on the first 2MB, then create a new MBR, re partition it, & add a new file system.
 
1 members found this post helpful.
Old 01-28-2019, 02:21 AM   #5
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,812
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Quote:
Originally Posted by Brains View Post
Code:
sudo dd if=/dev/zero of=/dev/mapper/fedora-root bs=4096
sudo dd if=/dev/urandom of=/dev/mapper/fedora-root bs=4096
You can also change the "bs=4096" to "bs=4K"....
Disks have bigger than 4K caches nowadays. Why not utilize some for more speed?
Code:
# dd if=/dev/zero of=/dev/sdg bs=48K
 
Old 01-28-2019, 09:42 PM   #6
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by mrmazda View Post
Disks have bigger than 4K caches nowadays. Why not utilize some for more speed?
Code:
# dd if=/dev/zero of=/dev/sdg bs=48K
Because data is written to 4K blocks. If you want to "Wipe" a drive, you want to get every block. If you simply want to erase partition information, you only need to wipe a small part of the beginning.

Keep in mind, the OP asked this question, "Whats the current way to wipe a HDD?", and I answered the OP's question, if you have a question of your own, start another thread.
 
Old 01-28-2019, 10:13 PM   #7
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,812
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Quote:
Originally Posted by Brains View Post
If you simply want to erase partition information, you only need to wipe a small part of the beginning.
Exactly.

Quote:
Keep in mind, the OP asked this question, "Whats the current way to wipe a HDD?", and I answered the OP's question...
That you did, and more. My question was about the propriety of your recommending bs=4096 when performing a wipe, leaving open a question of whether bs=4096 is some ad hoc improvement over no bs at all, or an optimal one, not an ipso facto reason for a new thread unless someone wants a new one.
 
Old 01-28-2019, 10:21 PM   #8
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by mrmazda View Post
That you did, and more. My question was about the propriety of your recommending bs=4096 when performing a wipe, leaving open a question of whether bs=4096 is some ad hoc improvement over no bs at all, or an optimal one
You need to re-read my original post a few times to answer your question.
 
Old 01-28-2019, 11:17 PM   #9
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,812
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Quote:
Originally Posted by Brains View Post
You need to re-read my original post a few times to answer your question.
I'm not sure it's all that helpful to a dd context. My understanding of "optimal I/O" outside this dd recommendation context has to do largely with maintaining sector alignment on 512E drives, and filesystem structure management, not necessarily related to throughput for multi-GB or TB full-disk dd transfers for which partitions and volumes have no relevance. I'm sure I've read variously 32K or 65536 or maybe even 128K recommended bs in dd (cloning) operations to speed the overall process up. Same would apply to full-disk wiping.
 
Old 01-29-2019, 03:04 PM   #10
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by mrmazda View Post
I'm not sure it's all that helpful to a dd context. My understanding of "optimal I/O" outside this dd recommendation context has to do largely with maintaining sector alignment on 512E drives, and filesystem structure management, not necessarily related to throughput for multi-GB or TB full-disk dd transfers for which partitions and volumes have no relevance. I'm sure I've read variously 32K or 65536 or maybe even 128K recommended bs in dd (cloning) operations to speed the overall process up. Same would apply to full-disk wiping.
This is how I interpret the OP's question:
I've been using dd to wipe drives, but am under the impression it's inadequate compared to other wipe utilities, is there a better utility to wipe a drive?

My answer is no. They all do the same thing, and most utilities default to block/cluster size. Default block size for pretty much every file system utility is 4K, this is not absolute, you can define whatever block size you want when creating a file system. As such, dd can achieve the exact same results as any other wipe utility by setting the byte size to block size, because dd defaults to sector size which is a little better but time consuming. Which is why I mention how to determine the block size.

In other words, to answer the OP's question, no other utility will do a better job just like dd won't do a better job, but dd can do whatever type of wipe you want, be it non-secure, semi-secure, or secure wipe based on variables passed and amount of passes, just like any GUI wipe utilities.
 
Old 01-29-2019, 03:30 PM   #11
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
I was not under the impression dd is inadequate. No impression either way. I wanted to confirm what I heard about a different way. I am aware that people will try to blow smoke up my pants and that new, bright and shiny is not always better. Good reply.
 
Old 01-29-2019, 03:30 PM   #12
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,812
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Post #10 grades:
paragraph 1: A
paragraph 2: A-
paragraph 3: A

Discussion of the A- IMO deserves its own thread.
 
Old 01-29-2019, 04:04 PM   #13
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
I guess the question is more of what is "wipe" to the OP.

Since it is not for security then why are they doing it my question. ??? What is the point?
 
Old 01-29-2019, 05:33 PM   #14
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
The point is that sometimes Mint has trouble installing to a drive that has something else on it. I one case a drive had LVM on it. I had to wipe the drive to get rid of LVM. I did not want to learn the in's and out's of LVM so I could replace it. I had no need for LVM.
 
Old 01-29-2019, 05:43 PM   #15
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,812
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Another option is partitioning in advance of starting any installer, you deciding what goes where and how much space it's allowed to use. Any installer that doesn't accommodate this I abort. My partitioning is always done in advance. Mint never forced me to abort, dutifully accepting my assignments just like other Debian derivatives.

Whatever partitioner is used in advance can delete whatever partitioning already exists without any need for prior wiping. To be sure, formatting of the newly created partitions prior to installation is also possible, and I do it too, including swap partition if necessary.
 
  


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
Run customised HDD driver for external HDD while generic HDD driver for bootable purpose sonia49 Linux - Newbie 1 09-28-2016 08:52 PM
[SOLVED] Wipe Data on HDD. hack3rcon Linux - Security 13 01-17-2016 01:24 PM
Would like to wipe hdd due to MBR virus EDDY1 Linux - Newbie 19 04-18-2013 12:04 AM
Looking for program to wipe HDD and reformat jacatone Linux - Software 5 02-12-2008 07:28 AM
Want to wipe my HDD clean jacatone Linux - Software 4 05-01-2007 11:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:32 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