Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Where to place softlinks to facilitate backup

Featured Replies

Hello

 

im using one of the shell scripts to backup data from my unraid server. Instead of naming each directory to backup within the script i’d rather like to use one directory which contains softlinks to the directories to backup. Where is the best place to put that? I placed them in /mnt/backup-links which seemed to be not the best idea. Thank you for help!

Solved by bmartino1

  • Community Expert
  • Solution

make a share and place them in a directory or use linux temp location...

/tmp

this will write the backup files into ram though...

here is a script example:

 

1 Create a share (if not already created).

2 Create a directory (/mnt/user/backup-links/) to store soft links.

3 Iterate through the soft links and back up the linked directories.

4 Store the backup in a specified location.

 

#!/bin/bash

# Define variables
LINKS_DIR="/mnt/user/backup-links"  # Directory to store soft links
BACKUP_DEST="/mnt/user/backups"      # Destination for backups
DATE=$(date +"%Y-%m-%d_%H-%M-%S")    # Timestamp for backup
BACKUP_NAME="backup_$DATE.tar.gz"    # Backup filename

# Ensure the backup directory exists
mkdir -p "$BACKUP_DEST"

# Ensure the links directory exists
mkdir -p "$LINKS_DIR"

# Create an array to store backup sources
declare -a BACKUP_SOURCES=()

# Iterate over soft links in LINKS_DIR
for link in "$LINKS_DIR"/*; do
    if [ -L "$link" ]; then
        TARGET=$(readlink -f "$link")
        if [ -d "$TARGET" ]; then
            BACKUP_SOURCES+=("$TARGET")
        else
            echo "Skipping $link, target $TARGET is not a directory."
        fi
    fi
done

# Check if there are directories to back up
if [ ${#BACKUP_SOURCES[@]} -eq 0 ]; then
    echo "No valid directories found in $LINKS_DIR."
    exit 1
fi

# Create the backup
tar -czf "$BACKUP_DEST/$BACKUP_NAME" "${BACKUP_SOURCES[@]}"

echo "Backup completed: $BACKUP_DEST/$BACKUP_NAME"

 

How to Use:

 

1 Create a Share for Backup Links

In the Unraid GUI, go to Shares → Add Share

Name it backup-links

Set appropriate permissions

 

2 Create Soft Links in /mnt/user/backup-links/

Use SSH or terminal:

Example:

ln -s /mnt/user/documents /mnt/user/backup-links/documents
ln -s /mnt/user/photos /mnt/user/backup-links/photos

 

3 Run the Backup Script

Save the script as /boot/config/plugins/user.scripts/scripts/backup_script.sh
* User Script Plugin...

 

Alternative: Use /tmp/backup-links/ (RAM)

If you want temporary soft links stored in RAM, change:

LINKS_DIR="/tmp/backup-links"

However, this will be lost after a reboot.

  • 2 weeks later...
  • Author

@bmartino1 sorry to be so late with my Thank you very much for this fast solutiont

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.