
# ZFS Installation and Basic Configuration Guide for Ubuntu 24.04

## 1. Introduction

This guide provides step-by-step instructions for installing ZFS on Ubuntu 24.04. It also shows how to create a custom directory for configuration files at `/opt/calypso/conf/zfs`.

**Disclaimer:** ZFS is a powerful and complex filesystem. This guide provides a basic installation and a simple example. For production environments, it is crucial to consult the official [OpenZFS documentation](https://openzfs.github.io/openzfs-docs/).

## 2. Installation

First, update your package lists and install the `zfsutils-linux` package.

```bash
sudo apt-get update
sudo apt-get install -y zfsutils-linux
```

## 3. Configuration Directory

ZFS configuration is typically stored in `/etc/zfs/`. We will create a custom directory for ZFS-related scripts or non-standard configuration files.

```bash
sudo mkdir -p /opt/calypso/conf/zfs
```

**Important:** The primary ZFS configuration is managed through `zpool` and `zfs` commands and is stored within the ZFS pools themselves. The `/etc/zfs/` directory mainly contains host-specific pool cache information and other configuration files. Manually moving or modifying these files without a deep understanding of ZFS can lead to data loss.

For any advanced configuration that requires modifying ZFS services or configuration files, please refer to the official OpenZFS documentation.

## 4. Creating a ZFS Pool (Example)

This example demonstrates how to create a simple, file-based ZFS pool for testing purposes. This is **not** recommended for production use.

1.  **Create a file to use as a virtual disk:**

    ```bash
    sudo fallocate -l 4G /zfs-disk
    ```

2.  **Create a ZFS pool named `my-pool` using the file:**

    ```bash
    sudo zpool create my-pool /zfs-disk
    ```

3.  **Check the status of the new pool:**

    ```bash
    sudo zpool status my-pool
    ```

4.  **Create a ZFS filesystem in the pool:**

    ```bash
    sudo zfs create my-pool/my-filesystem
    ```

5.  **Mount the new filesystem and check its properties:**

    ```bash
    sudo zfs list
    ```

You should now have a ZFS pool and filesystem ready for use.

## 5. ZFS Services

ZFS uses several systemd services to manage pools and filesystems. You can list them with:

```bash
systemctl list-units --type=service | grep zfs
```

If you need to customize the behavior of these services, it is recommended to use systemd override files rather than editing the main service files directly.
