How to Remove/cleanup of Disks LVMs created by UiPathConfigureDisks.sh (When needed)

How to Remove/cleanup of Disks LVMs created by UiPathConfigureDisks.sh (When needed)

In the event that mistakes have been made, like giving the /var/lib/rancher mountpoint 10GB of space when it needs 190GB, the disks will need to have the wrong Logical Volumes (‘LV’), Volume Groups (‘VG’) or Physical Volumes (‘PV’) removed and re-provisioned.

Scenario
As part of preparatory work before an Automation Suite installation, the necessary disks need to be provisioned and partitioned prior to installation.

See sample requirement assuming a 23.4 single-node offline installation.
https://docs.UiPath.com/automation-suite/automation-suite/2023.4/installation-guide/single-node-configuring-the-machines

Automation Suite installation files include a script called configureUiPathDisks.sh that is recommended to be used for partitioning. On occasion, our customers may perform the needful by using Linux-native tools e.g. fdisk along with LVM to effect the same outcomes.

In the event that mistakes have been made, like giving the /var/lib/rancher mountpoint 10GB of space when it needs 190GB, the disks will need to have the wrong Logical Volumes (‘LV’), Volume Groups (‘VG’) or Physical Volumes (‘PV’) removed and re-provisioned.

This may need to be done immediately on customer premises or in calls where provisioning of additional disks is impractical. The configureUiPatthDisks.sh script also does not have the capability as of v23.4 to undo and overwrite.

Steps to Take

Assumptions:

  1. For ease of understanding, the steps given here assume that the disks have already been partitioned using UiPath naming convention by the UiPath-provided script.
  1. The steps here assume that it is necessary to remove all LVs, VGs and PVs in order to restore the SSD’s back to original state.


Unmount all mountpoints

umount /var/lib/rancher
umount /var/lib/kubelet
umount /datadisk
umount /var/lib/rancher/rke2/server/db
umount /opt/UiPathAutomationSuite
Restart the server if prompts like "umount: /var/lib/rancher: target is busy." persistently appear.

Remove Logical Volumes

lvchange -an /dev/uipathdatavg/longhornlv
lvremove /dev/uipathdatavg/longhornlv

lvchange -an /dev/uipathbundlevg/bundlelv
lvremove /dev/uipathbundlevg/bundlelv

lvchange -an /dev/uipathetcdvg/etcdlv
lvremove /dev/uipathetcdvg/etcdlv

lvchange -an /dev/uipathvg/installerlv
lvremove /dev/uipathvg/installerlv

lvchange -an /dev/uipathvg/kubeletlv
lvremove /dev/uipathvg/kubeletlv

lvchange -an /dev/uipathvg/rancherlv
lvremove /dev/uipathvg/rancherlv

A success message like “Logical volume "longhornlv" successfully removed” should be seen upon running each lvremove command.

Remove Volume Groups

vgchange -an uipathdatavg
vgremove uipathdatavg

vgchange -an uipathbundlevg
vgremove uipathbundlevg

vgchange -an uipathetcdvg
vgremove uipathetcdvg

vgchange -an uipathvg
vgremove uipathvg

Remove Physical Volumes

Naming conventions for disks, and hence LVM physical volumes may vary across various public cloud and/or hypervisor products. For example, /dev/nvme1n1 or /dev/sdb may appear in AWS, Azure or VMware, while Redhat KVM tends to present volumes as /dev/vdb.

It is hence advisable to use pvdislay to check the existing PVs before performing a removal.

The following command removes 4 PVs which are named nvme1n1 through nvme4n1:

pvremove /dev/nvme1n1 /dev/nvme3n1 /dev/nvme2n1 /dev/nvme4n1

A successful execution of the above command will show the following messages on the Linux prompt:

Labels on physical volume "/dev/nvme1n1" successfully wiped.
Labels on physical volume "/dev/nvme3n1" successfully wiped.
Labels on physical volume "/dev/nvme2n1" successfully wiped.
Labels on physical volume "/dev/nvme4n1" successfully wiped.

Removing fstab entries


Note: Ensure to edit /etc/fstab file and remove all the relevant (only the entries which are created for AS installation, which are explained in above article) entries from there.

Example -

image.png

Conclusion
Once all the steps have been run successfully, the server disks will not have any LVM-level tags on them and will be ready for re-provisioning using LVM. It is recommended that UiPath’s configureUiPathDisks shell script be used for further re-provisioning.