AWS CentOS Amazon Instance resize Root Partition Live Running

Below are my steps for re-sizing the / partition for an AWS CentOS 6.5 x64 Instance.

Most all of the AWS instances start off as 15GB or smaller / partitions.  Being able to resize to take advantage of a larger disk is great.

Please use these directions at your own risk!  Keep backups or create a snapshot before you start to ensure if you do something wrong you can recover, reset, or back out.

Here are the steps I followed, and below is how I ran them each:

  1. As root, go into `fdisk /dev/xvda` and create a new primary partition n for new then p for primary 3 for 3rd partition number and enter for size
  2. t for tag it (t) as type 0x8e and then w for write
  3. Write your changes and exit fdisk
  4. Reboot = you may not be able to use the new partition until you reboot
  5. When the reboot completes, as root again,
  6. Run pvcreate on your new partition to create the physical partition
  7. Use vgextend to add the new PV to your existing Volume Group
  8. Now you have free space available in the VG
  9. Run lvextend to add some space to /dev/mapper/VolGroup-lv_root = this adds your new space to the logical volume
  10. Run `resize2fs /dev/mapper/VolGroup-lv_root`

**************************

First Verify you have the extra space by looking at the physical drives:

lsblk = will show you the raw disk space.

Then create a new partition from the available free space on the drive
[root@ip-172-31-36-49 ~]# fdisk /dev/xvdf
n
p
3
enter for default size = remaining amount

t 0x8e
w = write it out and exit
reboot server

[root@ip-172-31-36-49 ~]# pvcreate /dev/xvdf3
Physical volume “/dev/xvdf3” successfully created

pvdisplay = show physical volumes verify you have the remaining disk space

[root@ip-172-31-36-49 ~]# vgdisplay
— Volume group —
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 14.51 GiB
PE Size 4.00 MiB
Total PE 3714
Alloc PE / Size 3714 / 14.51 GiB
Free PE / Size 0 / 0
VG UUID lvi8Kt-MMja-nTvI-terh-7ljb-ImyV-SScwRk

[root@ip-172-31-36-49 ~]# vgextend VolGroup /dev/xvdf3
Volume group “VolGroup” successfully extended

[root@ip-172-31-36-49 ~]# vgdisplay VolGroup
— Volume group —
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 89.02 GiB
PE Size 4.00 MiB
Total PE 22788
Alloc PE / Size 3714 / 14.51 GiB
Free PE / Size 19074 / 74.51 GiB
VG UUID lvi8Kt-MMja-nTvI-terh-7ljb-ImyV-SScwRk

[root@ip-172-31-36-49 ~]# lvextend -l +100%FREE /dev/mapper/VolGroup-lv_root
Extending logical volume lv_root to 88.22 GiB
Logical volume lv_root successfully resized

lvdisplay = verify the lv size is bigger now

[root@ip-172-31-36-49 ~]# resize2fs /dev/mapper/VolGroup-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 6
Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 23126016 (4k) blocks.
The filesystem on /dev/mapper/VolGroup-lv_root is now 23126016 blocks long.

vgdisplay = verify the VolGroup is now bigger

[root@ip-172-31-36-49 ~]# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
87G 1.4G 82G 2% /
[root@ip-172-31-36-49 ~]#

CentOS-6.5-Base-HVM-SR-IOV-1/30/2015 – ami-09f7d239
[Copied ami-e4b7f18c from us-east-1] CentOS-6.5-Base-HVM-SR-IOV-1/30/2015
Root device type: ebs Virtualization type: hvm

 

Thanks to the following resources:

post by Trevor H @ https://www.centos.org/forums/viewtopic.php?f=13&t=44616

PVCreate @ http://linux.die.net/man/8/pvcreate

Display Volume Groups  @ redhat.com

Grow Logical Volumes  @ centos.org

Managing Partitions at How To Geek @ howtogeek.com

Display Physical Volumes @ Redhat.com

Network Properties always displays DHCP

Several times over the several past years I have noticed with Broadcom and Dell servers an issue where I go to change settings in the IP v4 under Windows server where I can’t get the settings to stick with a static address and it seems to be reset back to DHCP. Basically I can not change the static IP address and I am forced back to DHCP, or so it would appear at first glance. In reality the MS GUI isn’t updating properly.
First time this happened it was Windows Server 2003 and just recently it happened again with a Dell T110-II and Windows Server 2012 R2.

Quote from MS KB “manually configure the TCP/IP properties to add a static IP address. After you do this, the Internet Protocol (TCP/IP) Properties dialog box still displays the default settings. Additionally, the Obtain IP address automatically option is selected.
However, when you type ipconfig /all at a command prompt, the static IP address information that you entered manually is displayed.”

Check Network Properties for IP v4 and it shows DHPC.
Make changes and set static IP and DNS server info and click ok and close.
Check ipconfig with Command Prompt and it shows the proper changes
Check the Network Properties IP v4 and it shows DHCP again.
In some cases the network will drop and the server will disconnect from the network.
Uninstall the network card and let the system re-install and DHCP will bring the server back online.
Make changes to Network Properties IP v4 and same thing will happen.
If you make changes 2 times with different IP addresses, ipconfig under Command Prompt and you will see multiple IP addresses now.
Again one of the only ways to reset is to uninstall the card and let the system re-install it.

I spent countless hours troubleshooting and just recently 3.5 hours on the phone with Dell support working on this very issue.

Here is the solution – A registry edit and a KB article from Microsoft.
This probably applies to more than Dell Servers and Broadcom cards, but these are the only combination that I have dealt with.
I hope this saves someone else countless hours on the phone and troubleshooting.

http://support2.microsoft.com/kb/937056

From the MS KB –
******
To resolve this problem, follow these steps:
Download and then install the latest version of the network adapter driver on the computer.
Click Start, click Run, type regedit, and then click OK.
Locate and then delete the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\Config
If your server is a domain controller, go to step 5. (This includes servers that are running Windows Small Business Server 2003.) If your server is not a domain controller, delete the following registry subkeys:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Adapters\ {GUID}
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{GUID}
Click Start, click Run, type sysdm.cpl, and then click OK.
In the Systems Properties dialog box, click the Hardware tab, and then click Device Manager.
In Device Manager, expand Network adapters, right-click the network adapter that you want, and then click Uninstall.
Restart the computer.
After the computer restarts, the operating system automatically detects the network adapter. If the network adapter is not detected, you may have to manually re-install the network adapter drivers.
****

JSNetworks.net Redesign

We are working on building a new more functional site and back-end customer portal system.
90% of the site is completed and we are moving closer to a publish date.
Some of the newer features will include:
Customer portal for tracking tickets
Online payment integration
Online ticket submission services
Online blog
Awareness service offerings