CentOS - add HDD on VM

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.


AUST IT - Computer help out of hours, when you need it most.

Find out why we do it for less.

About

AUST IT will help you resolve any technical support issues you are facing onsite or remotely via remote desktop 24/7. More...

Contacts

Reservoir, Melbourne,
3073, VIC, Australia

Phone: 0422 348 882

This email address is being protected from spambots. You need JavaScript enabled to view it.

Sydney: 0481 837 077

Connect

Join us in social networks to be in touch.

Newsletter

Complete the form below, and we'll send you our emails with all the latest AUST IT news.