Jump to content

User share and disc failure


Recommended Posts

Hi all,

 

I have a question about user share usage and safety concern.

 

I will use my unraid server to store movies I own (DVD, HD DVD and Blu-ray). Then I use a mediacenter to watch them.

 

Now the use of shares seems perfect, as for 14 drives, the plugin will just have to search the movies in one place (the name of the share) instead of the 14 drives. Perfect also for copying, no more worry about space left when building an iso to search for a drive.

 

So indeed the share is a wonderful option, but…

 

Now I think hardware trouble. If I have one disc that breaks, no trouble. If I have 2, I just loose the data on the 2 (reason why I choose unraid as I can’t afford to backup 14To of data). So I will have to rip again those movies again from the discs. Hey, by the way, which movies will I have to rip again ?

 

Ah ah, using shares, you don’t know which movies you lost on the two faulty drives. See what is my next question : how will I know what was on those drives ?

 

Does anyone know if there is a way to get a list of all the leaf directories with the disc name instead of the share name (in a way it could be easely manipulated, for example to put in database/excel and group by disc name) ?

I must not be the first one wondering about this, well i hope not

I don’t need live, this could be a script to launch once in a while so in case of hardware trouble, I could just know what I will have to rip again

Link to comment

I might be able to help.  I've been trying to learn bash scripting so I can start to understand some of what goes on here.  Here is a crack at a solution for you based on what I've been able to learn so far.  (I'm sure that there is a much more efficient way to code some of this, but it is my first attempt at a shell script so I still have a lot to learn.  Suggestions welcome.)

 

#!/bin/bash

# Enter the name of the user share here
ushare=Movies
# Enter the name of a subfolder you want to track within the user share here
ushare_sub=_Childrens_DVDs
# Enter the path you want to save the output file to here
file_path=/mnt/user/broken_cache/

# testing for the existence of the output file
if [ -f $file_path/Movie_on_Disk_List_${ushare}.txt ]
then
  echo "There is an existing existence of the ${file_path}Movie_on_Disk_List_${ushare}.txt file.  It will be copied to *.backup"
  mv ${file_path}Movie_on_Disk_List_${ushare}.txt ${file_path}Movie_on_Disk_List_${ushare}.txt.backup
else
echo "There is NOT an existing existence of the ${file_path}Movie_on_Disk_List_${ushare}.txt file.  It will automatically be created."
fi

# Loop through each disk #
for i in `seq 1 19`
do
CURRENT_DIR=/mnt/disk${i}
# testing to see if there is a $ushare directory on the disk
if [ -d $CURRENT_DIR/$ushare ]
then
  echo "The ${ushare} directory exists on disk # ${i}" ; echo "***** The ${ushare} directory exists on disk # ${i}" >>  ${file_path}Movie_on_Disk_List_${ushare}.txt
    /bin/ls -1 /mnt/disk${i}/$ushare/ >> ${file_path}Movie_on_Disk_List_${ushare}.txt
# testing to see if there is a sub-Directory called ushare_sub in the Movies directory
if [ -d $CURRENT_DIR/$ushare/$ushare_sub ]
then
echo "The ${ushare_sub} directory exists on disk # ${i}" ; echo "***** The ${ushare_sub} directory exists on disk # ${i}" >> ${file_path}Movie_on_Disk_List_${ushare}.txt
  /bin/ls -1 /mnt/disk${i}/$ushare/$ushare_sub/ >> ${file_path}Movie_on_Disk_List_${ushare}.txt
else
echo "The ${ushare_sub} directory does NOT exist on disk # ${i}" ; echo "***** The ${ushare_sub} directory on disk # ${i} does NOT exist" >> ${file_path}Movie_on_Disk_List_${ushare}.txt
fi
else
  echo "The ${ushare} directory does NOT exist on disk # ${i}" ; echo "***** The ${ushare} directory on disk # ${i} does NOT exist" >> ${file_path}Movie_on_Disk_List_${ushare}.txt
fi
done


 

There are three lines to edit in this script. 

 

1. Replace the "ushare=Movies" line with the name of the root level user share you want to list.  It could be "ushare=Music" or whatever.

2. Replace the "ushare_sub=_Childrens_DVDs" line with the name of the sub-folder you want to list within the user share.  It could be "ushare_sub=MP3" or whatever. If you don't want to list a sub-folder within your share then it would be ushare_sub="".

3. Replace the "file_path=/mnt/user/broken_cache/" line with the path where you want to save the file list.  It could be "file_path=/mnt/user/Music/Lists/" or whatever.  It should probably be located outside of the array so that you can get to it if the disks fail and you can't access the array. You could use "file_path=/boot/custom/log/" to do this.

 

Then just run the script from the command line.  Then open your new text file wherever you had is saved to.  If you had previously run the script so that a file list for that share already exists, the script will first backup the old file and then create the new file list.

 

It will output a list of all the directories and files in the user share with an indication as to which physical drive the folder or files are located.

 

If you want, you could make a version of this script for each of your user shares and call this script from the go script or set up a cron job so that the lists stay updated.

 

Hope this helps!

 

Link to comment

Archived

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

×
×
  • Create New...