Tux

...making Linux just a little more fun!

How do I reformat an Ubuntu installation?

Derry [fajd at tpg.com.au]


Thu, 29 Nov 2007 23:05:29 +1100

I have SUSE 10 on my PC and installed Ubuntu which has partitioned my hard drive. I want to reformat the hard drive to allow a clean reinstall of Ubuntu 7.10 only from a desktop CD. I've tried using "fdisk" but get the error message "Unable to open /dev/hda" which suggests a problem somewhere, yet Ubuntu currently runs with out any problems. Do I continue with fdisk? If so, how? Or try something else? Once reformatting is successful, will the PC boot directly off the CD or do I need to make a boot disk of some kind? Many thanks for any tips.


Top    Back


Minh Nguyen [nguyenminh2 at gmail.com]


Thu, 29 Nov 2007 23:42:51 +1100

Derry,

[...]

> I've tried using "fdisk" but get the error message "Unable to open /dev/hda" which suggests a
> problem somewhere, yet Ubuntu currently runs with out any problems.

Is your master hard disk an IDE HDD or a SATA HDD? I've come across a similar problem when trying to install Slackware 12.0 on a PC. Then I realised that the PC's specifications contain a SATA HDD, so I used cfdisk to reformat /dev/sda, which was the master HDD.

> Do I continue with fdisk? If so, how? Or try something else? Once
> reformatting is successful, will the PC boot directly off the CD or do I
> need to make a boot disk of some kind? Many thanks for any tips.

I think Rick Moen has somewhat addressed this problem in this month's thread "uninstalling linux". His tip is to boot your PC with a live CD/DVD distribution, then execute the following command to reformat your hard disk:

dd if=/dev/zero of=/dev/sdXX bs=512 count=1
In the same thread, I also talked about using Knoppix to wipe out all partitions on an HDD. Just in case you haven't come across this tip, I've reproduced it below:

A "quick and dirty" way is to get yourself a copy of a Knoppix distribution. Perhaps from Knoppix 5.x onwards, maybe from 3.x onwards would also do the job. Here, I assume that you use Knoppix 5.0.1 or 5.1.1 CD/DVD distribution.

[1] Set up your BIOS to boot a CD/DVD drive first.

[2] Boot up the Knoppix live CD/DVD. This will take a while to load X and get you into KDE, a graphical session under Linux.

[3] Once KDE is ready to use, locate the "K" icon in the bottom-left corner of your screen. This is the menu for KDE, similar to the "Start" menu under Windows XP.

[4] Click on the K menu and locate "System". You need to be patient with live CD/DVD distributions, depending on your system's hardware specifications. Once the "System" menu pops up, click on a program called "QTParted". I think there are two icons for this tool within the "System" submenu:

1. QTParted (create, reorganize and remove partitions)
2. QTParted (QTParted)
You can choose either of these two programs.

[5] I assume that you're using IDE HDD(s) and IDE CD/DVD drive(s). Once QTParted is up, you need to familiarize yourself with the "Device" tree on the left side of the program window. If you have two IDE HDDs, then your master hard drive will be /dev/hda (this is also the case if you have only one IDE HDD), and your slave drive will be /dev/hdb. Your IDE CD/DVD drive(s) will be /dev/hdc for the master drive, and /dev/hdd for the slave drive.

[6] Familiarize yourself with /dev/hda and/or /dev/hdb, as the case may be. Note down the drive and/or partition(s) that you want to delete/wipe/format/reformat. Say you want to keep /dev/hda intact, but you want to wipe everything on /dev/hdb. Then on the "Device" tree, click on /dev/hdb. A visual representation of the drive should appear on the right side of your screen. This is similar to what you would get if you have ever format/reformat/defragment drives under Windows XP.

[7] Right click on any partition to get yourself familiar with the options for formatting, resizing or deleting partitions/drives.

[8] In your case, I assume that you want to delete all partitions on /dev/hda. In the "Device" tree, click on /dev/hda. Then right click on a partition and choose "Delete" to wipe it out. This won't actually wipe out the partition, yet, but just an indication that you want to wipe it. Do this for as many times as you have partitions. Once you're happy that all partitions have been marked for deletion, go to File -> Commit. Be cautious here; this will actually wipe out all partitions that you've marked for deletion.

[8] Once all partitions on /dev/hda have been wiped out, reboot your machine. If everything goes well, you should now be able to install/reinstall MS-Windows XP on /dev/hda.

Regards

Minh Van Nguyen


Top    Back


Minh Nguyen [nguyenminh2 at gmail.com]


Thu, 29 Nov 2007 23:51:51 +1100

Derry,

[...]

> [8] Once all partitions on /dev/hda have been wiped out, reboot your
> machine. If everything goes well, you should now be able to
> install/reinstall MS-Windows XP on /dev/hda.

[8] Correction: Once all partitions on /dev/hda have been wiped out, reboot your machine and do a fresh install from your distribution CD/DVD.

Regards

Minh Van Nguyen


Top    Back


Neil Youngman [Neil.Youngman at youngman.org.uk]


Thu, 29 Nov 2007 13:21:40 +0000

On Thursday 29 November 2007 12:05, Derry wrote:

> I have SUSE 10 on my PC and installed Ubuntu which has partitioned my
> hard drive. I want to reformat the hard drive to allow a clean reinstall
> of Ubuntu 7.10 only from a desktop CD. I've tried using "fdisk" but get
> the error message "Unable to open /dev/hda" which suggests a problem
> somewhere, yet Ubuntu currently runs with out any problems. Do I
> continue with fdisk? If so, how? Or try something else? Once
> reformatting is successful, will the PC boot directly off the CD or do I
> need to make a boot disk of some kind? Many thanks for any tips.

You could try booting the Ubuntu CD and see if the disk partitioning step offers an option to take over the whole disk. Most installers will repartition and reformat for you, but I'm not familiar with Ubuntu. The installation instructions should tell you.

Alternatively, if you have to wipe it beforehand, then when you're in linux try 'df -k' or just 'mount'. These will list your mounted filesystems. If the partitions start with /dev/sda then your hard disk is /dev/sda and you can reformat the disk using 'fdisk /dev/sda'.

Most PCs will boot directly off a CD, but you may need to alter the BIOS settings to allow it and/or to make it try the CD before trying to boot from the hard disk.

Neil


Top    Back


Minh Nguyen [nguyenminh2 at gmail.com]


Fri, 30 Nov 2007 00:53:42 +1100

Derry,

[...]

> You could try booting the Ubuntu CD and see if the disk partitioning step
> offers an option to take over the whole disk. Most installers will
> repartition and reformat for you, but I'm not familiar with Ubuntu. The
> installation instructions should tell you.

I'm talking about Ubuntu 6.10 here, but I think Ubuntu 7.10 is similar. Once you've booted into the default desktop session, locate an icon in the top left of your screen called "Install". You may find this icon underneath another icon named "Examples". Run the "Install" icon and carefully follow the instructions.

First you'll be presented with the "Welcome screen", followed by the "Where are you?" screen. Then you'll get the "Keyboard layout" screen, which is followed by the "Who are you?" screens. After that, you should be presented with the "Prepare disk space" screen. This screen presents you with three radio buttons; here's what they look like on my MacBook

1. Erase entire disk: SCSI1 (0,1,0) (sda) - 120.0 GB ATA TOSHIBA MK1234GS
2. Use the largest continuous free space
3. Manually edit partition table
But I think you can expect to see something similar to these three radio buttons. Radio button 1, the very top one, should allow you to automatically wipe out everything on your hard disk. Choose the top-most radio button and click "Forward". Carefully follow the instructions on the "Ready to install" screen. Once you're satisfied with your system's configurations, click "Install".

Regards

Minh Van Nguyen


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Thu, 29 Nov 2007 12:55:36 -0500

On Thu, Nov 29, 2007 at 11:05:29PM +1100, Derry wrote:

> I have SUSE 10 on my PC and installed Ubuntu which has partitioned my
> hard drive. I want to reformat the hard drive to allow a clean reinstall
> of Ubuntu 7.10 only from a desktop CD. I've tried using "fdisk" but get
> the error message "Unable to open /dev/hda" which suggests a problem
> somewhere, yet Ubuntu currently runs with out any problems.

Unless you're root, you won't be able to use "fdisk" to change the HD via "fdisk". Try 'sudo fdisk /dev/hda'.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

Top    Back