2010/02/18

How to Format a Hard Drive in Linux

Linux referes to hard drives as either 'hdx' or 'sdx' where x is a letter, starting with a, which represents the order in which the drive was added to or detected by the compouter. The 'hd' prefix is used for IDE and PATA (formerly just ATA), and the 'sd' prefix is used for SCSI, SATA and USB drives. Usually a number is also put at the end of 'hdx' or 'sdx' to denote different partitions on the same physical drive, but for the purpose of formatting you only need to know which letter the drive you want to format is.

You can see all the drives attached to your system by typing the command 'ls /dev/hd*' and 'ls /dev/sd*' depending on which type the drives are.

First you will use the 'fdisk /dev/' command to erase any old partitions on the drive and create a new one.

Then, you will use the 'mkfs -t /dev/' to create the filesystem on the drive.

Finally, you will edit /etc/fstab file to mount the drive whenever system is rebooted.