Formatting a hard drive in Linux


Imagine the situation.  You are using Linux and you want to format a particular hard drive.  What tool would you use?  If you like GUI’s then the best tool to use would be GParted.  But what if you think that GUI’s are not your thing and you want to use the command line?  Then you want fdisk.

Ok here goes, open up a terminal and type su.  When prompted enter your root password.

Type fdisk /dev/device (where device is the ID of your hard drive you want to format eg sda)

Next you want to check for any existing partitions on the drive by pressing p.

You now want to delete any existing partitions by pressing d.

Press n to construct a new partition on the hard drive.

When you get the choice of specifying cyclinders use the default for first and last (unless you have a specific need to change them).

Now we need to write the partition to the disk and we do this by pressing w.

It is now time to make the filesystem on the partition.  First off though you have to choose the file system you want.  At the moment the best one to use in Linux is ext4.  If however you intend to use the hard drive with Windows at some point then use NTFS.

In your terminal type mkfs -t ext4 /dev/device (where device is the ID of your hard drive you want to format eg sda).

All that is left to do is mount the hard drive.  If the hard drive is an external one then it will be automatically mounted when you plug it in.  However if the drive is an internal IDE or SATA drive you will need to enter it into the fstab file which is covered here.

About the Author

Hi I am Chris the owner of ComTech. I provide IT Support, Laptop repairs and Computer repairs to both personal and business clients in and around Stirling. For a list of what I can offer you why not visit my website www.comtech247.net where you will find my blog, testimonials, services and much more.  Start supporting a local business today so I can start supporting you.

If you found this blog useful then why not sign up to my RSS Feed for news, tutorials, views and general techie stuff!!

 

 

 

 

This entry was posted in Blog and tagged computer repair, fdisk, format, gparted, hard drive, IT Support, laptop repairs, linux, stirling. Bookmark the permalink.

One comment on “Formatting a hard drive in Linux

  1. Thanks for making the effort to explain the terminlogy for the starters!

Leave a Reply

Your email address will not be published.

50,726 Spam Comments Blocked so far by Spam Free Wordpress

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>