Jump to content

Context for setup

 

Gaming PC (Old GTX970) Running Windows 10 (In Home Office)

Optiplex That acts as Home nas and Parsec in to play WoW Windows 10 (In Home Office)

 

Opliplex in Bedroom that is just for browsing and learning (Boot.dev)  Windows 10

Laptop Lenovo running Mint.

 

I've only just moved to Mint as don't like windows 11 and most of my stuff doesn't meet requirements.

Currently I have the Google drive app on everything other then my Laptop

Any learning I'm doing is within the folder that is live backed up to drive.

 

I cannot get the app on Mint doesn't seem to be offically supported.

 

Current work around is connect to my NAS in work within the directory their and the Optiplex then handles live backups to google.

 

Issue with Mint doesn't seem to like using the network share can bog down a bit when opening a file in VS code for example that is actually on the NAS not local.

 

another thing seems to be having to manually "remount" the NAS every time I turn it on rather then just being a mapped drive like would find on windows. (Don't have to re-enter the info just click within favorites but it freaks out wee bit and needs to take like 3 seconds to restablish connection)

 

Is their a better way to have network locations on mint or another option for live cross document backup cross platform?

 

Sorry if didn't explain it well any thoughts most welcome :)

Link to comment
https://linustechtips.com/topic/1609552-live-cross-os-backup/
Share on other sites

Link to post
Share on other sites

On 4/21/2025 at 5:13 PM, Tehkast said:

Is their a better way to have network locations on mint or another option for live cross document backup cross platform?

  1. Mount the Samba location by utilizing cifs-utils (a package that may have been installed on Mint, or run apt install if not existing) and /etc/fstab (the system-wide configuration for mounting file systems automatically at boot), as described in this blog post.
  2. Take a try to Nextcloud, the open-source solution for cross-platform backup/syncing and alternative to Google Cloud.😉
Link to comment
https://linustechtips.com/topic/1609552-live-cross-os-backup/#findComment-16711176
Share on other sites

Link to post
Share on other sites

Heres one of my Ubuntu backup scripts; this one in particular is for Docker containers on a media server. 

But you can look at the logic and how it archives the files into a folder; and saves it to a mounted network share. 

I just schedule it with CRON to run every week a few hours before my automatic updates script. 

(I do full VM backups so this is just contingencies to backup the most important stuff to keep up to date)

 

You can always just give this to ChatGPT to rewrite it for what you want. 

You could also just rsync the files to another machine (if its Linux) rather than using a cifs mount. 

 

#!/bin/bash
#########################################################
#                                                       #
#          Elements Linux Server Backup Script          #
#                                                       #
#        Written by Jarsky ||  Updated 13/04/2022       #
#                                                       #
#########################################################

# General variables
hostname=$(hostname)
logfile="/var/log/backup-files.log"
backup_path="/mnt/share/BACKUP/$hostname"
threshold=$(date -d "60 days ago" +%d%m%y)

# Email Settings
sendEmail="false"
externalUrl="https://mywebsite.com"
fromEmail="me@email.com"
fromName="My Email Name"
toEmail="me@email.com"
smtp_relay="myrelay.local.lan"
servername="Server Name"
backupemailTemplate=emails/backup.eml
emailTemp=emails/backup.tmp

# Exclude list of apps
exclude_apps=(
        "portainer",
        "watchtower"
)

export emlhostname=$hostname
export emlFromName=$fromName

exec 1>> >(ts '[%Y-%m-%d %H:%M:%S]' >> "$logfile") 2>&1

# Ensure the backup path exists
if [ ! -d "$backup_path" ]; then
    echo "Creating backup directory: $backup_path"
    mkdir -p "$backup_path" || { echo "Failed to create backup directory"; exit 1; }
fi


# Function to wait until a container is stopped
wait_for_stop() {
    container_name="$1"
    while docker ps -q -f name="$container_name" > /dev/null; do
        echo "Waiting for $container_name to stop..."
        sleep 1
    done
}

# Function to wait until a container is started
wait_for_start() {
    container_name="$1"
    while ! docker ps -q -f name="$container_name" > /dev/null; do
        echo "Waiting for $container_name to start..."
        sleep 1
    done
}

# Iterate through each subdirectory in /opt/appdata/
for app_dir in /opt/appdata/*/; do
    app_name=$(basename "$app_dir")

    # Skip apps in the exclude list
    if [[ " ${exclude_apps[@]} " =~ " $app_name " ]]; then
        echo "Skipping $app_name as it's in the exclude list"
        continue
    fi

    # Check if a Docker container with the same name exists and stop it
    if docker ps -q -f name="$app_name"; then
        echo "Stopping Docker container for $app_name..."
        docker stop "$app_name"
        wait_for_stop "$app_name"  # Wait until the container is stopped
    fi

    # Special case for Plex (exclude cache folder)
    if [ "$app_name" == "plex" ]; then
        echo "Backing up Plex with exclusion for cache..."
        tar --exclude="$app_dir/config/Library/Application Support/Plex Media Server/Cache" -zcvf "${backup_path}/${hostname}-${app_name}-backup-$(date '+%d%m%y').tar.gz" "$app_dir"
    else
        # Backup all other apps normally
        echo "Backing up $app_name..."
        tar -zcvf "${backup_path}/${hostname}-${app_name}-backup-$(date '+%d%m%y').tar.gz" "$app_dir"
    fi

    # Restart the Docker container if it was stopped
    if docker ps -q -f name="$app_name"; then
        echo "Docker container for $app_name is already running."
    else
        echo "Starting Docker container for $app_name..."
        docker start "$app_name"
        wait_for_start "$app_name"  # Wait until the container is started
    fi
done

# Cleanup old backups (older than XX days)
find "${backup_path}/$hostname" -maxdepth 1 -type f -print0 | while IFS= read -d '' -r file; do
    if [[ "$(basename "$file")" =~ ^.*[0-9]{5}.tar.gz$ ]]; then
        [ "$(basename "$file" .tar.gz)" -le "$threshold" ] && rm -v -- "$file"
    fi
done

# Get backup filenames and send email
if [ "$sendEmail" == "true" ]; then
    export emlbkFiles=$(ls -pt "${backup_path}/${hostname}/" | grep -E ".*tar.gz" | head -n 3)
    rm -rf "$emailTemp"
    template="$backupemailTemplate"
    tmpfile="$emailTemp"
    cat "$template" | envsubst > "$tmpfile"
    sendemail -f "$fromEmail" -t "$toEmail" -s "$smtp_relay" -u "[INFO] $servername - Backup Completed" -o message-file="$emailTemp"
else
    echo 'Email Notification DISABLED'
fi

 

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | Asus RTX 4060 Dual OC | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO + 4 Additional Venturi 120mm Fans | 8 x 20TB Seagate Exos X22 | 4 x 16TB Seagate Exos X18 | 3 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Spoiler

NAS: Innovision 4U 24-bay chassis (12GB MiniHD SGIO Backplane) | Intel Core i9-10980xe | EVGA X299 FTW-K | EVGA RTX 2080Ti Super FTW3 | 128GB (8x16GB) Corsair Vengeance LPX 3200Mhz | DEEPCOOL PN1000M PSU| Noctua NH-D12L Chromax Black | 16 x 16TB Seagate Exos X18 | 2 x 2TB Samsung 990 Pro | 2 x 2TB Intel U.2 P4510 | LSI 9305-24i HBA

 

Link to comment
https://linustechtips.com/topic/1609552-live-cross-os-backup/#findComment-16713926
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×