Ubuntu Linux Guide

Ubuntu Linux help provides detailed instructions to help troubleshoot ubuntu linux software and hardware problems.

Steps to format/partition a hard disk drive - - Ubuntu

 
Loading...

Determine hard drive information

Step 1. If you are trying to format or partition your hard drive it is assumed that bios is able to detect the device. To determine the path and other specific information about your drive open a terminal window and enter this command:

"sudo lshw -C disk"

Step 2. After entering this command Ubuntu should return something similar to this. Take note of the "logical name" because this will be used throughout the partitioning process if done via terminal window.

Step 3. The part we will be most concerned with will be the hard drive information that is displayed in the terminal window.

What file system to use.

If you plan on using the hard drive only for Ubuntu then the recommended filesystem to use is either ext3/ext4 depending on whether or not you need backwards compatibility with previous versions of Linux. If you will need to share files between Ubuntu and Windows machines fat 32 is the recommended file system to use, but NTFS will also work well also.

Format & Partition hard drive using disk utility - Ubuntu 11.04

Step 1. First navigate to the control panel and click on the disk utility. If your disk already contains a partition and you would like to re-size it to make room for a separate partition see below.
Step 2. In the disk utility select the drive on the left hand side that you would like to format/partition. If you are formatting be sure the drive is non mounted. You can un-mount it once you have selected it. A new window will open asking you what scheme you would like to use to format the drive.The Master Boot Record scheme will work with Ubuntu and Windows operating systems. It will also work with Macintosh operating systems however the operating system will not be able to be installed on this disk. The apple system will still be able to read the data contained on the disk.
Step 3. After your drive is formatted (or if it was already) you can select the Create a Partition button.

Step 4. After clicking Create a Partition you will see a screen similar to the one above. Here you can adjust the size of your partition as well as its type and name. You can also have Ubuntu take ownership of the filesystem. This prevents you from loading a different OS on it. Also you may be unable to read the drive from certain OS.

Finish. That's it. Your drive is now formatted/partitioned. Repeat as needed.

You can change the type of partition that will be created based on your own needs. This website will provide you with all the information you will need to decide which partition scheme to use, as well as the partition type most appropriate for your needs.

Partition using command line in Terminal.

The program you will use to do this is fdisk. You will need to refer back to the logical name of your drive found earlier to use this method.


Step 1. Start fdisk with this command

Step 2. Press "m" then hit enter. This will return a menu like the one below showing all of the available commands for the fdisk program.

Step 3. Since we want to add a new partition press "n" and then enter.

Step 4. To create a primary partition (what we want) press "p" and then hit enter.
Step 5. If you only want 1 partition press "1" and hit enter. You may be provided with a default response, you may choose this as the Partition number if you would like. Next you will be prompted for the locations of where you would like the first and last sectors of the partition to be. You may again be provided with default responses, choose these if you want.
Step 6. Now choose w to write the partition to the disk. Type "w" then press enter.Your drive is now partitioned. Now we need to format it. By default Linux will recognize this partition as dev/sdb1.
Step 7. To format the partition with an ext3 filesystem. . .  sudo mkfs -t ext3 /dev/sdb1To format fat32 replace the "ext3" with "fat32"

Free up space for a new hard drive partition.

If you want to make a new partition on an already partitioned drive you will need to free up space for the new partition be re-sizing the old one.

If you navigate to system, then administration, then partition editor you will be able to re-size the existing partition. 

First you will need to un-mount the drive if it is currently mounted. You will never be able to alter partitions on a mounted drive. 

To resize the partition simply click re-size and drag the handles to the appropriate size or type the size you want into the free space Mib box.

Mount drive on start-up.

First you will need to open Terminal and edit the file /etc/fstab using the following command:

sudo gedit /etc/fstab

Then add this line to the end of the file for ext3 filesystems: 

/dev/sdb1 /media/yourdrive ext3

Add this line for fat32 filesystems:

 /dev/sdb1 /media/yourdrive vfat

Now reboot your computer for the changes to take effect.  

Create a custom mount point.

With the disk now partitioned and formatted you will need to create a place to mount this drive. Use this command to make a new directory, in this example "/media/yourdirve" will be the mount point.

sudo mkdir /media/yourdrive

 To manually mound this drive use the command below.

sudo mount /dev/sdb1 /media/yourdrive

More guides . . . . .

Ubuntu 12.04