ComTech: IT Support Stirling
TwitterFacebookGoogle

How to format a hard drive on Ubuntu 12.04 using Fdisk

ComTech: IT Support Stirling


Today I will show you how to format a hard disk using Fdisk.  Fdisk comes already installed on most modern Linux distributions by default.

For the purpose of this tutorial I will be using Fdisk on Ubuntu 12.04 to format a 16Gb USB penstick with the ntfs file system.

First we need to see what our 16Gb USB penstick is mounted as so open up a terminal and type:

sudo fdisk -l

and type your password when prompted.  You should get a screenshot similar to the one below.

In this case my 16Gb USB penstick is mounted at /dev/sdc1.

Next type:

sudo fdisk /dev/sdc1

and you should get the command prompt shown below.

Now we need to check the existing partitions on the penstick so type:

p

to get the screenshot below.

Now we know what is on the drive it is time to delete it so type:

d

You will then be asked for the partition number (1-4).  In my case I have 4 partitions on the disk and I need to delete them all.  So I will type 1 and this will erase the 1st partition only.  I would then be left with partitions 2 – 4 and to remove these I would repeat the procedure until all the partitions have been erased.

We now need to set up the new partition so in your terminal type:

n

Because this is the first partition on the drive type:

p

You will now be asked for a partition number.  Choose 1 and then press return.  When asked to specify the First Sector choose the default by pressing Return.  Again accept the default Last Sector by pressing Return.

Now that the partition parameters have been specified we need to write them to the hard drive and we do that by typing:

w

All that is left to do is to make the filesystem on the hard drive and to do that we type:

sudo mkfs -t ntfs /dev/sdc1

Next time I will show you how to accomplish the same task using GParted (for those who like a GUI).

About the Author

P1020114

Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows and Linux based IT Support, laptop repairs and computer repairs to both business and personal clients throughout Stirling, Falkirk and Clackmannanshire.

For a list of what I can offer you why not visit my website www.comtech247.net where you will find a list of my services, testimonials, blog and much more!!

 

 

 

 

 

 

2 thoughts on “How to format a hard drive on Ubuntu 12.04 using Fdisk

  1. Heber I already had a disk mounted at /dev/sdc (can be seen from screenshot). You are right about the whole new partition table but I prefer to do it manually (old habit!!).

  2. Hi Chris,

    /dev/sdc1 is the first partition, not the whole disk. Shouldn’t it be “fdisk /dev/sdc” instead? This way you will probably see a valid partition table as well.
    Instead of deleting all partitions manually, you could create a whole new partition table with “o” (not zero).
    After creating the new partition it is wise to change the filesystem id. Default fdisk makes a partition with fileystem id 83 (Linux), use “t” to change this to “7″ if you are going to format it as a ntfs filesystem.

    Regards,
    Heber

Leave a comment

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *

CyberChimps
Follow

Get every new post delivered to your Inbox

Join other followers

WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera
WP Like Button Plugin by Free WordPress Templates