redhat

Rename Root Volume Group (VG) on Linux Server

This walk-through worked on a virtual server running RHEL 6.7 in a VMware environment.

As I rebuilt an existing VMware guest that was being scheduled to go into production, I realized I did not rename the default volume group from vg_hostname to rootvg.

You must be root user and it is extremely important to backup the files below. It’s also important to know how to boot up in rescue mode with other boot media in the event there was a typo or other unforeseen issue.

Backup fstab file

cp /etc/fstab /etc/fstab.orig

Backup grub.conf file

cp /boot/grub/grub.conf /boot/grub/grub.conf.orig

Rename volume group

vgrename /dev/vg_OLDname /dev/rootvg

Change all instances of the old volume group in the following files:
Edit /etc/grub.conf (which is a symbolic link to /boot/grub/grub.conf)

vim /etc/grub.conf

Search and replace

:%s/vg_OLDname/rootvg/g

Edit fstab file

vim /etc/fstab

Search and replace

:%s/vg_OLDname/rootvg/g

Move boot image

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.backup
dracut -v /boot/initramfs-$(uname -r).img $(uname -r)

Verify your work
Reboot

If your system comes back up, you are golden. If it does not…

redhat

Get Process Count on Linux

The first part is to identify the PPID. I used this command to get my PPID for the mysql user:

# ps -A -mPl | grep mysql

 

I then used this command to get the total count for all child processes for the given PPID for the mysql user:

# ps -elm|grep 902|grep -v grep |wc -l

Output

377

 

If you want to get a count of ALL processes, use the following command:

#  ps -elm|wc -l

Output

1142

 

Kevin is putting a script together that will collect these counts periodically. One of us will post it to the article when tested and complete.

redhat

How To Install GUI on Red Hat or CentOS

So you installed Red Hat or CentOS 7 using minimal install and all has been well. Now, you find that you’d like to install the GUI and don’t want to re-install the OS from scratch. No problem.

Start by installing yum-utils

yum install yum-utils

To list software groups, enter

yum grouplist

Output will be similar to this

Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirror.cisp.com
 * extras: mirror.fdcservers.net
 * updates: www.gtlib.gatech.edu
Available environment groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
Done

To install “Server with GUI” group, enter:

yum groupinstall "Server with GUI"

Once the installation is finished, you need to change system’s runlevel to runlevel 5. Changing runlevel on RHEL 7 and CentOS 7 is done by use of systemctl command.

systemctl enable graphical.target --force

Depending on your previous installations you may need to accept Redhat License after you reboot your system.

GUI-install-license-infoGUI-install-license-info-accept