LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-22-2010, 05:12 PM   #1
evaristegalois
Member
 
Registered: Sep 2006
Distribution: Ubuntu 14.04
Posts: 41

Rep: Reputation: 15
erase operating system


Assume I have a computer on which I want to use ubuntu for a while (single boot). Assume also that in about six months I want to give this computer to Mr. X, but I do not want Mr. X to know that I have been using ubuntu. I don't want to install anything over top of ubuntu, I just want the computer to be completely (or as nearly completely as possible) blank so that Mr. X cannot infer what I've been doing on it. The trick here is that I can't use operating system x_{1} to delete operating system x_{0}. I don't want Mr. X to know anything about which OS I have been using. Mr. X, by the way, is a sophisticated computer user but not particularly interested in tracking me down. Once he sees that the computer is blank Mr. X will just install his own operating system and everybody will be happy.

I basically want ubuntu to destroy itself. Erasing a hard drive is not what I want. I want to erase the operating system. All of this is single boot. If Windows is the operating system and I install ubuntu, then Windows is gone. I want ubuntu to be gone, without a replacement. The next person who uses the computer will need an installation CD to install whatever OS they want on it. It's OK if all data are deleted but that's not the point.
 
Old 11-22-2010, 05:18 PM   #2
udaman
Member
 
Registered: Oct 2010
Location: New England, USA
Distribution: OpenSUSE/Slackware64/RHEL/Mythbuntu
Posts: 189

Rep: Reputation: 39
First use mkfs from a live CD to wipe all data from each partition.
Then use 'fdisk' and delete all partitions.
 
Old 11-22-2010, 05:18 PM   #3
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
Quote:
Erasing a hard drive is not what I want. I want to erase the operating system.
huh?


dd if=/dev/urandom of=dev/sda
 
Old 11-22-2010, 05:21 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If you want that your harddisk looks blank, just erase the master boot record.
Warning, this is malicious code, do not do this on production systems, or your home systems, if you don't intend to do what the OP wants !!!!!
Code:
sudo dd if=/dev/zero of=/dev/sda bs=512 count=1
This will overwrite the master boot record, and with it the partition table. You can do this from a running Linux system, as you intended. Your harddisk seems to be blank after this operation, but all your data is still on the disk. In almost all cases you can restore your partitions using testdisk.

Edit: Forgot to mention, your system will continue to work after this operation, but if you reboot it is "magically" gone.

Last edited by TobiSGD; 11-22-2010 at 05:24 PM. Reason: added info
 
Old 11-22-2010, 05:26 PM   #5
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
If you do not over write the entire drive then retrieving the old data is trivial.
 
Old 11-22-2010, 05:36 PM   #6
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
Originally Posted by frndrfoe
Quote:
Erasing a hard drive is not what I want. I want to erase the operating system.
huh?
My thought exactly.

I don't understand what would be "ok" data to leave on the drive and where the line is drawn between what is an operating system file and what is not. If the concern is to not let Mr. X know what OS you were using, then you need to realize that certain data can tell exactly what operating system it was created/used with or give strong hints (for example, *nix operating systems use different text file newlines from Windows and Mac, and Windows uses different text file newlines from Linux and Mac). A computer savvy user would probably know the difference.

Anyway, similar to udaman's suggestion... When you're done, use a bootable CD and run the shred command to wipe the drive.

It will do multiple passes by default, which limits even forensic analysis/recovery.
 
1 members found this post helpful.
Old 11-22-2010, 05:47 PM   #7
udaman
Member
 
Registered: Oct 2010
Location: New England, USA
Distribution: OpenSUSE/Slackware64/RHEL/Mythbuntu
Posts: 189

Rep: Reputation: 39
Quote:
Originally Posted by Dark_Helmet View Post
My thought exactly.

I don't understand what would be "ok" data to leave on the drive and where the line is drawn between what is an operating system file and what is not.
Agreed. Where does one stop and the other begin?
Quote:
Anyway, similar to udaman's suggestion... When you're done, use a bootable CD and run the shred command to wipe the drive.

It will do multiple passes by default, which limits even forensic analysis/recovery.
That's new to me, thanks for the tip.
 
Old 11-22-2010, 06:01 PM   #8
evaristegalois
Member
 
Registered: Sep 2006
Distribution: Ubuntu 14.04
Posts: 41

Original Poster
Rep: Reputation: 15
Quote:
use a bootable CD and run the shred command to wipe the drive
sounds good.

Quote:
if you reboot it is "magically" gone
This is basically what I need, but running shred will obviously enhance undetectability. (i) Erasing the operating system as opposed to (ii) erasing the data just means that I don't want the next person using the computer to see what OS I was using. I understand that (i) implies (ii), but the two are not the same.
 
Old 11-22-2010, 06:05 PM   #9
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
@udaman:

You're welcome! I usually boot a Knoppix CD (99% sure it has shred), start shred'ing the whole drive, do something that occupies a LOT of time, and then use factory restore CDs to get the machine running again.

I've done that for a couple people before they sell a laptop on Ebay. Turns out one of my friends got scammed. It sucked that they lost the laptop, but it made me feel good that the scammers couldn't recover any of my friend's personal info to use/sell.
 
Old 11-22-2010, 06:09 PM   #10
evaristegalois
Member
 
Registered: Sep 2006
Distribution: Ubuntu 14.04
Posts: 41

Original Poster
Rep: Reputation: 15
Thanks again.
 
Old 11-22-2010, 06:54 PM   #11
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
shred will over write the files but leave the filesystem. dd to the raw device will destroy everything
 
Old 11-22-2010, 07:01 PM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by frndrfoe View Post
If you do not over write the entire drive then retrieving the old data is trivial.
Of course it is:
Quote:
Your harddisk seems to be blank after this operation, but all your data is still on the disk. In almost all cases you can restore your partitions using testdisk.
 
Old 11-22-2010, 07:47 PM   #13
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
Originally Posted by frndrfoe
shred will over write the files but leave the filesystem. dd to the raw device will destroy everything
That is not correct.

If you shred individual files within a filesystem then that is true.

If you shred the device file then everything (MBR, partition table, file allocation tables, EVERYTHING) is eliminated. For example:
Code:
shred /dev/hda
You can shred the device entirely, a partition, or individual files.

Quote:
Originally Posted by linux.about.com
Delete FILE(s) if --remove (-u) is specified. The default is not to remove the files because it is common to operate on device files like /dev/hda, and those files usually should not be removed. When operating on regular files, most people use the --remove option.
(emphasis added) - taken from linux.about.com shred page

Last edited by Dark_Helmet; 11-22-2010 at 07:50 PM.
 
Old 11-22-2010, 09:11 PM   #14
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
Quote:
Originally Posted by Dark_Helmet View Post
If you shred the device file then everything (MBR, partition table, file allocation tables, EVERYTHING) is eliminated.
thanks for the clarification, I have not tried that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: The non-operating system operating system LXer Syndicated Linux News 0 06-26-2010 05:42 PM
Tracing Intruders connecting to our system in Redhat Linux operating system vkunasani Linux - Software 4 02-15-2010 06:23 AM
'Operating system not found' Any operating system installed wont work. TechniSlave Linux - Newbie 55 02-09-2009 11:02 AM
Total Noob Question (Operating System vs File System) fuzzy1 Linux - Newbie 14 02-06-2009 10:33 AM
My grub is not loading on dual operating system with windows Xp Pro causing my system marlene tack Linux - Newbie 2 03-17-2008 07:54 AM

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

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