Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.