LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-07-2006, 07:08 AM   #1
j4Ck_r1Pp
LQ Newbie
 
Registered: Sep 2006
Posts: 1

Rep: Reputation: 0
how to purge swap partition?


hi,
suppose i wanna sell my computer. the swap partition might still contain a password i entered somewhere.
now if i did "cat /dev/zero > /dev/hda2" (if /dev/hda2 were my swap partition), would that overwrite the entire parition with zeros, and if so, would it eventually stop or would it loop through /dev/hda2 over and over again?
 
Old 09-07-2006, 07:29 AM   #2
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
If you're that worried about security, wouldn't it be safer to keep the hard drive? They're pretty cheap.
 
Old 09-07-2006, 07:45 AM   #3
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
Lookup the "shred" application
 
Old 09-07-2006, 08:00 AM   #4
zulfilee
Member
 
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430

Rep: Reputation: 39
Use dd command

dd if=/dev/zero of=/dev/hda2


shred is used to secure delete files.
But you can try with /dev/hda2 also.
if it works then that`ll be the best way.
 
Old 09-07-2006, 08:07 AM   #5
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by oneandoneis2
Lookup the "shred" application
I don't believe that shred or wipe will work on a swap partition.

j4Ck_r1Pp,

If you simply use cat /dev/zero > partition then you will write one byte or one word to the swap partition.

You should use the dd command to write zeroes or random numbers to any partition or file. In your case if the swap partition is on /dev/hda2 and if it is 1 gigabyte in size then the following command will overwrite the entire paritition with random numbers.

dd if=/dev/urandom of=/dev/hda2 bs=1G count=1

You can find more information about using dd by using the man utility. Overwriting a large partition can take some time. Make sure that your disk drive active light remains on. I have seen the dd command hang while doing this sort of thing. I do this all the time. You can adjust the byte size parameter and the count parameter if your system hangs trying to do this in one gulp.

You should overwrite the partition several times to increase the efficacy of this task. You can also do the same thing with your system partition and your data partition(s). Note that you will have to boot a live cd in order to wipe your system partition.

Once you think that you have cleaned a partition you can use the Test Disk and Photo Rec utiltities available at the following web site to check your work. These probably aren't as good as using a professional disk recovery service, but they have done a good job for me. I've tested these utilities on several disks in various states of information unavailability. They won't work on a swap partition but they will work on various Linux file system partitions and NTFS and FAT partitions. If these utilities cannot recover your files then you are probably good to go.

http://www.cgsecurity.org/wiki/TestDisk_Download

Last edited by stress_junkie; 09-07-2006 at 08:09 AM.
 
Old 09-07-2006, 08:22 AM   #6
masonm
Senior Member
 
Registered: Mar 2003
Location: Following the white rabbit
Distribution: Slackware64 -current
Posts: 2,300

Rep: Reputation: 90
I'd just swap out the harddrive and be done with it.
 
Old 09-07-2006, 08:23 AM   #7
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by masonm
I'd just swap out the harddrive and be done with it.
Then what do you do with the hard drive? If you don't want to use it yourself then you really should clean the data as much as is reasonably possible before it leaves your possession.
 
Old 09-07-2006, 08:29 AM   #8
zulfilee
Member
 
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430

Rep: Reputation: 39
Agreed.

But one thing thats for sure is
"Thats just a swap partition and its not needed to wipe it clean.
There will be no data on that if it was used only as a swap partition".

So as mason said plug out the harddisk and give it away; :->
 
Old 09-07-2006, 09:57 AM   #9
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
Quote:
I don't believe that shred or wipe will work on a swap partition.
It will - check the man page.

You have to unmount it first, of course. .
 
Old 09-07-2006, 02:00 PM   #10
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335


shred man page experpt:
Quote:
... it is common to operate on device files like /dev/hda ...
Ooops. I guess you're correct, oneandoneis2.

I'm melting ... melting ...

Last edited by stress_junkie; 09-07-2006 at 02:04 PM.
 
  


Reply

Tags
disk recovery



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
swap partition vikassoft Linux - General 3 11-27-2005 10:11 AM
Swap partition Proud Linux - Hardware 5 03-23-2005 07:17 PM
Swap Partition Terra Niux Slackware 2 12-29-2004 04:48 AM
Swap Partition ddzc Linux - General 3 01-22-2004 07:38 PM
Newbie Installing Debian3 on m68k w/250M Partition Needs help creating swap partition AppleMac Linux - Newbie 2 11-01-2002 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

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