Removal of Disk Drives That Have Already Been Assigned to an LVM for either an x86 or s390 installed MOI Appliance
search cancel

Removal of Disk Drives That Have Already Been Assigned to an LVM for either an x86 or s390 installed MOI Appliance

book

Article ID: 204211

calendar_today

Updated On:

Products

Mainframe Operational Intelligence

Issue/Introduction

The process documented below uses the attached remove-disks-lvm script to remove disk volumes that have already been assigned to a MOI appliance LVM in either the x86 or s390 Linux environments. There are also manual steps that accomplish the same disk removal if the script does not work correctly.

Environment

Mainframe Operational Intelligence Release
Service Pack:  2.0.*
Component : MFOPIN

Resolution

Removing disk storage devices from MOI LVMs

Backups are strongly recommended prior to removing storage. If possible, we recommend you take a VM snapshot.

Automated process for removing storage

  1. Copy the attached script called remove-disks-lvm_1606795749367.sh to the local filesystem of the MOI machine e.g., into /tmp

  2. Make the file executable if necessary
    • sudo chmod +x remove-disks-lvm_1606795749367.sh

  3. Shutdown MOI
    • $ cd /opt/moi
    • $ bin/plex shutdown --bg=wait

  4. Execute it as follows from your machine to remove the disks from your LVMs:
    • $  ./remove-disks-lvm_1606795749367.sh /lvm1 /dev/sdf1 /dev/sdk1
    • $  ./remove-disks-lvm_1606795749367.sh /lvm2 /dev/sdg1 /dev/sdj1
    • $  ./remove-disks-lvm_1606795749367.sh /lvm3 /dev/sdh1 /dev/sdi1

      where /dev/sdf1, /dev/sdk1,... are the disks to be removed.

  5. Start MOI
    • $ cd /opt/moi
    • $ bin/plex startup -d --bg=wait

Manual process for removing storage

The following process can be used to manually remove disks. For example, you want to remove the disk /dev/dasdg1 from the LVM mounted at /lvm1

Mounted at /lvm1 is the following LVM: /dev/lvm1_vg/lvm1_lv where the LVM name is lvm1_lv and the LVM volume group is lvm1_vg.

  1. Shutdown MOI
    • $ cd /opt/moi
    • $ bin/plex shutdown --bg=wait

  2. Unmount the LVM
    • $ umount /lvm1

  3. Check the filesystem
    • $ e2fsck -f /dev/lvm1_vg/lvm1_lv

  4. Reduce the size of the filesystem on that LVM by the total size of the disk you are removing plus 10%
    • $ removeSize=$(pvs --noheadings --nosuffix --units m -o pv_size /dev/dasdg1)
    • stores the size of the disk in megabytes to removeSize
    • $ lvmSize=$(lvs --noheadings --nosuffix --units m -o lv_size /dev/lvm1_vg/lvm1_lv)
    • stores the size of the logical volume in megabytes to lvmSize
    • $ finalSize=$(( (${lvmSize%.*} - ${removeSize%.*}) * 9 / 10 ))
    • stores the reduced filesystem size in finalSize
    • $ resize2fs /dev/lvm1_vg/lvm1_lv "${finalSize}"M

  5. Reduce the allocated physical extents on that LVM by the physical extents on the disk you are removing plus 1
    • $ extentsToRemove=$(pvs --noheadings -o pv_pe_alloc_count /dev/dasdg1)
    • stores the number of extents to remove to extentsToRemove
    • $ (( extentsToRemove++ ))
    • add one more extent so there is an extent free on the remaining disks, otherwise pvmove will return no free extents
    • $ lvreduce -l -${extentsToRemove} /dev/lvm1_vg/lvm1_lv
    • respond with 'y'
    • reduces the size of the LVM

  6. Move the extents on the disk you are removing to the other disks
    • $ pvmove /dev/dasdg1
    • will probably return "No data to move for lvm1_vg" but if not then the data migration may take a while.

  7. Remove the disk from the volume group
    • $ vgreduce lvm1_vg /dev/dasdg1

  8. Mount the LVM
    • $ mount -a

  9. Resize the LVM and filesystem to use the entire volume group
    • lvresize -l +100%free /dev/lvm1_vg/lvm1_lv
    • resize2fs /dev/lvm1_vg/lvm1_lv

  10. Start MOI
    • $ cd /opt/moi
    • $ bin/plex startup -d --bg=wait

Attachments

remove-disks-lvm_1606795749367.sh get_app