// Module included in the following assemblies:
//
// assembly-storage.adoc

[id='proc-removing-volumes-from-jbod-storage-{context}']
= Removing volumes from JBOD storage

This procedure describes how to remove volumes from Kafka cluster configured to use JBOD storage.
It cannot be applied to Kafka clusters configured to use any other storage type.
The JBOD storage always has to contain at least one volume.

IMPORTANT: To avoid data loss, you have to move all partitions before removing the volumes.

.Prerequisites

* A Kubernetes cluster
* A running Cluster Operator
* A Kafka cluster with JBOD storage with two or more volumes

.Procedure

. Reassign all partitions from the disks which are you going to remove.
Any data in partitions still assigned to the disks which are going to be removed might be lost.
+
TIP: You can use the `kafka-reassign-partitions.sh` tool to reassign the partitions.

. Edit the `spec.kafka.storage.volumes` property in the `Kafka` resource.
Remove one or more volumes from the `volumes` array.
For example, remove the volumes with ids `1` and `2`:
+
[source,yaml,subs=attributes+]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    storage:
      type: jbod
      volumes:
      - id: 0
        type: persistent-claim
        size: 100Gi
        deleteClaim: false
    # ...
  zookeeper:
    # ...
----

. Create or update the resource:
+
[source,shell,subs=+quotes]
kubectl apply -f _<kafka_configuration_file>_
