May 26, 20251 yr I'm new to Unraid, and bringing up a 7.0.1 system. I'd like to create a simple backup script to save the /boot/config files periodically to a directory in the array. I thought a script like this could be run as a cron job daily to back up Unraid to the array:#!/bin/bash# back up flash drive unraid boot to array#NOW=$( date '+%F' ) BAKFILE=/mnt/disk1/d/IMAGES/T440-Unraid/boot-config-backup-$NOW.zipzip -r $BAKFILE /boot/config/The problem is that my share "d" is spread across /mnt/disk1 through /mnt/disk4. Is there a preferred way to directly access a share from the Unraid shell and deterministically access a specific directory in the array?Is this the purpose of /mnt/user? it looks like it mirrors the array sharing structure.
May 26, 20251 yr The user shares are simply the combined top level folders on array and pools. They are at /mnt/userYou should use the User Scripts plugin to manage your scripts.
May 26, 20251 yr Be sure you don't try to mix disks/pools and user shares when moving or copying files. Linux doesn't know these might reference the same file and so could try to overwrite the file it is trying to read.Also, the Unraid Connect plugin will backup your flash drive to the Unraid cloud. And Appdata Backup Plugin includes a feature to backup your flash drive.Note that storing the flash backup on the array is sort of a Catch-22, since you would need to boot the server in order to access the backup you need to boot the server.
May 26, 20251 yr Author @trurl good point about storing the backup on the array. I understand one of the advantages of Unraid is that the disks are readable in isolation, but it would be a pain to figure out which drive contained the backup, removed it, mount it on another machine, recover it, etc. I'll find another place for it on a different system.I just found out the hard way why you say "You should use the User Scripts plugin to manage your scripts."I rebooted the Unraid system, and my /root/scripts directory and the scripts I just created were gone.root@T440:~# ls -ltotal 0root@T440:~#I'll get the plugin, but Is there a guide to user scripting and how to create persistent storage for scripts in the Unraid shell?I installed "User Scripts - A plugin to act as a simple front end for any user scripts to allow you to run them without entering the command line"I'm not sure where to start, but I don't mind using the command line, I just want my scripts to remain between boots. Do I have to use the GUI, or can I still use the shell through SSH? Edited May 26, 20251 yr by timg11
May 26, 20251 yr Be careful at the command line, obviously. One of the main things I already mentioned:56 minutes ago, trurl said:Be sure you don't try to mix disks/pools and user shares when moving or copying files. Linux doesn't know these might reference the same file and so could try to overwrite the file it is trying to read.The OS with all the usual Linux folders are in RAM. The flash drive contains archives of the OS (think of it as firmware), and your settings from the webUI (your configuration, in the /config folder as you know).Only mounted storage persists:/mnt/disk#, /mnt/poolname, /mnt/user, /mnt/disks and /mnt/remotes (Unassigned Devices and remotes). /boot is the flash drive, but best if you don't overuse that.
May 26, 20251 yr 34 minutes ago, timg11 said:can I still use the shell through SSH?Note that Unraid is not intended to be a general purpose, multi-user Linux. It is a NAS OS which can host Dockers and VMs. It is based on slackware but doesn't include many things you might expect to have on Linux, particularly tools for development.Only root user has access to the command line. The other users are strictly for network file access.If you want a general purpose, multi-user Linux, create a VM.
May 31, 20251 yr Author @trurl I have a Debian VM for "normal" general purpose applications. I was thinking that something like backing up the Unraid OS config would be best done in Unraid from a cron job. Otherwise I would have to share the /boot directory on the USB drive so it could be accessed from the VM. I'll try the user scripts plugin for that task, and write the saved config to both the unraid array, as well as a separate network device.
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.