Published on Tuesday, February 12th, 2008 at 2:57 pm

check HDD

#fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0?00068ef9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        9327    74919096   83  Linux
/dev/sda2            9328        9729     3229065    5  Extended
/dev/sda5            9328        9729     3229033+  82  Linux swap / Solaris

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0?00000000

 Let’s get going!
Removing and creating a partition
Having decided your drive’s name (let’s call it sda) we must now remove the default partition that the manafacturer put there:

Code:
#fdisk /dev/sdb

This will start fdisk. We want to remove the partion(s), there should only be one.
Press d <enter>(for delete).
It might ask you for the partition number, press 1 and enter. If there are more then delete them too.

Now to make a new partition.
Press n <enter> (for new), then p <enter> (for primary), then 1 <enter> and then simply press enter for the next two questions.
This will make a new partition that uses the entire disk. If you want more complex partitioning then read the fdisk manual (man fdisk) or use parted or some other app.
Here’s what we did with n, the values will differ from yours:

Code:
Now Command (m for help): n                                                    
Command action                                                             
   e   extended                                                            
   p   primary partition (1-4)                                             
p                                                                          
Partition number (1-4): 1                                                  
First cylinder (197-621, default 197):                             
Using default value 197                                                    
Last cylinder or +size or +sizeM or +sizeK (197-621, default 621): +128M

Now to write the new partion and exit, press w and enter.
You should be ready to make a filesystem now.

Making a filesystem : “Formatting”
You need to put a system in-place, on the disk, such that it can handle files. This is called (unsurprisingly) a filesystem.
The one we are going to use is called “ext3?. On Gnu/Linux we are spoiled for choice and there are loads of filesystems you can use, go do some research if you want to.
So, let’s make the filesystem:

Code:
#mkfs.ext3 /dev/sdb

* Note the 1 at the end, because we are making the filesystem in that partition (thanks Mike)

Now it will go off and do strange stuff, simply wait for it to finish.

Using the new file system
Well, at this point you should be able to right-click on the icon (on your Desktop) and choose “mount” (I assume that’s the verb it will present to you). After that you should be able to open a window and use the drive*
* all this assumes it’s an external USB drive.
If you cannot then you will need to mount it yourself, try:

Code:

#mkdir /media/box
#mount /dev/sdb /media/box

Note: We are actually mounting the first partition on the drive, hence the 1 at the end: sda1
And the mounted directory can be anywhere you like, but its common location is /media.

ref : http://ubuntuforums.org/showthread.php?t=267869

Related Posts

One Response to “How to format a new hard disk. on ubuntu”

  1. < blockquote >< a href=”http://cheaptabletsonline.com/”>CheapTabletsOnline.com. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.Best quality drugs. High quality drugs. Buy drugs online< /a >…

    Buy:Advair.Lipitor.Acomplia.Zetia.Amoxicillin.Female Cialis.Nymphomax.Aricept.Seroquel.Ventolin.Benicar.Female Pink Viagra.Zocor.Cozaar.Prozac.Lipothin.Lasix.Wellbutrin SR.SleepWell.Buspar….

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>