Home Forums OS X Server and Client Discussion Xsan Xsan Quotas by script

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #374592
    bigedmustafa
    Participant

    does anybody know how to set xsan quotas via a script/list of users.

    I wish to apply a quotas to a set of users that are allowed to use my xsan. These users are located within the institutes active directory. However I want to pick out around 3000 users from a list of 40,000. I have a text file which contains the list of users I wish to add to my xsan and have been trying to use the cvadmin cli to try and create quotas for them but without luck. It creates the first quota then fails on all others.

    Obviously I don’t want to try and have to add them one at a time and thought that someone may have an idea that I could implement to achieve my goal.

    #375119
    garges
    Participant

    Use the shell “for loop” to repeatedly execute the cvadmin command for each user. Something like:

    for name in `cat FileOfUserNames`
    do
    cvadmin -F XSANVoumeName -e “quotas set user $name 21474836480 19327352832 10080”
    done

    This would take a file named FileOfUserNames which should be a plain text file with one username and nothing else on each line. It would loop for each line in the file setting that line to the variable “name.” Then it would call cvadmin to set the quota to 20Gb hard, 19Gb soft, one week warning.

    #375187
    soward
    Participant

    There is some overhead associated with each ‘cvadmin’ call, if you are doing a few hundred or so it won’t matter much but with some number of thousands I’d suggest something like the following…

    for i in `cat userlist’; do
    echo ‘quotas set user $i $HARD $SOFT $TTL’ > /tmp/$$.dat
    done
    cvadmin -F $VOLNAME < /tmp/$$.dat or something like that. Also unless you enjoy receiving the messages, you'll want to change 'ExceededSoftQuota' to false in /Library/Filesystems/Xsan/config/notifications.plist on the MDCs

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Comments are closed