LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-04-2019, 03:18 AM   #1
peter7089
Member
 
Registered: May 2016
Distribution: MX Linux
Posts: 249

Rep: Reputation: Disabled
What is the best way to wipe partition from command line?


I want to wipe all the data from a partition so it can't be recovered. What is the best way to that from the command line?
 
Old 04-04-2019, 03:37 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
The dd command is the canonical method:
Code:
dd if=/dev/zero of=/dev/sdb3 bs=1M
There is also the more thorough shred command, which attempts to prevent forensic tools from getting results.
 
1 members found this post helpful.
Old 04-04-2019, 04:06 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
There are very few situations that have a "best" for any significant time.
This one depends on who you are trying to hide from - a mug user, your girlfriend, the NSA, ...
 
Old 04-04-2019, 04:35 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,493

Rep: Reputation: Disabled
You can use dd, (inputting /dev/zero), shred, or wipe - see their respective websites/man pages.
 
Old 04-04-2019, 07:53 AM   #5
peter7089
Member
 
Registered: May 2016
Distribution: MX Linux
Posts: 249

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
The dd command is the canonical method:
Code:
dd if=/dev/zero of=/dev/sdb3 bs=1M
There is also the more thorough shred command, which attempts to prevent forensic tools from getting results.
What bs=1M mean?
 
Old 04-04-2019, 07:57 AM   #6
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by peter7089 View Post
What bs=1M mean?
man dd will tell you what you need to know.
 
Old 04-04-2019, 08:24 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
https://linoxide.com/linux-command/c...pe-disk-linux/

dod wipe it.. twice if you have two.
 
Old 04-04-2019, 08:40 AM   #8
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by BW-userx View Post
https://linoxide.com/linux-command/c...pe-disk-linux/

dod wipe it.. twice if you have two.
@OP, just in case you're wondering what "dod" means, it mean the US Department of Defence "5220.22-M Data Wipe method".

https://www.lifewire.com/dod-5220-22-m-2625856
 
Old 04-04-2019, 09:10 AM   #9
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by hydrurga View Post
man dd will tell you what you need to know.
Let me add that you don’t need this option, but it will probably make the task faster.
 
1 members found this post helpful.
Old 04-17-2019, 10:30 AM   #10
agent_mach
LQ Newbie
 
Registered: Dec 2010
Posts: 11

Rep: Reputation: 0
Hi,

This can help you, and you can also get more informative posts related to System Administration:

https://vlinux-freak.blogspot.com/20...y-so-that.html
 
Old 04-17-2019, 12:13 PM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
the answer depends on the type of that hardware/device too (which is unknown).
 
Old 04-17-2019, 01:17 PM   #12
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by BW-userx View Post
https://linoxide.com/linux-command/c...pe-disk-linux/

dod wipe it.. twice if you have two.
Why? If you ofended a country's intellegence services then you've probably leaked too much already if hard-drive cleaning is something you need to use (hint, encryption).
For just giving away a hard drive nobody can recover overwritten information from a modern hard drive. My source? Try to find somebody willing to do it, even for the multiple-thousand dollars which data recovery companies charge..
 
Old 04-17-2019, 03:31 PM   #13
ceantuco
Member
 
Registered: Mar 2008
Location: New York
Distribution: Debian
Posts: 809

Rep: Reputation: 88
before disposing hard drives at work, I run
Code:
#shred -fvzn 10 /dev/"drivetodelete"
You may not want to do 10 zero passes on a drive that you will continue to use especially if it is a SSD. Try 2 or 3 passes.
 
Old 04-17-2019, 06:41 PM   #14
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by 273 View Post
Why? If you ofended a country's intellegence services then you've probably leaked too much already if hard-drive cleaning is something you need to use (hint, encryption).
For just giving away a hard drive nobody can recover overwritten information from a modern hard drive. My source? Try to find somebody willing to do it, even for the multiple-thousand dollars which data recovery companies charge..
what are you rambling on about? I am not the one wanting to know how to wipe a dive for one. the other, using dod wipe, if this government came up with it to keep its secrets safe so its own people and others cannot find out about them, then why cannot its own people use the same method to keep there secrets away from others and the country that has secrets that it does not want its own people to know, so badly does this very country does not want its own people to know theses secrets it developed a method called department of defense wipe, to clean the hard drive well enough to keep these secrets from its own people to not find out about?

why, what have they done that is so bad it does not want its own people to know about it?

Last edited by BW-userx; 04-17-2019 at 06:46 PM.
 
Old 04-26-2019, 12:00 PM   #15
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by BW-userx View Post
what are you rambling on about? I am not the one wanting to know how to wipe a dive for one. the other, using dod wipe, if this government came up with it to keep its secrets safe so its own people and others cannot find out about them, then why cannot its own people use the same method to keep there secrets away from others and the country that has secrets that it does not want its own people to know, so badly does this very country does not want its own people to know theses secrets it developed a method called department of defense wipe, to clean the hard drive well enough to keep these secrets from its own people to not find out about?

why, what have they done that is so bad it does not want its own people to know about it?
the DOD wipe is a relic from the past and just serves to make the drive more worn.
Look up data recovery from overwritten files and see how many people claim to be able to do it with modern drives. I'll give you a clue: it's less than one.
As for being allowed to use the wipe that the government recomended last century -- you're welcome to do so but a better way of doing things would be to encrypt the data so you don't need to do that. If you have to ask about wiping so that the NSA can't read a drive then you're likely too stupid not to have given the game away in some other manner and should not be looking to resell something which could get you or other people imprrisoned or worse if you used the wrong commandline parameters -- there's a reason people use things like thermite to destry drives.
"So, I want to sell this hard drive on Craigslist for $10 but, the thing is, the NSA want some of the data on it...". Do you not see the farce in that?
 
1 members found this post helpful.
  


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
Best way to wipe solid state drive jrdioko Linux - Software 6 05-15-2011 05:20 PM
[SOLVED] Best way to wipe RMAd hard drive? jim_d Linux - Newbie 4 03-08-2011 04:13 PM
Advice on whether to clone/re-partition/re-install OR wipe disk/re-partition/use VM linus72 Linux - Newbie 6 04-16-2009 02:41 AM
how to wipe disk in best way to reinstall WinXP and Mandrake as dual boot jukebox4joe Linux - Software 3 01-23-2004 04:57 PM
Easiest way to totally wipe my HD's... EnigmaZ Slackware 19 01-02-2004 10:08 PM

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

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