Last active
December 7, 2024 12:10
Proxmox Backup Server: Create Chunkstore on filesystems not supporting over 65k hard links per directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Gist: https://gist.github.com/mfnalex/41f6eab4baf032206228035d784ab624 | |
# Creates the directory layout for a Proxmox Backup Server Datastore | |
# split up into two directories for people who have to use filesystems | |
# not allowing more than 65k directory entries. | |
# Steps: | |
# 1. Create new Datastore in Proxmox Backup Server GUI | |
# 2. Wait until "Chunkstore create" fails because of "File exists" or "Too many links" | |
# 3. Delete all directories Proxmox Backup Server has created inside your datastore location's .chunks folder | |
# 4. Run this script (be sure to adjust the base_dir variable below) | |
# 5. ??? | |
# 6. Profit | |
# Define base directories | |
base_dir="/mnt/nas1/pbs-grave" # Change this to your datastore location | |
chunks1_dir="$base_dir/.chunks1" | |
chunks2_dir="$base_dir/.chunks2" | |
chunks_symlink_dir="$base_dir/.chunks" | |
# Create the directories if they don't exist | |
mkdir -p "$chunks1_dir" | |
mkdir -p "$chunks2_dir" | |
mkdir -p "$chunks_symlink_dir" | |
# Loop over the hex values for the first half | |
for i in $(seq 0 32767); do | |
hex=$(printf "%04x" $i) | |
# Create directory in chunks1 | |
mkdir -p "$chunks1_dir/$hex" | |
# Create a symbolic link in chunks | |
ln -s "$chunks1_dir/$hex" "$chunks_symlink_dir/$hex" | |
done | |
# Loop over the hex values for the second half | |
for i in $(seq 32768 65535); do | |
hex=$(printf "%04x" $i) | |
# Create directory in chunks2 | |
mkdir -p "$chunks2_dir/$hex" | |
# Create a symbolic link in chunks | |
ln -s "$chunks2_dir/$hex" "$chunks_symlink_dir/$hex" | |
done | |
echo "Directories and symbolic links have been created successfully." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment