• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support General Questions Questions about backups

     
    • 0 Vote(s) - 0 Average

    Questions about backups

    fflam
    Offline

    Junior Member

    Posts: 17
    Threads: 2
    Joined: 2024 Jul
    Reputation: 0
    #1
    2024-12-09, 05:53 AM
    Looking into properly backup my Jellyfin install, I came across this site. Jellyfin docs backup and restore Fairly straight forward, I run Jellyfin in a Debian LXC on Proxmox. so I just need to copy /var/lib/jellyfin and /etc/jellyfin. I noticed that contains the metadata folder, and for me that is currently over 50GB. as far as I can tell that folder just contains things like trickplay, posters, actor, and studio information. If i code to omit those files from the back up, if i have to restore it should be able to recreate/download all of that information again correct?  currently for me bandwidth is cheap, but physical storage is at a premium, so I'm looking for a way to reduce the size of my backups.
    laughing_man77
    Offline

    Junior Member

    Posts: 5
    Threads: 1
    Joined: 2024 Feb
    Reputation: 0
    #2
    2024-12-09, 09:49 AM
    This may help you. Here's a copy of my backup/restore scripts. It assumes you're using docker (you can comment out the docker compose lines if you want). I only bother backing up the config and ignore the movies (they are stored separately for me, anyway), but if you want that too, uncomment the declaration for data_dir and the second tar command.
    Other than that, replace the values for version, data_dir and backup_dir. Then run
    Code:
    ./backup.sh

    backup.sh:

    Code:
    #! /bin/bash
    sudo docker compose down
    version="10.10.3"
    config_dir="relative/path/to/jellyfin/config"
    # data_dir="relative/path/to/jellyfin/data"
    backup_dir="relative/path/to/backup"
    timestamp=$(date +%Y.%m.%d.%H.%M.%S)
    if [ -z "${backup_dir}" ]; then
            mkdir ${backup_dir}
    fi
    cd ${backup_dir}
    tar -zcvf jellyfin.config.${timestamp}_${version}.tgz ../${config_dir}
    # tar -zcvf jellyfin.data.${timestamp}_${version}.tgz ../${data_dir}
    cd -
    sudo docker compose up -d

    This is the restore script. It makes a backup of the existing config in backup_dir, so that you can restore the old config if anyting goes wrong. Depending on the number of parent directories to you config directory, you may need to edit --strip-components=2 (which strips leading directories from the path when it untars the archive). I haven't bothered creating a restore for the data dir, but you could easily run that manually with 
    Code:
    tar zxvf relative/path/to/data_archive.tgz -C relative/path/to/data/dir --strip-components=2

    Edit the config_dir and backup_dir values, then run the script with:
    Code:
    ./restore.sh path/to/config_archive.tgz

    restore.sh:

    Code:
    #! /bin/bash
    sudo docker compose down
    backup_file=$1
    config_dir="relative/path/to/jellyfin/config"
    backup_dir="relative/path/to/backup/old_config"
    if [ -z "${backup_file}" ]; then
            echo "no backup file given."
            exit 1
    fi
    if [ ! -f "${backup_file}" ]; then
            echo "backup file ${backup_file} does not exist."
            exit 1
    fi
    echo "moving existing config to $backup_dir"
    if [ ! -d ${backup_dir} ]; then
            mkdir -p ${backup_dir}
    fi
    rm -R ${backup_dir}/* ${backup_dir}/.*
    sudo mv ${backup_dir}/* ${backup_dir}/
    echo "Restoring config"
    tar zxvf ${backup_file} -C ${config_dir} --strip-components=2
    sudo docker compose up -d
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 11,848
    Threads: 10
    Joined: 2023 Jun
    Reputation: 347
    Country:United States
    #3
    2024-12-09, 02:48 PM
    You could probably omit the entire /var/lib/jellyfin/metadata/library folder. That is the largest folder, by far, and is replaceable. Keeping everything else should maintain watch status, media identification, playlists, etc.
    Jellyfin 10.10.3 (Docker)
    Ubuntu 24.04 LTS 
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        3x WD Red Pro 6TB CMR in RAIDZ1 (JF Library)
    [Image: GitHub%20Sponsors-grey?logo=github]
    fflam
    Offline

    Junior Member

    Posts: 17
    Threads: 2
    Joined: 2024 Jul
    Reputation: 0
    #4
    2024-12-14, 05:43 AM
    Sorry for the late reply, had something come up.

    laughing_man77 Thank you for the scripts. I don't use Docker but I am sure they will help. My question was more what files HAVE to be backed up, not about the back up process. Thank you none the less.

    Quote: You could probably omit the entire /var/lib/jellyfin/metadata/library folder. That is the largest folder, by far, and is replaceable. Keeping everything else should maintain watch status, media identification, playlists, etc.

    I figured as much, it seems to be mostly the image files for the metadata and trickplay information. I just wanted to be sure before I went and messed something up. Really the most important thing is the users login/password. other things would be annoying to lose, but that would be a pain to set up again.

    Thank you
    « Next Oldest | Next Newest »

    Users browsing this thread:


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode