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 - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-18-2015, 04:52 PM   #1
l0rddarkf0rce
Member
 
Registered: Nov 2004
Location: Virginia, US
Distribution: Slackware 14.1 multilib
Posts: 149

Rep: Reputation: 33
erase unused space


Hello all...

Is there a way to securely erase the unused space from the HD that I currently have Slackware on (/dev/sda in my case)?
 
Old 04-18-2015, 05:45 PM   #2
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 687
Blog Entries: 1

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Try
Code:
dd of=x if=/dev/urandom bs=4096
It will fill up you disk so maybe best to execute it in single use mode. Once complete delete the file after a sync(1)
 
Old 04-18-2015, 07:33 PM   #3
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
the above is the easiest
and it is built in

but if you have to have a program

install "bleachbit"
and use the gtk based gui
 
Old 04-18-2015, 07:42 PM   #4
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,177

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
Quote:
Originally Posted by jmccue View Post
Try
Code:
dd of=x if=/dev/urandom bs=4096
It will fill up you disk so maybe best to execute it in single use mode. Once complete delete the file after a sync(1)
I don't think this would fill the free space with random data across multiple partitions. Or am I wrong?
 
Old 04-18-2015, 08:19 PM   #5
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by gezley View Post
I don't think this would fill the free space with random data across multiple partitions. Or am I wrong?
You would have to do it for each partition.

/dev/urandom is slow, but secure. You could also use /dev/zero instead, it is faster, but in extreme circumstances is less secure (very high tech microscope recovery techniques that have never been used in practice and aren't practical either).
 
Old 04-18-2015, 08:37 PM   #6
STDOUBT
Member
 
Registered: May 2010
Location: Stumptown
Distribution: Slackware64
Posts: 583

Rep: Reputation: 242Reputation: 242Reputation: 242
dd of=x if=/dev/urandom bs=4096

The above would NOT preserve any data, where 'x'= a partition.
Pretty sure l0rddarkf0rce just wants to erase unallocated disk space
 
Old 04-18-2015, 08:55 PM   #7
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by STDOUBT View Post
dd of=x if=/dev/urandom bs=4096

The above would NOT preserve any data, where 'x'= a partition.
Pretty sure l0rddarkf0rce just wants to erase unallocated disk space
Yeah, but as written (where x is a file) it will do exactly that.
 
Old 04-18-2015, 11:15 PM   #8
l0rddarkf0rce
Member
 
Registered: Nov 2004
Location: Virginia, US
Distribution: Slackware 14.1 multilib
Posts: 149

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by descendant_command View Post
Quote:
Originally Posted by STDOUBT View Post
dd of=x if=/dev/urandom bs=4096

The above would NOT preserve any data, where 'x'= a partition.
Pretty sure l0rddarkf0rce just wants to erase unallocated disk space
Yeah, but as written (where x is a file) it will do exactly that.
Both correct. I went with /dev/zero not as secure but good enough for my purposes. I guess that my Slackware box will be out of commission for several more hours filling the available 250GB on the partition will take a while.
 
Old 04-19-2015, 02:01 AM   #9
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154
Quote:
Originally Posted by l0rddarkf0rce View Post
Hello all...

Is there a way to securely erase the unused space from the HD that I currently have Slackware on (/dev/sda in my case)?
I'm not sure if I understand you correctly.

Sometimes I test-drive systems not in a virtual environment, but on a real machine here in my office. I'm using Ghost for Linux (G4L) to make backups to a local FTP server. Before doing that, I zero out the unused space on the hard disks, to reduce the size of the compressed images. Here's how I do that:
Code:
# dd if=/dev/zero of=/0bits bs=20M ; rm -f /0bits
Cheers,

Niki
 
Old 04-19-2015, 02:46 AM   #10
speck
Member
 
Registered: Nov 2001
Location: US
Distribution: Slackware 14.2
Posts: 375

Rep: Reputation: 115Reputation: 115
I hope the meaning of "unallocated" is agreed upon by all, hopefully he didn't just write over a partition that contained some (allocated) data he wanted to retain.
 
Old 04-19-2015, 03:13 AM   #11
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154
Quote:
Originally Posted by STDOUBT View Post
dd of=x if=/dev/urandom bs=4096

The above would NOT preserve any data, where 'x'= a partition.
Pretty sure l0rddarkf0rce just wants to erase unallocated disk space
If we don't hear from him anymore, he's probably followed the advice above.
 
Old 04-19-2015, 12:19 PM   #12
l0rddarkf0rce
Member
 
Registered: Nov 2004
Location: Virginia, US
Distribution: Slackware 14.1 multilib
Posts: 149

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by kikinovak View Post
If we don't hear from him anymore, he's probably followed the advice above.
Yes I meant unallocated space and yes x := a file. Many thanks to all!
 
Old 04-19-2015, 07:23 PM   #13
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
this discussion is why i post that dd solution as
Code:
dd of=/OneBigFile.bin if=/dev/zero
and leave the bs as the default 512

just adjust for the partitions
Code:
dd of=/dev/sdb1/OneBigFile.bin if=/dev/zero
 
Old 04-19-2015, 08:50 PM   #14
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by John VV View Post
just adjust for the partitions
Code:
dd of=/dev/sdb1/OneBigFile.bin if=/dev/zero
Ummm, that's going to create an ordinary file in /dev and fill up your devfs or devtmpfs in memory, leaving the actual filesystem on /dev/sdb1 untouched.

[EDIT] Make that "try to create". It will, fortunately, fail since /dev/sdb1 is not a directory.

Last edited by rknichols; 04-19-2015 at 08:56 PM.
 
Old 04-20-2015, 03:52 PM   #15
gus3
Member
 
Registered: Jun 2014
Distribution: Slackware
Posts: 490

Rep: Reputation: Disabled
this cleans most residual magnetism on platters

Fill the partition with a file, using /dev/zero, then shred the file:

Code:
# dd if=/dev/zero of=zeros
# shred -vu zeros
Of course, probably not necessary on SSD storage. In that case, you would want to

Code:
# dd if=/dev/zero of=zeros
# rm zeros
# fstrim -v /mount/point
 
  


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
Zeroing-out unused space Completely Clueless Linux - General 11 10-25-2014 01:54 PM
Partitioning unused space, OpenBSD eblonk *BSD 3 01-28-2013 03:34 AM
Create mount point for unused space. lowsy Linux - Newbie 3 10-29-2009 11:16 PM
Recovering unused hd space: Server vshell Linux - Newbie 4 05-16-2006 03:53 PM
Deleting unused space from a partition Tsukasa7 Linux - Newbie 2 08-31-2005 02:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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