Skip to main content

Backup Strategy


# 3-2-1 Backup Setup

In this example, we are backing up a ZFS pool RAID 1 consisting of two 2TB Samsung 990 EVO PRO SSDs.

The goal is to implement the 3-2-1 backup strategy: three copies of your data on two different media, with one copy offsite. This setup is designed for a homelab using consumer software, which adds some challenges due to the lack of enterprise-level scalability. Here's how to do it.

## Step 1: Install Proxmox Backup Server (PBS) with Drive Passthrough

First, install PBS with my [drive passthrough](https://git.water.house/jack/Proxmax/-/tree/main/Host/drive-passthrough) script. This passthrough drive will be our first backup. Note that while this setup is fine for a homelab, there is a risk in having the backup drive on the host machine that you should be aware of.

### Installation Steps:
1. **Access Administration:**
   - Go to the browser and navigate to `Administration > Repositories`.
   - Add or remove appropriate free and enterprise repositories as necessary.

2. **Update and Reboot:**
   - Open the shell and run:
     ```bash
     apt update
     apt upgrade
     ```
   - Reboot the system if a kernel update is applied.

3. **Prepare the Backup Drive:**
   - Go to `Administration > Storage > Disks` and wipe the disk you intend to use.
   - Then, either create a directory or a ZFS filesystem on this drive.

4. **Add PBS to Proxmox:**
   - Go back to the dashboard and copy the fingerprint of the PBS instance.
   - Ensure the "Add as datastore" option is checked and note the datastore name you select.

5. **Configure Proxmox:**
   - In Proxmox, go to `Datacenter > Storage > Add > Proxmox Backup Server`.
   - Set the following values:
     - **ID:** Choose a unique identifier.
     - **Server:** IP address of the PBS instance.
     - **Username:** `root@pam` or the appropriate user.
     - **Password:** Password set in PBS.
     - **Datastore:** Name you noted earlier.
     - **Fingerprint:** Paste the fingerprint you copied.

Now, you can run your backup.

## Step 2: Set Up Samba File Share

Since we need to spin up a Windows VM (because Rclone doesn't work well with Proton Drive and Proton Drive only supports NTFS), we'll set up a Samba file share.

### Installation and Configuration:
1. **Install Samba:**
   ```bash
   apt install samba
   ```

2. **Configure Samba:**
   - Edit the Samba configuration file:
     ```bash
     nano /etc/samba/smb.conf
     ```
   - Add a share definition at the end of the file, assuming you want to share the `/mnt/new-storage` directory (corresponding to the passed-through drive):
     ```plaintext
     [SharedDrive]
     path = /mnt/new-storage
     browseable = yes
     read only = no
     guest ok = yes
     force user = root
     ```
     - **path:** Directory you want to share.
     - **browseable:** Allows the share to be visible when browsing network shares.
     - **read only:** Set to `no` to allow writing to the share.
     - **guest ok:** Set to `yes` to allow access without a password (optional).
     - **force user:** Ensures files are accessible to all users via Samba.

3. **Set Permissions:**
   - Ensure that the directory you're sharing has the correct permissions:
     ```bash
     chmod -R 0777 /mnt/new-storage
     ```
     This makes the directory readable and writable by all users. Adjust permissions as necessary depending on your security requirements.

4. **Restart Samba Service:**
   - Apply the changes by restarting the Samba service:
     ```bash
     systemctl restart smbd
     ```

## Step 3: Access the Share from Windows

1. **Access the Share:**
   - Open File Explorer on your Windows PC.
   - In the address bar, type `\Proxmox-IP-Address\SharedDrive` and press Enter.
     - Replace `Proxmox-IP-Address` with the IP address of your Proxmox server, and `SharedDrive` with the name of your share as defined in the `smb.conf` file.
   - Authenticate if prompted. If guest access is allowed, it might not ask for credentials; otherwise, use a valid username and password from the Proxmox server.

2. **Map the Network Drive Permanently (Optional):**
   - Right-click on "This PC" in File Explorer and select "Map network drive...".
   - Choose a drive letter and enter the path to your Proxmox share (e.g., `\Proxmox-IP-Address\SharedDrive`).
   - Check "Reconnect at sign-in" and click "Finish".

## Step 4: Secure Samba Share with a Password (Optional)

If you want to secure your Samba share with a password, follow these steps:

1. **Create a Samba User:**
   - Add a Linux user if it doesn't already exist:
     ```bash
     adduser yourusername
     ```
   - Add the user to Samba:
     ```bash
     smbpasswd -a yourusername
     ```

2. **Modify Samba Configuration:**
   - Edit the Samba configuration file:
     ```bash
     nano /etc/samba/smb.conf
     ```
   - Modify the share definition to require authentication:
     ```plaintext
     [SharedDrive]
     path = /mnt/new-storage
     browseable = yes
     read only = no
     valid users = yourusername
     force user = root
     ```

3. **Restart Samba Service:**
   - Apply the changes by restarting the Samba service:
     ```bash
     systemctl restart smbd
     ```

4. **Access the Share from Windows:**
   - When prompted, enter the username (`yourusername`) and the password set with `smbpasswd`.

By following these steps, you can share the passed-through drive on your Proxmox server with a Windows PC, allowing it to be accessed and used from both systems.