diff options
Diffstat (limited to 'src/Linux:Formatting_a_Hard_Drive.ascii')
-rw-r--r-- | src/Linux:Formatting_a_Hard_Drive.ascii | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/src/Linux:Formatting_a_Hard_Drive.ascii b/src/Linux:Formatting_a_Hard_Drive.ascii new file mode 100644 index 0000000..51ef09b --- /dev/null +++ b/src/Linux:Formatting_a_Hard_Drive.ascii @@ -0,0 +1,108 @@ +Linux:Formatting a Hard Drive +============================= +:author: Aaron Ball +:email: nullspoon@iohq.net + + +== {doctitle} + +Good afternoon everyone or good evening/morning, depending on which time zone +you're reading this from... + +*Ahem* + +Good afternoon from GMT -7 everyone (much better), + +If you've done anything with Linux-based servers you have most likely at one +time or another had to format a hard drive, which unfortunately can be quite +the feat in Linux if you're not too comfortable with the command line (which if +you're a linux sys admin, you shouldn't be). In this post, I will be describing +how to format an ENTIRE drive (doing a portion is a bit more complicated...post +in the comments section if you want to see a post on how to do a partial +format). + +[[finding-which-drive-to-format]] +== Finding which drive to format + +To start off, we need to find the disk that needs to be formatted. Do this by +typing + +---- +sudo fdisk -l +---- + +If the disk has not been formatted you should +see + +---- +Disk /dev/ doesn't contain a valid partition table. +---- + +If the drive has already been formatted you need to either identify the drive +by the amount of space (the blocks column...it's in kilobytes. For example: +249023502 is roughly 250 gigabytes). Another method is to use + +---- +mount -l +---- + +The drive should show up as **/dev/ on /media/**. + + +[[formatting-the-drive]] +== Formatting the drive + +To start up the format process, let's type + +---- +fdisk /dev/sdc +---- + +(sdc is our example drive. The drive you want to format was found in the +previous step). + +If your drive already has a partition table, you need to delete that. Do this +by typing the letter *"d"* and pressing enter. + +If the drive is NOT formatted yet, all you need to do here is press the letter +**"n"**. + +Fdisk will now prompt you to give it a start and end block for the partition +(this is essentially how much of the drive to create the partition table for). +If you want to format the entire drive, just hit enter twice to select the +defaults (the first and the last blocks...the entire drive). + +Now that we've selected which parts of the drive to format, press *"w"* to +write the changes to the disk (up to this point, no changes have been made so +if you want to get out, now is the time). + +Now that we've formatted the drive and created the partition table, we can +mount the drive. To mount the drive, there are two options. + +First, the drive can be removed and plugged back in. This will cause an +auto-mount (if that's enabled on your machine). The other way is to use the +mount command. To do this, we need a mount point. This can simply be a folder +where your drive will show up (without getting too complicated). For this +example, I'll put a folder at *. + +Now, earlier when we formatted the hard drive, we formatted the drive located +at* (drive sdc partition 1). Now, with that out of the way, let's mount +partition one. + +Type * + +What that does is mount partition one (/dev/sdc1) at *. + +Many people say practice makes perfect. With that, go practice formatting on +all of your hard drives and usb sticks. :) + +Once again... + +*Disclaimer: I am not responsible for any loss of data or damage to +personal property due to attempting the contents of this article.* + + +Category:Linux + + +// vim: set syntax=asciidoc: |