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.

Synchronizing folders within Unraid server

Featured Replies

Hi everyone,

I'm current;y using Unraid 4.7 with 4 x 2Tb drives, where one of them is assigned as parity. The only content that's really important, are the photos and family videos. Therefore, the 2Tb parity drive is kinda a wasted space... Is there any way for me to avoid using the parity drive (so I can use it for storage), but have a copy of the Photos / Videos folder on another drive within the same Unraid and keep these folders synchronized? I.e. once I add some photos to the "original" folder, the copy of the folder on another drive gets updated? Would Crashplan be an application I should be looking at, or perhaps, is there a script I could use to achieve this? Any input would be greatly appreciated. Thanks.

Yes you can... I do this myself with a few script files:

 

Add the following lines to your GO file:

 

# Installing in-array backup scripts
cp /boot/config/Users_Yesterday /etc/cron.daily/Users_Yesterday
chmod +x /etc/cron.daily/Users_Yesterday

 

Then create a file called Users_Yesterday and place it in your /boot/config directory, contents of the file should be as follows:

 

#!/bin/bash
rsync -avz /mnt/user/users /mnt/user/Users_Yesterday

 

Then create a share in unraid called "Users_Yesterday" and configure it so only one disk will be used for the share.

 

Then change your "users" share to make only use of another disk.

 

This setup will create a copy of your `users´ share every night.

 

I actually have 3 of these, also a `Users_Lastweek' and 'Users_Lastmonth'. All on a different drive, that way I have my own "snapshots" ..

 

I would still advice using parity though... It will be a lot easier in case of drive failure..

  • Author

Helmonder,

One more question... will this share be copied over the existing content (i.e. overwrite)or will it compare the content and skip copying the files that are already existing in the "target" share? I'm hoping the latter one... If not, is there a way of achieving this? So basically comparing the content and lnly copying the new files, that don't exist at the target location yet? Thanks again for the help.

It is the latter. Compare and overwrite changes. It will also NOT delete stuff that were deleted in the primary share (easy to do if you want, just another parameter), I did that on purpose to protect myself from stupid mistakes..

  • Author

Thank you again for the confirmation. Would you mind telling me which parameter causes the share to be copied "every night". Is there a parameter that controls the time this will happen.

 

Also, may I ask you another question, which I think could be controlled by adding a line or two to the Go file? How can I have a listing of all the files on each of the drives generated and written to a file at a specified location? I would like to have a record of each drive's content in case it fails. Then I would know what was lost... I'd still rpefer to avoid using parity... basically to save money... Thank you.

This setup will make sure it happens every night... The script itself just does a rsync copy when it is called and the fact that is added in CRON makes sure it happens regularly.

 

This line in the GO script:

 

cp /boot/config/Users_Yesterday /etc/cron.daily/Users_Yesterday

 

Actually copies the script that does the task to a directory that will cause linux to run the scipt once a day.

 

Thank you again for the confirmation. Would you mind telling me which parameter causes the share to be copied "every night". Is there a parameter that controls the time this will happen.

 

Also, may I ask you another question, which I think could be controlled by adding a line or two to the Go file? How can I have a listing of all the files on each of the drives generated and written to a file at a specified location? I would like to have a record of each drive's content in case it fails. Then I would know what was lost... I'd still rpefer to avoid using parity... basically to save money... Thank you.

 

Mmm.. I still thank that not using parity is not such a good idea but ofcourse it depends on the value of your data, if it is not important enough then it would be unwise to you use parity ofcourse..

 

The linux equivalent of DIR in dos is "ls", the commandline switch "-R" will make it recursive which means it will do a listing on everythng underneath the location you start it.

 

Storage in unraid starts under /mnt/user (assuming you are using user shares). So you could create such a listing by doing:

 

cd /mnt/user

ls -algR

 

Now that will cause the info to be displayed on your screen but you want it in a file.

 

Linux will let you redirect output to console to a file by using ">"

 

Lets say you want to save this file to your disk 1 in a directory called filelist. The command would then be:

 

cd /mnt/user

LS -algR > /mnt/disk1/filelist/filelist.txt

 

Now you can make this a lot prettier and also faster but you should be able to google yourself around that.

 

Have fun :-)

  • Author

Thanks again Helmonder. Very informative crash course. I will of course Google the rest. Once again, your help is really greatly appreciated. All the best.

  • 4 weeks later...
  • Author

Hellmonder (or anyone else)... I hate to admit, but after multiple attempts (changing the share names, playing with the share disk assignment), the solution posted above doesn't seem to be working (for me). I've included the following lines in the GO file:

cp /boot/config/Backup_7D /etc/cron.daily/Backup_7D

chmod +x /etc/cron.daily/Backup_7D

cp /boot/config/Backup_Home_Videos /etc/cron.daily/Backup_Home_Videos

chmod +x /etc/cron.daily/Backup_Home_Videos

 

I've also created two files in the same folder as the GO file - Backup_7D and Backup_Home_Videos (both files without any extensions). The contents of the files are:

 

#!/bin/bash

rsync -avz /mnt/user/Canon_7D /mnt/user/Backup_7D

 

And

 

#!/bin/bash

rsync -avz /mnt/user/Home_Videos /mnt/user/Backup_Home_Videos

 

Where Canon_7D and Home_Videos are shares on my Disk4 (these are the source). I changed these two shares' included disks to be Disk4 only.

 

The other shares (destinations) are located on Disk5 and I changed their included disk to be Disk5.

 

Any ideas as to what I'm doing wrong? Nothing is being copied... Thank you in advance.

First try and find out where the issue lies. What happens when you execute both files from commandline ?  Do they work or is there an error, if there is an error, what is it ?

 

Common mistake could be that you made those two files in windows notepad and saved them.. You would need to use a program like Editpad Lite if you make unix files, windows adds unseeable characters that linux chokes on..

Archived

This topic is now archived and is closed to further replies.

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.