How to Use Cockpit and ZFS to Transform Ubuntu into a Powerful NAS

If you’ve got an Ubuntu machine that you’d like to use as a Network Attached Storage (NAS) server, Cockpit makes it easy to do. Cockpit is a web-based server management tool that lets you manage multiple servers from one dashboard. In its latest version, Cockpit comes with a File Sharing feature that turns Ubuntu into a NAS server in just five easy steps.

Install required packages

Open the terminal and enter this command to install the necessary packages:

sudo apt-get install samba samba-common smbclient samba-dsdb-modules

Install Cockpit

Enter this command to install Cockpit:

sudo apt-get install cockpit

The Cockpit ZFS Manager plugin is a community-developed extension that integrates ZFS management into the Cockpit interface. To install the plugin, follow these steps:

  1. Open a terminal on your Linux server and update the package lists:
sudo apt update
  1. Install the plugin using the package manager:
sudo apt install cockpit-zfs-manager
  1. Restart the Cockpit service:
sudo systemctl restart cockpit

Access ZFS Manager in Cockpit

  1. Open your preferred web browser and navigate to your Cockpit server’s URL:
  1. Log in using your server’s credentials.
  2. Once logged in, you will see the “ZFS Manager” tab on the left side of the interface. Click on it to access the ZFS management features.

Manage ZFS Pools

The ZFS Manager plugin allows you to create, monitor, and manage ZFS storage pools. You can perform various operations, such as creating a new pool, adding disks, and checking pool status.

  1. To create a new pool, click on the “Create Pool” button at the top of the ZFS Manager page.
  2. Provide a name for the new pool, select the disk(s) to be included in the pool, and choose the desired RAID level.
  3. Click “Create” to create the new ZFS pool.

Manage ZFS File Systems and Snapshots

The ZFS Manager plugin also enables you to manage file systems and snapshots within the ZFS pools.

  1. Navigate to the “File Systems” tab under the ZFS Manager page.
  2. To create a new file system, click on the “Create File System” button, provide a name, and click “Create.”
  3. To create a snapshot of a file system, select the desired file system and click the “Create Snapshot” button. Provide a name for the snapshot and click “Create.”

Monitor ZFS Pool Health and Performance

The ZFS Manager plugin provides a comprehensive overview of your ZFS pool’s health and performance, including:

  1. Space usage: View the total, allocated, and free space in your ZFS pool.
  2. Pool status: Monitor the overall health of your ZFS pool, including any potential issues or errors.
  3. Disk utilization: Track the individual disk usage within the ZFS pool.

Enable the file sharing

  1. Open Cockpit by entering your IP address followed by port number 9090 in your web browser (e.g., http://your-ip:9090/)
  2. Login with your username and password
  3. Click on “File Sharing” in the sidebar menu
  4. Click on the “Enable File Sharing” button
  5. Choose a directory to share and click “Save”
  6. Adjust the permissions as needed

Set up a user account

  1. In Cockpit, go to the “Users” section
  2. Click on the “Add User” button
  3. Fill in the required fields, including login and password
  4. Click “Create User”

Access the NAS from another device

  1. In Cockpit, go to the “Overview” section
  2. Note the IP address below the server name
  3. On your client device, open the file explorer and enter the IP address in the address bar
  4. You will be prompted for a username and password. Enter the credentials from Step 4.
  5. You should now be able to access your shared directory, and your Ubuntu machine has been transformed into a NAS.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.