Open Grieves

Open Grieves

Assimilate quickly!

You must comply!

Extending volume group (or etc) in RHEL6/7 when having extended VMware disk

Out of troublePosted by Magnus Glantz 2015-05-19 16:19:41
So, the scenario is that you have a virtual machine running Red Hat Enterprise Linux 6 or Red Hat Enterprise Linux 7 in VMware and want to get some additional disk space added to your server. Instead of simply adding a new disk in VMware you have opted to extend the existing disk.

1. Do not do this if you don't have a very very good reason.
Adding a completely new disk the right way. BUT, perhaps you have a very good reason to resize the already added hard disk to your VMware guest, perhaps you are provisioning a system using a VMware template using Red Hat Satellite 6? Then it would make sense, to allow people to select a bigger size primary disk tham what the template has - and grow it automatically.
2. Don't do this on a production system, try it out on a test system first.. It's easy to mess up a system when doing stuff like this.
3. Extending an existing VG.

# Creating a new partition. As we want to do this online (runlevel 3), we create a new partition as modifying an existing partition is messy and dangerous.
Below, we create partition 3. Change to fit your use case. In my case I already have two partitions, one for /boot and one for LVM. So I'll create another LVM (8e) partition.
p 3, means partition 3. t 3 8e, means type 8e (LVM) on partition 3, w means write. Please note that the two empty spaces after "p 3" will select the first available cylider for start of the partition and the last available cylider for end of the partition. You can put in whatever fits if that's not what you want.

echo "n
p
3


t
3
8e
w
"|fdisk /dev/sda-or-whatever-its-called

# To get the device file created and the partition recognised, you need to run partx.
partx -a /dev/sda-or-whatever-its-called

# New partition exists, so now we create a PV.
pvcreate /dev/sda-or-whatever-its-called

# PV created, so now we add it to our existing VG or create a new or etc.
vgextend myvg /dev/sda-or-whatever-its-called

4. Note. Likely works on Red Hat Enterprise Linux 5, but not tested.


















  • Comments(0)//blog.hacka.net/#post93