If you need to remove a non-root LVM based file system, it can be removed using the following steps. If the file system contains any data, then please make sure to take a backup of that data before proceeding with the following steps.
In this example, we will be deleting "u01lv" from volume group "oracle". The logical volume is mounted on mount point /u01.
As you can see, mount point /u01 is define don logical volume u01lv, and is 200 GB.# df /u01 | grep u01 /dev/ampper/oracle/u01lv 209612800 80946812 128665988 39% /u01 # lvs | grep u01 u01lv oracle -wi-ao---- 200.00g
Start off, by deleting the corresponding entry in /etc/fstab.
Then unmount the file system:# grep u01 /etc/fstab /dev/oracle/u01lv /u01 xfs defaults,noatime 0 0
Disable the logical volume:# umount /u01
Delete the logical volume:# lvchange -an /dev/oracle/u01lv
At this point, depending if this logical volume is defined on a disk within a volume group, you can, if the disk is now empty after removing the logical volume, also remove the disk from the volume group. First run the "pvs" command and check for an empty disk, such as:# lvremove /dev/oracle/u01lv
If the disk is empty, as seen as disk /dev/sdb in the example above, you can then remove it from the volume group:# pvs PV VG Fmt Attr PSize PFree /dev/sdb oracle lvm2 a-- <5.00t <5.00t
Or, if the logical volume removed from the volume group was the very last logical volume to remove, and the volume group is empty, you can also remove the volume group. Do so by disabling the volume group and removing it:# vgreduce oracle /dev/sdb
And then finally remove any physical volumes used, such as /dev/sdb:# vgchange -an oracle # vgremove oracle
# pvremove /dev/sdb
If you found this useful, here's more on the same topic(s) in our blog:
- Wget: Resume a broken download
- Linux Extended File System Attributes
- Install Python version 3 on Red Hat / CentOS
- Increase the size of a tmpfs file system
- Keystrokes used in top
UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.
Interested in learning more?
Interested in learning more?




