View Single Post
Old 09-26-2007, 11:09 PM  
Yil
Too much time...
 
Join Date: May 2005
Posts: 1,194
Default Spanning drives

PSA9: Great question!!! Provided /Movies exists as a real directory or as a virtually mounted directory in the VFS you can do what you want (I don't think you can get away without having one). Users will see /Movies having 2 subdirs DVDR and HDDVD and uploads will go to the correct drive.

X:\Movies /Movies/DVDR
Y:\Movies /Movies/HDDVD

You can ALSO use

X:\Movies /Movies
Y:\Movies /Movies

with directories x:\Movies\DVDR and y:\Movies\HDDVD and achieve the same thing. It's a lot trickier though if you later create a DVDR dir on Y outside of ioFTPD since it will start accepting uploads over X with interesting results for subdirs. I detailed some of these issues in the default.vfs file.

I currently have some cool new features partially working to really solve this problem though. I'm hoping for the 6.3 release to finish them up, but it's tricky code so I'm thinking of pulling it and waiting for 6.4. Here's the relevant entries from the ioftpd.ini file:

Code:
# Format for Min_Space_* entries is a number followed by at least one space
# and then a double quoted list of '|' separated, wildcard enabled paths to
# apply the limit to.  As special cases a single letter is presumed to be a
# drive letter and thus 'C' is equivalent to 'C:\*' and all entries ending
# in a '\' are interpretted as ending in a wildcard (i.e. '...\*'). 
#
# Example:
#   ... = 50 "C|D"   5000 "G:\ISOs\|G:\DVDRS\"    100 "*"
#   This would apply 50MB to anything on drives C and D, 5000 to anything
#   under the directories ISOs or DVDRS on drive G, and 100 to any other
#   drive in the system like E, F, as well as any other dirs on drive G.
 
# Required minimum free disk space (in MB) for accepting new uploaded files.
# Once this limit is reached further uploads are rejected just as if the
# drive was actually out of disk space.
;Min_Space_For_Upload = 20 "*"
 
# Required minimum free disk space (in MB) for approving the creation of
# new directories.  Once this limit is reached further directories are
# denied just as if the drive was actually out of disk space.
;Min_Space_For_Dir = 100 "*"
 
 
# The Span_Deny and Span_Approve rules work in tandem to automatically enable
# new directories in merged/raided virtual mounts (i.e. multiple paths mounted
# on the same virtual path so that their contents appear merged) to failover
# to one of the other paths if the currently resolved path becomes full and
# fails the Min_Space_For_Dir test.
#
# Algorithm:
#   Min_Space_For_Dir is defined and the test fails for the new dir's path
#   Span_Approve is defined and matches VFS path
#     [if not defined then reject the directory as spanning isn't enabled]
#   Span_Deny isn't defined or is and there is no match for the VFS path
#     [if defined and it DOES match the VFS path then the new directory is
#       presumed to be a multi-dir release and the directory is allowed as
#       a subdirectory or wherever the parent is].
#   Now search from the bottom up of the merged directories in the vfs file
#     to find a directory that passes it's own Min_Space_For_Dir test.
#     [if none found reject directory]
#   Any necessary parent directories are created on the new path
#   The MKD FTP_Pre-Command_Event is called if one is specified
#     [if the directory is rejected, any created parent directories are
#      silently removed if possible]
#   The directory is created normally from this point on
#
# This is a bit complex because care must be taken not to split certain
# directories across physical filesystems.  First off, since this logic only
# applies to new directories zipscripts shouldn't be effected as files
# in any particular directory will never be separated from each other.
# The problem lies in multiple disk releases.  Spanning /ISOs/08xx so that
# some immediate subdirs are on drive D and other on drive E is wonderful!
# However splitting /ISOs/08xx/Linux-v2.6 so that CD1 and CD2 is on D and
# cd 3,4,5,6 are on E probably isn't a good thing...
#
# When done right the end user will never notice any difference and they
# can just go ahead and keep uploading as you fill up drive after drive!
#
# NOTE: all VFS directory paths (hence everything we are talking about here)
#       always end in a '/'. Space around the '|' is ignored so you can format
#       with some hope of readability.
#
# Example1:
#  Span_Approve = /ISOs/*
#  Span_Deny    = /ISOs/*/*/*
#
# Allow just the ISOs directory to automatically span (even if the .vfs file
# lists other virtual directories with multiple mount points), but try to
# catch any any directory more than 3 levels deep so that
# /ISOs/08xx/Linux-v2.6/ is OK, but /ISOs/08xx/Linux-v2.6/CD1/ is not and
# thus CD1 won't separate from it's parent.
#
# Example2:
#  Span_Approve = *
#  Span_Deny    = */cd1/* | */cd2/* 
#
# Allow spanning whenever possible in the .vfs, but allow any path with any
# of the listed subdirectories to stay with it's parent.
 
# A '|' separated list of wildcard enabled VFS paths that are OK to span.
;Span_Approve = *
 
# A '|' separated list of wildcard enabled VFS paths that shouldn't be spanned.
;Span_Deny    = */cd1/* | */cd2/* | */cd3/*
As you can see to do this properly while not breaking any zipscripts took a little work and it's still subject to change... The biggest problem I have is what happens when users start deleting old stuff off the first totally filled up drive. The drive then has free space and will start accepting new directories and uploads again but this would tend to split up stuff that I'd probably like to see going next to whatever was just uploaded because it's easier to find outside of ioFTPD that way. So I need to introduce some sort of memory or drive affinity or something that I haven't figured out yet. It's not that it wouldn't work now, but it doesn't work the way I want it to yet.

This functionality is something that no script could currently perform because there simply isn't a way to redirect the target of a file / directory command. You can approve the action, but not modify it. I'm tempted to make a way to do this but it would have to be a different section of the .ini file or something because it would break existing scripts...

If you can think of a better way to do this or see a problem I missed do speak up now

Last edited by Zer0Racer; 09-30-2007 at 08:31 AM. Reason: just shortened the Span_Deny stuff in code tag that fuxxored page width
Yil is offline