Table of Contents
While the installation process takes you through all the steps necessary in order to prepare a drive to install your system onto, you may find that you wish to add an additional drive at a later stage.
We will cover the steps you need to follow in order to achieve this:
Once you've installed the physical drive media in your machine, and booted up into Linux, you will need to check and see if the system has detected your drive.
You should consult the output of the dmesg command to verify this:
debian:~# dmesg [ ... ] hda: ST360014A, ATA DISK drive hdb: WDC WD100EB-00BHF0, ATA DISK drive hdc: 24X10, ATAPI CDROM drive [ ... ] Partition check: hda: hda1 hda2! < hda5 hda6 hda7 > hdb: hdb1 hdb2 [ ... ] debian:~# _ |
Here, we can see that there are two drives in the system (hda and hdb), and that the first drive has a primary partition (hda1) and an extended partition (hda2), which is further split up into 3 logical partitions (hda5, hda6 and hda7).
The second drive (hdb) only has two primary partitions (hdb1 and hdb2).
You must then use the cfdisk command to partition the new drive.
You will need to run the command with the device name of the new drive as a parameter.
Example, to modify the partition table on the second hard disk:
debian:~# cfdisk /dev/hdb |
Partition the disk to your liking, as discussed in the original installation section.
If you created any Linux partitions in the previous step, you will now need to create a filesystem on them. You will use the mksf command to achieve this. Again, you specify the device that you wish to create the filesystem on as a parameter.
If we wanted to create a Linux filesystem on the second partition of the second drive, we would use the following command:
debian:~# mkfs /dev/hdb2 |
Now you'll need to decide where you want to mount the new filesystem, and create the mountpoint. This is very simply, as a mountpoint is simply an empty directory.
For our example, we'll decide that we want to mount the new filesystem under /data:
debian:~# mkdir /data |
The last step will be to add the newly created filesystem to your fstab file, so that the filesystem will be mounted at boot time.
fstab before:
debian:~# cat /etc/fstab # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> /dev/hda2 / ext2 errors=remount-ro 0 1 /dev/hda1 none swap sw 0 0 proc /proc proc defaults 0 0 /dev/fd0 /floppy auto user,noauto 0 0 /dev/cdrom /cdrom iso9660 ro,user,noauto 0 0 |
fstab after:
debian:~# cat /etc/fstab # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> /dev/hda2 / ext2 errors=remount-ro 0 1 /dev/hda1 none swap sw 0 0 proc /proc proc defaults 0 0 /dev/fd0 /floppy auto user,noauto 0 0 /dev/cdrom /cdrom iso9660 ro,user,noauto 0 0 /dev/hdb2 /data ext2 defaults 0 1 |
The line that we added specifies that /dev/hdb2 should be mounted on the /data mountpoint, is of a ext2 type filesystem.
Now you can issue the mount command to mount this filesystem now:
debian:~# mount /data |