This post is meant to be a simple walk-through on how to mount a new drive on your Linux System.
Here we will take a scenario of mounting a new drive ?backup to store backup of your system..
***WARNING*** ***WARNING*** ***WARNING***
” What ever you do make sure to NOT use the command “fdisk /dev/sda” or “fdisk /dev/hda” as that means you are editing your main and boot partition ”
So let us begin..
Quote:
First run fdisk to look at your available disks.
# fdisk -l
Disk /dev/hda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 268 2048287+ 82 Linux swap
/dev/hda3 269 9726 75971385 83 Linux
Disk /dev/hdc: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
What we see above is two separate disks, one being hda and the other is hdc. The hda is the main boot drive which should not be played with !
Quote:
The second step is to format the drive. ( If the drive is hdb, hdd, sdb, sdc, sdd simply replace it with “hdc” )
#fdisk /dev/hdc
-press “n” for new partion
-press “p” for primary partition
-press “1″ for the first partition
-press enter for the first AND last cylinders. This will make it automatically use the entire disk
-press “w” for write out to save what you have done
The next step is to make the file-system readable by Linux. You need to format it using ext3 which is widely used file-system .
#mkfs.ext3 /dev/hdc1
Note that I have used “hdc1″ because it is the first partition. Now we are going to set the disk to automatically be mounted on boot as /backup.
Quote:
#mkdir /backup
#vi /etc/fstab
Add the following line:
/dev/hdc1 /backup ext3 defaults 1 1
Verify if this new drive is mounted.
#mount /backup