Computer refuses to let us erase the hard drive
January 28, 2007 8:34 PM   Subscribe

How can I wipe a hard drive if I can't boot from CD and there is no floppy drive? We want to install winXP on a machine with Ubuntu (eventual dual-boot).

My friend's computer is not working. He installed ubuntu 6.10, and now it won't boot from CD. We have tried doing things to the grub, to no avail. We can't tell if the cdrom is hda or hdb or hd5hkjhjth. We can provide more details if this ends up being the best way to fix the problem.

There's another post on ask.mf, which explains lots of scary ways of accessing the hard drive through the internet or via a usb. Should we try them? Or should we buy a floppy drive for $5? Or should we take the hard drive out of his computer, put it in mine, and wipe it clean, then put it back and see if the CDrom will be read? We are at wit's end. Please help, ObiWans.
posted by billtron to Computers & Internet (14 answers total)
 
Booting from CD is a BIOS thing, not a Ubuntu thing. Are you sure there isn't a "hit any key to boot from CD" message during boot (but before Linux comes up) that you might be missing? Alternatively you can go into BIOS and set the CD-Rom to be the first boot device, after which it should try to boot from it every time no matter what.
posted by rhizome at 8:42 PM on January 28, 2007


In the first seconds after you turn on your PC, you will see a message that says something like:

"Press <DEL> to Enter BIOS Setup."

Do this. You will get into your BIOS. Explore the options (but don't mess around too much) until you find something that says:

"Change boot device order"

or

"Select boot device"

Muck about with this. Set it so it boots from CD-ROM as the first boot device.

Save and exit from your BIOS setup. Reboot your PC.

It should now boot from the CD-ROM. Once you've achieved what you want to achieve, remember to go back into your BIOS and change it back, so it boots from your harddrive as default.

If this doesn't work, then your CD-ROM drive is probably broken.
posted by Jimbob at 9:47 PM on January 28, 2007


(The other reason this might not work, by the way, is if the CD you are trying to boot from is scratched / corrupted. Although in this case you should see a "Booting from CDROM..." message come up before it fails.)
posted by Jimbob at 9:52 PM on January 28, 2007


if there's some menu that I can access before grub, I haven't been able to find it. When I get to grub, there is no boot to CD option. I figure it would be there if there was one. Am I wrong?

The CD-Rom drive works, because we can access information on discs from within Ubuntu.
posted by billtron at 10:10 PM on January 28, 2007


Sometimes you have to hit a function key during a brief window during bootup to get into the BIOS. There will be a message on the screen saying that, but depending on the machine and the settings, it may only be present for a fraction of a second. (On some computers, it's F10.)

I don't know what "grub" is, but if it's part of Ubuntu, then by that point you've already missed the BIOS.
posted by Steven C. Den Beste at 10:14 PM on January 28, 2007


So what you're saying is, when you turn on your PC you see nothing on your screen..totally blank..until the GRUB menu appears asking which OS you want to boot?

Have you tried repeatedly banging on the [delete] or [F1] keys after you press the power on button?

If all else fails, you might need to find your motherboard's manual. All modern PCs let you access your BIOS settings, and it's the first thing that happens after you press the power on button.
posted by Jimbob at 10:16 PM on January 28, 2007


others are correct. if you do not see BIOS messages before you see grub, something is amiss. google for your computer model and look for the BIOS key sequence, common options as mentioned before are 'delete', 'F1', 'F10', 'F11', 'F12', 'F2'. reboot and bang on these keys before grub is loaded and you might find yourself in the BIOS configuration where you can specify that you wish to boot from CD-ROM first.

if all else fails, there are a few options... google for 'grub boot CD' and you'll find a few things that you can download and install on the *nix side that will give grub a 'boot from CD' option. failing that, google for 'grub freedos' and you will find methods that let you boot to a FreeDOS floppy disk image from which you can pretend that you're on an old machine that boots from a floppy. failing that, there's one final dangerous option...

boot into the *nix that is installed, do a 'dd if=/dev/zero of=/dev/hda bs=512 count=1', where you replace hda with your actual hard drive info.... (as root type: 'mount' and look for a /dev/??? appropriate to your hard drive, probably it will be either "hda" or "sda"). this will *nuke* your boot block on the hard drive, and the machine should then look to the next device (hopefully your CD-ROM) for something to boot from. this last option is *extreemly* dangerous, but should force your machine to boot from the CD-ROM drive.
posted by zengargoyle at 11:15 PM on January 28, 2007


Everything folks have told you is correct. I just thought I'd add some explanation.

The boot process starts in the computer's BIOS; this is built-in to the machine, and doesn't rely on any operating system. The more recent your BIOS, the more devices you'll be able to boot from; the newest ones can boot from USB drives and network connections. But the 'boot' process is fairly simple... start up devices, load a few hundred bytes from the first one on the priority list, and transfer control to it. That's all.

That few hundred bytes is your bootloader. That's 'grub', or 'lilo' on some versions of Linux, or NTLDR if you're running Windows. Basically, once you get to the bootloader, it's too late to boot from CD... you already booted, more or less!

If you absolutely can't get the BIOS working, some bootloaders are smart enough to be able to load others. So you might be able to tell grub to 'chain' to another bootloader on another device. This is enormously harder than just booting directly, so you want to explore that option later.

One thought... obviously the machine did boot from CD long enough to get Ubuntu going. Many BIOSes will try the hard drive first, and then fall back to CD... as soon as it sees a valid bootsector on the drive, it stops trying the CD anymore.

As zengargoyle is saying, you might be able to just wipe your existing drive. If you don't care about the data that's on it now (and THINK ABOUT THIS), just boot up Ubuntu normally. Once you're up, open a terminal window and type 'mount'. Look through the list of mounted filesystems. You will have at least a "/" filesystem, the root. Look to see what device it's on.... for instance, you might see:

/dev/sda5 on / type ext3 (rw,noatime,errors=remount-ro)

This example line shows you that the device "/dev/sda5" is loaded on "/". This means that sda is most likely the boot drive. Your machine might be hda or hdc.... you're interested in the first three letters of your / partition.

Once you know that, you can wipe the drive this way:

dd if=/dev/zero of=/dev/sda bs=512 (substitute your correct device for 'sda')

This will destroy all data on the drive. Make sure you disconnect any drives with data you care about before doing this.

Let this run about ten seconds, hit control-c to break it, give it another ten seconds to write the data to the drive, and then hit the power. Don't bother shutting down, as you've wiped the start of the drive anyway. No sense worrying about the integrity of the filesystem(s) you've just destroyed. :)

You may then be able to boot from your Windows CD. But this won't totally solve the problem, in that once you get it going, you'll no longer be able to boot into Ubuntu for reinstallation as a dual-boot.... but it will at least get you back where you started. In theory.

If you've had a hardware failure, you may end up with a machine that won't boot at all, so think about this before doing it.

Note: after rereading, I see zengargoyle uses 'count=1' in his line. That means to write just one block. This is the bootsector. I'm not sure, anymore, what happens if you wipe just that one sector. My approach will absolutely wipe the drive completely; his may wipe only the bootsector, and preserve the data on the drive. But without experimenting, I wouldn't want to make that promise. My method is the nuke-from-orbit option, his is the surgical strike. :)
posted by Malor at 11:50 PM on January 28, 2007


Malor, if you want to do a fast nuke-from-orbit, use bs=1M instead of bs=512.
posted by flabdablet at 1:12 AM on January 29, 2007


During the ubuntu install your friend probably messed around with the bios and changed the boot order. You want to make the boot order cd drive then hard drive. Then you'll see a short 'press any key to boot from CD' when you leave a bootable CD in the drive before grub starts up.

Feel free to take the hard drive out while doing this. Grub lives on the hard disk, not on the computer someplace.
posted by damn dirty ape at 8:02 AM on January 29, 2007


I recently was trying to put Windows back onto a machine with Fedora Core 6. The bios setting was definitely boot from CD first. The "Hit Any Button to Boot From CD..." message popped up. I hit a button. The Windows XP boot CD failed to do anything. With different hard drive in same laptop, with same CD, no changes to BIOS, the WinXP setup went through without a hitch. It may just be the WinXP Setup process pukes on the strangely(ext3) partitioned HD.
posted by bastionofsanity at 8:15 AM on January 29, 2007


There's no point just running dd over the disk and ^Cing it after some random interval; the data you want to wipe appears to be the boot sector and the partition table (aka the MBR), and all that is in the first sector; the first 512 bytes. Without that, the disk won't boot, and the system won't know anything about any filesystems on it, but it won't wipe out part of any in-use data.

But yes, change the boot order in the BIOS; some have menus that let you do it temporarily too. Common keys to bring up the BIOS include Del, F2, F8 and F11; if the system's not telling you at startup, there should be documentation which will tell you. Any system in the past decade should be able to boot off CD.
posted by Freaky at 12:43 PM on January 29, 2007


Thanks for your help everyone. My friend read your responses and tried mashing keys as the computer booted and before the grub screen. He has successfully switched to boot from CD first, and he knows that the button required to access the bios setup screen is somewhere between F9 and F12, hit in conjunction with delete. Very odd.

Anyway, the computer is up and running XP, and he's about to install ubuntu. One last problem, however. His 320GB hard drive says it has about 300 GB. Is there some hidden partition left over from his previous ubuntu installation(s), and if so, how does he erase it?
posted by billtron at 9:20 AM on January 30, 2007


No one seems to have responded to your final question. It's been asked here before, but the short answer is that "320 GB" isn't really 320 GB. Disk makers use 10^9 as "giga", not 2^30. That turns out to be a difference of about 7%. Using units of 2^30, the "320 GB" drive should have a capacity of about 298 gigabytes.
posted by Steven C. Den Beste at 2:07 PM on February 2, 2007


« Older No blue box for you!   |   transforming chicken scratches with photoshop Newer »
This thread is closed to new comments.