Posted by: isaraffee | February 12, 2010

How to format hard disk using Linux fdisk

How to format hard disk using Linux fdisk

Picture this scenario; you have an extra hard disk which you want to format it with fat 32 LBA, ext2, or other filesystems, using your Linux fdisk command.

This exercise requires you o have a Linux box and yes you will need to open your chassis and look for the IDE cable. Make sure you do this with the power switch off.

Connect the extra hard disk as a slave. You will need to check for jumpers in the extra hard disk.

In my case I disconnect my DVD drive and connect the cable to it. This way my extra hard disk will be detected as a slave.

When you have done with the hard disks connections, power up the Linux box, and check that the CMOS detected both hard disk and that the primary and save hard disks are detected.

After you have logged in to your LInux box )in my case it’s slackware 12), open a terminal console and type

fdisk -l

And yes you need to be root user.

You will see entries like these

/dev/hda <– this is your main hard disk, you don’t want to format this

the other entry will be like this

/dev/hdb or /dev/hdc , it’s all depends how you connect your extra hard disk.

Let’s say your extra hard disk is stated as /dev/hdc, to go to the formating menu and prepare for the hard disk to be formatted, type:

fdisk /dev/hdc

Don’t worry this won’t format your hard disk yet.

You will be presented with a menu. To go to the menu at any point type m and to quit without saving type q.

First create a partition by typing n. You will need to set the first and the last cylinder. In my case, I just except the default suggested values.

Next type p to view the partition that you have created. You will see that he default partition type is Linux’s ext filesystem. This is denoted by the number 83.

Now let’s day you want to change the filesystem from Linux to FAT32 LBA. Why well maybe you want to preapre this hard disk to be installed with Windows XP or something like that.

So to change the file system type at the meny, type t.

Then type c to change the filesystems to FAT32 LBA. You can see a whole list of file systems by typing L, I think. Anyway just see the menu screen.

To commit the changes, type w (for writing). Afer that quit the program by typing q.

Now reboot your computer and after reboot you can verify that the newly formated hard disk by typing:

fdsik -l

Take note of the partition type. Now in my case, I powered down the computer, took out the newly formatted hard disk and put it to another PC to install a different OS.Guess what, yes, Windows XP.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: