Allocating disk space from the command line

You can change the default disk space allocation from the command line if you did not change the disk space when you ran the Linux installation program.

About this task

You can reconfigure the /home and / directories to provide the required disk space after the Linux installation and prior to installing IBM® Counter Fraud Management.

To display the disk space on the server, enter the following command:

df -h
Results are similar to the following output:
Filesystem                      Size    Used   Avail   Use%  Mounted on
/dev/mapper/vg_cfm20-lv_root     50G    2.1G    43G     5%   /
tmpfs                           7.8G       0   7.8G     0%   /dev/shm
/dev/sda1                       477M     73M   380M    16%   /boot
/dev/mapper/vg_cfm20-lv_home     43G     52M    41G     1%   /home
192.168.1.200:/volume1/Software/CFM2.0/media/linux
                                7.3T    4.9T   2.4T    68%   /icfmmedia

In this example, the /dev/mapper/vg_cfm20-lv_root entry lists 43 GB available for the / directory. The /dev/mapper/vg_cfm20-lv_home entry lists 41 GB available for the /home directory.

The /opt, /tmp, and /home directories are allocated space under the / directory, which is only 51 GB by default on a 150 GB disk installation of Red Hat Enterprise Linux v6.7 and has only 45 GB available. However, the total minimum space that is needed for the /opt, /tmp, and /home directories is 60 GB. To avoid any issues, assume that at least 70 GB is needed.

For the installation to succeed, you must allocate more space to the / directory. You can take 20 GB from the /home directory and allocate that to the / directory.

The following procedure offers one suggested method for reallocating disk space. Your requirements for the directories may vary.

Procedure

To allocate the required disk space:

  1. Enter the following command to determine the current allocation and home directory:
    df -h
  2. Enter the following commands to reduce the disk space allocation for the /home directory:
    df -h /home/      
    umount /home/
    e2fsck -f /dev/mapper/vg_cfm20-lv_home
    resize2fs /dev/mapper/vg_cfm20-lv_home 20G
    lvreduce -L 20G /dev/mapper/vg_cfm20-lv_home
    e2fsck -f /dev/mapper/vg_cfm20-lv_home
    mount /home/
    df -h /home/
    Where:
    • /dev/mapper/vg_cfm20-lv_home is the directory that is listed for the /home entry in the Mounted on column.
    • 20G is the size increase needed to provide 60 GB total, plus room for other files. In the example, 20 GB is needed to bring the / directory to the required minimum size.
  3. Enter the following commands to increase the disk space allocation for the / directory:
    lvs
    lvextend -L +20G  /dev/mapper/vg_cfm20-lv_root
    resize2fs /dev/mapper/vg_cfm20-lv_root 70G
    df -h /
    where
    • /dev/mapper/vg_cfm20-lv_root is the directory that is listed for the / entry in the Mounted on column.
    • 20G is the size increase needed to provide 60 GB total, plus room for other files. In the example, 20 GB is needed to bring the / directory to the required minimum size.