# Remove a data library

Remove a data library and choose what happens to the projects that use its files.

When you remove a library from the settings, the Backend (The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs.) does not forget it: it keeps it as a removed library. Users do not see it any more and cannot import new files from it. Blocks (A small application for one step of an analysis, for example the import of reads or clustering. It can combine several tools.) can still read the files that users imported from it, so the projects keep working. Users cannot open or download these files in the Desktop App (The program that each user installs on their own computer to work with Platforma. It is a client of the Backend.). When you add the library again with the same ID, users see it again.

At each start, the Backend checks a removed library as it checks the libraries in the settings: it lists the bucket or the folder, and it does not start when it cannot. So the Backend keeps its right to list a removed library also when the projects do not need its files any more. The Backend does not check a removed library whose last mode was a per-user mode.

A removed library with stored access keys depends on the master secret: after a change of the master secret, the Backend cannot read it any more. See [Master secret](/security-secrets/#master-secret).

There are three ways to remove a library:

- [Hide the library and keep its data](/maintain-removing-data-library/#hide-the-library-and-keep-its-data): projects keep working.
- [Copy the data, then remove the library](/maintain-removing-data-library/#copy-the-data-then-remove-the-library): projects do not need it.
- [Abandon the projects that use the library](/maintain-removing-data-library/#abandon-the-projects-that-use-the-library): not recommended.

These steps are for a library in a bucket, and for a folder library in Single Server mode (The mode in which the Backend and all its jobs run on one Linux machine, the server, with no Kubernetes cluster.).

## Hide the library and keep its data

Use this way when the projects still need the files of the library, but users must not import new files from it.

#### Variant: Kubernetes cluster

Remove the library from `dataLibraries` (Helm) or `backend_service.data_libraries` (Terraform), then upgrade the release. With the cloud-specific Terraform modules (The Terraform modules platforma-tf-cloud-base and platforma-tf-cloud-cluster. There is one pair for each cloud, AWS and Google Cloud. The roots cloud and cluster apply them. They make the network, the Kubernetes cluster, the storage, the cloud identities and the registry caches. They give the hand-off file cluster_config to the cloud-agnostic Terraform modules.), keep the bucket in `data_libraries` of `platforma-tf-cloud-base`: the module keeps the read access of the Backend to it.

#### Variant: Single Server

Remove the options of the library from the Backend service, then restart the Backend. Keep the folder, or the access of the Backend to the bucket.

**Result:** users do not see the library. Blocks read the files that users imported before, also when they run again. The Backend keeps its read access to the bucket or the folder, and the data stays there. To show the library again, add it back with the same ID.

## Copy the data, then remove the library

Use this way when the projects must keep their files, but the library must go, or the Backend must stop reading its data.

1. **Copy the files.** Copy the files that projects imported from the library into the primary storage while the library is still in the settings: see [Copy the files of a library into the primary storage](/maintain-data-library-access-mode/#copy-the-files-of-a-library-into-the-primary-storage). Go on only when the copy is complete.

2. **Remove the library from the settings** in the same upgrade, or before the Backend service starts again in Single Server mode, as in [Hide the library and keep its data](/maintain-removing-data-library/#hide-the-library-and-keep-its-data). Then users cannot import new files between the copy and the removal.

3. **Remove the data, and keep the start check working.** The projects do not read the library any more, so you can delete its files. The Backend still lists the library at each start, so keep:

   - for a bucket: the bucket (it can be empty) and the right of the Backend to list it (`s3:ListBucket` on Amazon S3, `storage.objects.list` on Google Cloud Storage). With access keys, keep the keys valid. The right to read the files is not necessary any more;
   - for a folder: the folder on the server (it can be empty), readable by the system user of the Backend.

**Result:** the projects use the copies in the primary storage (The bucket (Amazon S3 or Google Cloud Storage) or folder where Platforma keeps all results and uploaded files.) and do not depend on the data of the library. The primary storage grows by the size of the copied files.

## Abandon the projects that use the library

MiLaboratories does not recommend this way: you cannot undo it, unless you put the files back.

Remove the library from the settings, as in [Hide the library and keep its data](/maintain-removing-data-library/#hide-the-library-and-keep-its-data), then delete its files, or take away the right of the Backend to read them. Keep the bucket or the folder and the right of the Backend to list it, as in [Copy the data, then remove the library](/maintain-removing-data-library/#copy-the-data-then-remove-the-library): else the Backend does not start.

**Result:** the projects that use files of the library stay, with their earlier results in the primary storage. A Block that reads a file of the library fails when it runs again, and users cannot import the file again. Users must import the input data again from another source and run the Blocks again.

## Next

- [Data libraries](/configuration-data-libraries/)
- [Change the access mode of a data library](/maintain-data-library-access-mode/)

Source: https://docs.platforma.bio/maintain-removing-data-library/
