To find out information about disk drives and partitions on a system:
A drive can be partitioned using the fdisk utility. Start fdisk using the following command:
Some basic fdisk commands include:
All storage devices require some form of file system so that they can be used by an operating system.
The most popular file systems in use for Linux desktop computers are ext2 and ext3. Simply put, ext3 is a newer version of ext2 with journalling, which allow the system to recover from serious errors more easily.
A device can be formatted using the utility mke2fs:
To mount a drive:
To unmount a drive:
To auto mount a drive at start up edit the fstab file:
A new line needs to be added to the end of the file. This should contain:
An example drive [hdDrive] mounted [/mnt/hdDrive] as ext3, is:
Always make sure there is a carriage return at the end of the last line or else the device will not mount
Physically install the hard drive and boot up the computer.
If the device has been recognised it will have been given a location on the system but will not be accessible until it is formatted and mounted. To find out the location of the drive, use the fdisk command (enter command AS ROOT):
Once you have found the location of your drive, you can use fdisk to partition it:
Enter p to view the partition table. Here you can check for any existing partitions (enter d and press return to delete) and check you are partitioning the correct drive by checking the size is as you expected.
Enter n and press return and then enter p to create a new primary partition. When asked for a number enter 1.
Next you will be asked which cylinder the partition should begin and then end at. You can accept the default values for both of these by just pressing return at each prompt.
Now back at the fdisk command prompt, enter w to write the partition table and exit fdisk.
Format the drive (as ext3):
Create a directory to mount the drive in:
To auto-mount the drive on boot, open the fstab file (enter command AS ROOT):
Add this line: /dev/hdDrive /mnt/hdDrive ext3 defaults 0 0 to the end of fstab (making sure there is a carriage return at the end of the last line)
Restart the system and the new drive should be accessible from the mount point you created in step 5.
Insert the USB drive into an available slot.
If the device has been recognised it will have been given a location on the system but will not be accessible until it is formatted and mounted. To find out the location of the USB drive, use the fdisk command (enter command AS ROOT):
Create a directory for the USB drive:
Mount the USB drive:
Go back to the How-to Guides main page.
Offering small businesses and individual users the opportunity to have their own website on the internet, our 'starter websites' are available for only £150.
To find out more and to see an example of the type of site offered, view our example starter website page.