Add a second hard disk

Adding a additional hard disk to your workstation or server is easy and often required. Here’s we’ll step through the process of identifing the newly attached drive, prepare and mount it.

If you have just added a virtual disk to a virtual machine, make sure you restart the virtual machine before mounting the new disk.

1. Figure out the device name for the new device

fdisk -l

 

This will give you output similar to this:

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2517 20217771 83 Linux
/dev/sda2 2518 2610 747022+ 5 Extended
/dev/sda5 2518 2610 746991 82 Linux swap / Solaris
 
Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdb doesn't contain a valid partition table

2. Next we’ll partion the new disk using the following command:

cfdisk /dev/sdb
 
> New -> Primary -> Specify size in MB
> Write
> Quit

3. Format the new disk using the ext3 filessystem

mkfs.ext3 /dev/sdb1

4. Mounting the drive to a new folder

mkdir /disk2
mount -t ext3 /dev/sdb1 /disk2

You can name the folder whatever your want and place it in a subfolder of another mounting point, for example /var/disk2

5. Add the new drive to fstab so that it will automatically mount when we reboot the machine. Add the following line to your fstab file (pico /etc/fstab)

/dev/sdb1 /disk2 ext3 defaults,errors=remount-ro 0 1

Now your new hard disk is mounted and ready to use.

  • Adding, hard disk, second, new device
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing Postfix with MySql backend and TLS

In this tutorial we’ll install a ready to use Postfix mail server with MySql backend for virtual...

Installing ionCube

ionCube protects software written using the PHP programming language from being viewed,...

Installing PowerDNS on etch/lenny

The PowerDNS Nameserver is a modern, advanced and high performance authoritative-only nameserver....

Installing Zenoss monitoring system

Zenoss is an award-winning open source IT monitoring product that effectively manages the...

Upgrade from etch to lenny

Debian has released a stable version of Debian 5.0 (lenny). If you’re running previous version of...