Add an extra hard-drive in CentOS 6

In this post, we are going to add an extra drive to store binaries for the CTPIT installer or a full FileNet installation. I would suggest setting the new disk as type Write-Through. That means it won’t be affected by snapshots, which is convenient in that case since we don’t need to snapshot it.

To do this, edit the Virtual Machine’s settings, go to Storage, and attach a new disk. Then go to the Virtual Media Manager (Ctrl+D), modify the disk you’ve just created and set the type on Writethrough.

Now, the first time you will be using this disk on a VM, you will have to create a partition, format it and mount it.

Create the partition

First you need to find what is the device name for the OS. By default, there is a good chance it’s /dev/sdb, but you can check by running a ls in the /dev folder:

ls /dev/sd*

Here we can see sda already has 2 partitions, so that’s the main disk, and sdb has none, that’s our disk. We will use fdisk to create the main partition on our disk sdb:

fdisk /dev/sdb

Then type:

  1. n to create a new partition
  2. p to create a primary partition
  3. 1 to number the partition as first
  4. 1 (or leave empty) to start on first cylinder
  5. last cylinder (or leave empty) to end on last cylinder
  6. t to change the type of the partition
  7. 83 to select linux partition
  8. w to write the change

Format the partition

We now have a main partition on our disk. Run again the ls command and you’ll see it:

ls /dev/sd*

We are going to format the new partition /deb/sdb1 which we juste created.

You can use the mkfs command for the file system you want to use. We will use ext4 here:

mkfs.ext4 -b 4096 /dev/sdb1

Mount the partition

Everything is ready 🙂 You can now just mount your new partition freshly formatted.

mkdir /disk2
mount /dev/sdb1 /disk2

If you want this disk to mount after reboot, you can edit your /etc/fstab file to add the mount point in it:

You can check it’s properly mounted using the df command:

Leave a Reply