Formatting a hard drive is used to setup a hard drive for storage and setting up an empty file system prior to installing an operating system to the hard drive.
- In the command prompt, input “fdisk /dev/hdb”, with the “hdb” as the letter of your drive. If your drive’s letter is “C”, then input “fdisk /dev/c”.
- Once fdisk is opened, it may or may not give system warnings. Note that you can ignore those warnings.
- Fdisk should give you a prompt that says “Command (m for help):” Input the letter “P” to display the partition table of the hard drive, and make sure you are working on the correct drive you want to format. If there are partitions available on the hard drive, it will be shown on the last line of the “P” command that you did.
- Input the letter “D” and hit the enter key on your keyboard to delete partitions shown on the “P” command. If there are several partitions available, do the “P” and “D” commands simultaneously to remove those partitions. Ensure all partitions are deleted before creating a new partition.
- Input the letter “N” to create a new partition in the hard drive. One the “N” command has been inputted in the command prompt, hit the enter key and press the “P” key on your keyboard to establish the primary partition by pressing the number 1 and the enter key. The number 1 represents the primary partitioned space on your hard drive.
- After establishing the primary partition, you will be taken back to the fdisk’s command prompt. Check the partition table and ensure that the new partition was established. This is done by via the “P” command.
- Establish the file system type by hitting the letter “T” on your keyboard. Input the numbers “83” when fdisk requests for the Hex code you will be using.
- Hit the “W” letter on your keyboard to create the new partition and exit fdisk’s command prompt.
- Input “mkfs -t ext2 /dev/hdb1” on the command prompt to create the new file system on the hard drive. Remember to change “hdb” to your drive’s letter. As an example earlier, if the drive’s letter is “C”, input “mkfs -t ext2 /dev/c1” on the command prompt. “C” represents the drive’s letter and “1” represents the partitioned space where we will be creating the new file system.
- Input “fsck -f -y /dev/hdb1” on the command prompt to finalize the formatting of your hard drive and then mounts this drive every time your computer starts. Remember to change “hdb” to your drive’s letter. As an example earlier, if the drive’s letter is “C”, input “fsck -f -y /dev/c1” on the command prompt. “C”, again, represents the drive’s letter and “1” represents the new partitioned space that needs to be mounted every time the computer starts.
- Restart the computer after “fsck” process ends and you can now begin the process of installing the new Operating System.
Formatting the hard drive when using the Linux operating systems is easy but make sure that it is the last thing you want to do as formatting a drive also includes creating a back up for your files before reformatting the hard drive.