# Deleting objects

This chapter tells how to delete EVMS objects through the delete and delete recursive operations.

## How to delete objects: delete and delete recursive

There are two ways in EVMS that you can destroy objects that you no longer want: Delete and Delete Recursive. The Delete option destroys only the specific object you specify. The Delete Recursive option destroys the object you specify and its underlying objects, down to the container, if one exists, or else down to the disk. In order for an object to be deleted, it must not be mounted. EVMS verifies that the object you are attempting to delete is not mounted and does not perform the deletion if the object is mounted.

## Example: perform a delete recursive operation

The following example shows how to destroy a volume and the objects below it with the EVMS GUI, Ncurses, and CLI interfaces.

> ### Destroy a volume and the region and container below it

> This example uses the delete recursive operation to destroy volume `/dev/evms/Sample Volume` and the region and container below it. Volume `/dev/evms/Sample Volume` is the volume that was created in earlier. Although we could also use the delete option on each of the objects, the delete recursive option takes fewer steps. Note that because we intend to delete the container as well as the volume, the operation needs to be performed in two steps: one to delete the volume and its contents, and one to delete the container and its contents.

### Using the EVMS GUI

Follow these steps to delete the volume and the container with the EVMS GUI:

1. Select Actions Delete Volume.

2. Select volume /dev/evms/Sample Volume from the list.

3. Click Recursive Delete. This step deletes the volume and the region `lvm/Sample Container/Sample Region`. If you want to keep the underlying pieces or want to delete each piece separately, you would click Delete instead of Delete Recursive.

4. Assuming you chose Delete Recursive (if not, delete the region before continuing with these steps), select Actions Delete Container.

5. Select container lvm/Sample Container from the list.

6. Click Recursive Delete to destroy the container and anything under it. Alternatively, click Delete to destroy only the container (if you built the container on disks as in the example, either command has the same effect).

Alternatively, you can perform some of the volume deletion steps with the GUI context sensitive menu:

1. From the Volumes tab, right click `/dev/evms/Sample Volume`.

2. Click Delete...

3. Continue with the operation beginning with step 3 of the GUI instructions.

### Using Ncurses

Follow these steps to delete the volume and the container with Ncurses:

1. Select Actions DeleteVolume.

2. Select volume /dev/evms/Sample Volume from the list.

3. Activate Delete Volume Recursively. This step deletes the volume and the region `lvm/Sample Container/Sample Region`. If you want to keep the underlying pieces or want to delete each piece separately, activate Delete instead of Delete Recursive.

4. Assuming you chose Delete Volume Recursively (if not, delete the region before continuing with these steps), select Actions DeleteContainer.

5. Select container lvm/Sample Container from the list.

6. Click Recursive Delete to destroy the container and everything under it. Alternatively, activate Delete to delete only the container (if you built the container on disks as in the example, either command has the same effect).

7. Press Enter.

Alternatively, you can perform some of the volume deletion steps with the context sensitive menu:

1. From the Volumes view, press Enter on /dev/evms/Sample Volume.

2. Activate Delete.

3. Continue with the operation beginning with step 3 of the Ncurses instructions.

### Using the CLI

Use the `delete` and `delete recursive` commands to destroy EVMS objects. Specify the command name followed by a colon, and then specify the volume, object, or container name. For example:

1. Enter this command to perform the delete recursive operation:

       delete recursive: "/dev/evms/Sample Volume"

   This step deletes the volume and the region `/lvm/Sample Container/Sample Region`. If you wanted to keep the underlying pieces or wanted to delete each piece separately, use the `delete` command, as follows:

       delete: "/dev/evms/Sample Volume"

2. Assuming you chose Delete Volume Recursively (if not, delete the region before continuing with these steps) enter the following to destroy the container and everything under it:

       delete recursive: "lvm/Sample Container"

   To destroy only the container, enter the following:

       delete: "lvm/Sample Container"