How to add a VMWARE virtual disk on CentOS.

*WARNING* THIS CAN RESULT IN FILE SYSTEM CORRUPTION IF DONE IMPROPERLY.
Backup SERVER is *STRONGLY* recommended.


First just check the partition table of the virtual disk in the VM

# fdisk -l

Now, shutdown the guest in preparation to add the additional virtual disk

# shutdown

Check system again

# fdisk -l

# fdisk /dev/sdb
# n {new partition}
# p {primary partition}
# 1 {select partition number, by default 1 is the next available}

# t {select partition id we just made (1)}
# p {print. the new device should be described as Linux LVM}
# w {write to memory}

You will need to reboot if fdisk updated kernel tables, just follow the recommendation message that will show up.

# reboot

You can check the partition table after the reboot if you like, make sure it looks like what you expect

fdisk -l /dev/sdb

Disk /dev/sdb: 85.8 GB, 85899345920 bytes

Now, create a new physical volume from the new partition

# pvcreate /dev/sdb1

# mkdir /mnt/cache

Then (I prefer XFS system, you also can use ext4)

# /sbin/mkfs.xfs -L /mnt/cache /dev/sdb1

Configuring CentOS 6 to Automatically Mount a File System

In order to set up the system so that the new file system is automatically mounted at boot time an entry needs to be added to the /etc/fstab file.

/dev/sdb1    /mnt/cache   xfs    defaults        1 2

Done.