Add new hard drive to Debian Linux

Find out what the device name is for this disk

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

Partion the new disk using the following command:

cfdisk /dev/sdb

New -> Primary -> Specify size in MB
Write
Quit

Format the new disk using the ext3 filessystem

mkfs.ext3 /dev/sdb1

Mount the drive to a new folder

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

You can name the folder and place it in subfolders of another drive, for example /var/disk2

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

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

Now your new hard disk is mounted.