Extending a logical volume in a Centos VM running on VMware

The purpose of this article is to help any one extend a logical volume in Centos VM that is running on VMware Workstation.

I started with VMware KB 1006371 which is a good start and there was couple of fill in the blanks I had to figure out to make it work. So the magic googling lead me to these 3 links:

VMware KB 1006371 — https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006371

Grzegorz Juszczak’s website Tuxfixer — http://www.tuxfixer.com/how-to-create-lvm-volume-group-and-logical-volume/

Stackoverflow — resize2fs: Bad magic number in super-block while trying to open — http://stackoverflow.com/questions/26305376/resize2fs-bad-magic-number-in-super-block-while-trying-to-open

In summary I used all 3 articles, and the Stackoverflow blog really has everything you need and the answer how to do it and shows how to extend a logical volume in Centos VM running on VMware.

The thing that got me over the last hump was resize2fs does not work in Centos, and xfs_growfs does, so was finally able to groe file size from 20GB to 30GB.

[root@localhost ~]# resize2fs /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/centos/root
Couldn’t find valid filesystem superblock.
[root@localhost ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=1144832 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=4579328, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 4579328 to 7200768
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 28G 6.8G 21G 25% /
devtmpfs 1.4G 0 1.4G 0% /dev
tmpfs 1.4G 100K 1.4G 1% /dev/shm
tmpfs 1.4G 9.0M 1.4G 1% /run
tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup
/dev/sda1 497M 357M 141M 72% /boot
tmpfs 284M 4.0K 284M 1% /run/user/42
tmpfs 284M 8.0K 284M 1% /run/user/1000

About wmichel

Cloud Architect, NetApp A-Team, vExpert, VMUG Leader, AWS-SAA, TOGAF, ITIL, CISSP, USMC, Mariachi, Gaucho-Texano & Dad A seasoned architect and technologist at heart that loves innovation and playing with cloud computing, data center virtualization, operating systems, and information security.
Image | This entry was posted in VMware. Bookmark the permalink.