Add / Mount a New Hard Disk : Linux Server

One of the first problems encountered by users these days is that they run out of disk space to store data. Fortunately, disk space is now one of the cheapest of all IT commodities. In this chapter, we will look at the steps necessary to integrate a new disk drive into a Linux ( Debian )system.

We will be using fdisk utility.

For the test, I have added a new raw hard disk with 20 GB Capacity. This will be later mounted as /fog. Fog is an open source deployment software. I will be using this drive /fog to store FOG project images.

Adding a raw Hardisk
Adding a raw Hardisk

Now power on your Linux instance and login with user root or any other users with sudo access.

Run fdisk -l command.

List Disk
List Disk

New disk added is shown here as /dev/sdc

To partition a particular hard disk ( /dev/sdc ) : fdisk /dev/sdc

ValueDescription
nCreate Partition
pprint partition table
ddelete a partition
qexit without saving the changes
swrite the changes and exit
Create New primary partition
Create New primary partition
Ok - first thing - primary and logical partitions are concept for MBR disks only.
For modern GPT format disks - all partitions are primary.

Differences between primary and logical:
1st you can boot only from primary partition (i.e. bootloader partition always is primary)
2nd there are limitations of how many primary partitions on MBR disk you can make:
max is 3 primary and 1 extended or 4 primary. So if you need more than 4 partitions on single MBR disk, then you'll have to use extended partition. 
- http://www.tomshardware.co.uk

Accept default partition number, unless you don’t have any special requirement to change.

Assign a Partition Number
Assign a Partition Number

Assign first sector to value : 2048 ( default ).

Assign Sector to Partition
Assign Sector to Partition

Provide the size of the partition. Use + prefix. For now, we will use 18 GB ( Total was 20 GB – 2048 MB for the first sector )

Assign Partition Size
Assign Partition Size

Save change using option w and exit. Now the disk is created. Run fdisk -l to see the newly created partition.

Partition changes
Partition changes

Now format the disk with mkfs command.

Format new partition
Format new partition

Create a folder and mount new partition as shown below:

Create a new directory
Create a new directory
Mount new hard drive
Mount new hard drive

In order to set up the system so that the new file system is automatically mounted at boot time, an entry needs to be added to the /etc/fstab file. This file may be edited by an editor and add the following line:

Editing-fstab-file
Editing-fstab-file
mm

Anup Chhetri

IT system administrator

You may also like...

error: Content is protected !!