Redirect Tomcat Homepage to Another URL


To redirect the Tomcat home page we need to edit file index.jsp (/opt/tomcat/webapps/ROOT/index.jsp). It is a good idea to backup the file before you doing any modification to the file. Below steps was tested on Tomcat 9.

Step 1: To make a backup file:

cp -rp index.jsp index.jsp.bak

Step 2: Now truncate the file using below cmd

> index.jsp

Step 3: Content index.jsp should be empty now. Then put below code to index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <title>JSP Redirect</title>
          String redirectURL = "";

Step 4: Refresh your Tomcat home page

Click refresh button. Now you should see your Tomcat home page was redirect to



Posted in tomcat | Tagged

Resize Swap Space in RHEL/CentOS 6 & 7


Your swap partition might need to resize over time. Below are the steps;

Disable Swap

[root@server ~]# swapoff -v /dev/rootdg/swap
swapoff /dev/rootdg/swap

Resize Swap (resize to 30GB)

[root@server ~]# lvextend -L30G /dev/rootdg/swap
Size of logical volume rootdg/swap changed from 2.00 GiB (64 extents) to 30.00 GiB (960 extents).
Logical volume rootdg/swap successfully resized.

Sets up a Linux Swap Area on a Device

[root@server ~]# mkswap /dev/rootdg/swap
mkswap: /dev/rootdg/swap: warning: wiping old swap signature.
Setting up swapspace version 1, size = 31457276 KiB
no label, UUID=b94fbb5e-3916-4422-b024-4e0efc9424ab

Enable Swap

[root@server ~]# swapon -a

Verify the Swap

[root@server ~]# cat /proc/swaps
Filename	Type		Size		Used	Priority
/dev/dm-1	partition	31457276	0	10



Posted in Linux, RedHat | Tagged , , , , , ,

Monitor Disk Space in Real Time


Run below command to check size of file or directory in real time.
# watch -n 1 du -sh /var/cores/netbackup/*

-n = Interval in second
1 = Size will update every 1 second.
du -sh = Get the size of directory or file

watch --help for more option


Posted in Linux, RedHat

Veritas: Creating and Administering Disk Groups (Veritas Volume Manager – VxVM)


You can use the vxdg command to create a new disk group. A disk group must contain at least one disk at the time it is created. You also have the option to create a shared disk group for use in a cluster environment.

Disks must be placed in disk groups before they can be used by VxVM. You can create disk groups to organize your disks into logical sets of disks.

Create Disk Group, Volumes and File systems:

– List all available disk
# vxdisk list

– To list all disk with size
# vxdisk -o size list

– To change view of device name
# vxddladm set namingscheme=osn
# vxddladm set namingscheme=ebn

– Initialize the disk
# vxdisksetup -i sdb

– Uninitialize the disk
# vxdiskunsetup -C sdb

– Initiate or Create a disk group
# vxdg init datadg datadg01=sdb

– Add disk to disk group
# vxdg -g datadg adddisk datadg02=sdc

– Remove disk from disk group
# vxdg -g datadg rmdisk datadg03

– Rename device name in Volume Manager
# vxedit -g datadg rename sdc datadg02

– Destroy disk group
# vxdg destroy datadg

– Destroy multiple disk group in one command
# vxdisk list

DEVICE       TYPE            DISK         GROUP        STATUS
cciss/c0d0   auto:LVM        -            -            online invalid
sde          auto:cdsdisk    dg01disk01   dg01         online thinrclm
sdf          auto:cdsdisk    dg01disk02   dg01         online thinrclm

Referring to above output, now execute
# vxdg destroy dg01
# for z in $(vxdisk list|grep cdsdisk| awk '{print $1}'); do vxdiskunsetup -f $z;done

– To find out the current size of the volume
# vxlist vol

– Check for maximum available size (free size)
# vxassist -g datadg maxsize
# vxassist -g datadg maxsize layout=mirror

– Check how much the volume can be grown
# vxassist -g datadg maxgrow vol01

– Create a volume
# vxassist -g datadg make datavol01 100m

– Create a volume with mirror copy
# vxassist -g datadg make datavol02 100m layout=mirror

– Add mirror copy for a volume
# vxassist -g datadg mirror datavol01 datadg03

– Remove volume from disk group
# vxassist -g datadg remove mirror datavol01

– Resize volume from disk group
# vxresize -g datadg vol01 +200G

– Create a file system
# mkfs -t vxfs /dev/vx/dsk/datadg/datavol01
# mkfs -t vxfs /dev/vx/dsk/datadg/datavol02

– Create mount point
# mkdir /data01
# mkdir /data02

– Mount a file system
# mount -t vxfs /dev/vx/dsk/datadg/datavol01 /data01
# mount -t vxfs /dev/vx/dsk/datadg/datavol02 /data02

Add entry in /etc/fstab to make it persistent after reboot

/dev/vx/dsk/diskgroup/volume_name – When data is written to files, it is actually written to the block device file
/dev/vx/rdsk/diskgroup/volume_name – When fsck is run on the file system, the raw device file is checked

ref: link


Posted in Linux, Storage, UNIX | Tagged , , , , , ,

How to Configure Network Teaming in CentOS/RHEL 7


On network servers, it is an important requirement to ensure that the network interface is available at all times. On Red Hat Enterprise Linux 7, you can create aggregated network interfaces. Use network teaming or network bonding to accomplish this goal.

On earlier versions of Red Hat Enterprise Linux, network bonding was used to accomplish the same goals. Network teaming is new in Red Hat Enterprise Linux 7. The solution consists of a small kernel driver and a daemon that is available in userspace: teamd.

Installing teamd
# yum install teamd

Create team0

Go to the /etc/sysconfig/network-scripts directory and create “ifcfg-team0” file as shown below:

# vim /etc/sysconfig/network-scripts/ifcfg-team0

TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'


  • Roundrobin – This is the default that we are using, it simply sends packets to all interfaces in the team in a round robin manner, that is one at a time followed by the next interface.
  • Broadcast – All traffic is sent over all ports.
  • Activebackup – One interface is in use while the other is set aside as a backup, the link is monitored for changes and will use the failover link if needed.
  • Loadbalance – Traffic is balanced over all interfaces based on Tx traffic, equal load should be shared over available interfaces.
  • Lacp – Implements 802.3ad LACP protocol.

Modify enps03
Go to the /etc/sysconfig/network-scripts directory and create “ifcfg-enps03” file as shown below:

TEAM_PORT_CONFIG='{"prio": 100}'

Modify enps09
Go to the /etc/sysconfig/network-scripts directory and create “ifcfg-enps09” file as shown below:

TEAM_PORT_CONFIG='{"prio": 100}'

Make sure both the interface are down:

# ip link set enp0s3 down
# ip link set enp0s8 down

Now you can bring up your interface

# ifup team0

Verify the teaming configuration

# ip addr
team0:  mtu 1500 qdisc noqueue state UP qlen 1000
link/ether 08:00:27:2e:4c:65 brd ff:ff:ff:ff:ff:ff
inet brd scope global dynamic team0
valid_lft 1178sec preferred_lft 1178sec
inet6 fe80::a00:27ff:fe2e:4c65/64 scope link tentative dadfailed
valid_lft forever preferred_lft forever
# nmcli device status
enp0s8 ethernet unmanaged --
enp0s9 ethernet unmanaged --
team0 team unmanaged --
# teamdctl team0 state
runner: activebackup
link watches:
link summary: up
name: ethtool
link: up
down count: 0
link watches:
link summary: up
name: ethtool
link: up
down count: 0
active port: enp0s8

Removing a Team
To terminate, or kill, an instance of the team daemon use the below command:

# teamd -t team0 -k



Posted in Linux | Tagged , , , , ,

Openvswitch – Cannot Update CentOS 7


Whenever you use CentOS 7 with openvswith enabled you cannot update you system. yum update will time out. The server can access the internet, the mirror server can be resolved. So what is the problem? Usually this happened on CentOS 7 machine running on the cloud or inside the virtualization environment that use openvswitch.

You probably will get below error. when you do yum update or wget something.
[root@katello-vm ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base:
* extras:
* updates:
base | 3.6 kB 00:00:00 [Errno 12] Timeout on (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
extras/7/x86_64/primary_db FAILED ] 0.0 B/s | 11 kB --:--:-- ETA

and the list will continue..

This happened because CentOS kernel is not supported by openvswith. In my case, Im running kernel 3.10.0-327.28.3.el7.x86_64. this kernel is not supported by openvswith. So I need to install new kernel (3.10.0-957.21.3.el7.x86_64) and firmware. Download the kernel and firmware here.

Now install the kernel and firmware without dependencies. Follow the sequence, first kernel, second firmware.
rpm -ivh kernel-3.10.0-957.21.3.el7.x86_64.rpm --nodeps
rpm -Uvh linux-firmware-20180911-69.git85c5d90.el7.noarch.rpm --nodeps

Remove grubenv
rm -rf /boot/grub2/grubenv

Reboot your system.

After your server rebooted, you can update your system.
yum update -y

have a nice day!


Posted in Install, Linux, RedHat | Tagged , , , ,

Create ID In RHV/oVirt


Below are step by step guide to create user in RHV/oVirt and give user privilege to access to Manager.

Create ID
ovirt-aaa-jdbc-tool user add hanief --attribute=firstName=Hanief --attribute=lastName=Harun

Show ID
ovirt-aaa-jdbc-tool user show hanief

Set User Password
ovirt-aaa-jdbc-tool user password-reset hanief --password-valid-to="2025-08-01 12:00:00-0800"

Allow User to Access RHV/oVirt Manager

  1. Using super-admin user > access to RHV/oVirt Manager > Administration > Users
  2. Select User > Permissions > Add System Permissions > Role to Assign > Add SuperUser


Posted in Linux, oVirt, RHEV, RHV | Tagged ,

Error “Cannot import VM. Selected display type is not supported by the operating system” When Importing VM from RHEV to oVirt


When importing VMs from a StorageDomain (usually export domain) you may get a “Cannot import VM. Selected display type is not supported by the operating system” error.

This is my workaround solution. The issue happened when I try to import VM to oVirt 4.3. The VM is originally from RHEV 3.4.

  1. Detach Storage Domain (Mine is export domain)
  2. Find OVF files on Storage Domain. (Search for VM’s ID. In oVirt 4.2, ovf file will be in /export_domain_path/export_domain_ID/master/vms/VM_ID)
  3. Edit this OVF volume files and change their <DefaultDisplayType> to 1 (or a supported value)
  4. Reattach Storage Domain so OVF_STORE files are re-read.
  5. Import the VM.
  6. After you have success imported the VM, You may need to modify the value on VM console. (VM > Edit > Show Advance Option > Console)
  7. Boot up the Vm to test.

That’s it, we’re done!


Posted in RHEV, RHV, Virtualization | Tagged , , ,

How to Check Top Running Processes by Highest Memory and CPU Usage in Linux


The following command will show the list of top processes ordered by RAM and CPU use in descendant form (remove the pipeline and head if you want to see the full list):

ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

Brief explanation of above options used in above command.

The -o (or –format) option of ps allows you to specify the output format. A favourite of mine is to show the processes’ PIDs (pid), PPIDs (pid), the name of the executable file associated with the process (cmd), and the RAM and CPU utilization (%mem and %cpu, respectively).

Additionally, I use --sort to sort by either %mem or %cpu. By default, the output will be sorted in ascendant form, but personally I prefer to reverse that order by adding a minus sign in front of the sort criteria.

To add other fields to the output, or change the sort criteria, refer to the OUTPUT FORMAT CONTROL section in the man page of ps command.


Posted in Linux, UNIX | Tagged , , , ,

How to Backup oVirt Engine


Backup is straightforward. See --help for details.

Below is the steps on how to backup ovirt engine.

engine-backup --mode=backup --file=backup1 --log=backup1.log

Full backup
engine-backup --mode=backup --scope=all --file="/var/lib/ovirt-engine/backups/fullbackup-$(date +%Y%m%d%H%M%S).tar.bz2" --log=/var/log/ovirt-engine/fullbackup-$(date +%Y%m%d%H%M%S).log

DB backup
engine-backup --mode=backup --scope=files --scope=db --file="/var/lib/ovirt-engine/backups/DBbackup-$(date +%Y%m%d%H%M%S).tar.bz2" --log=/var/log/ovirt-engine/DBbackup-$(date +%Y%m%d%H%M%S).log



Posted in Linux, oVirt, RedHat, RHEV, RHV | Tagged , ,