Home › Forums › OS X Server and Client Discussion › Xsan › Xsan Quotas by script
- This topic has 2 replies, 3 voices, and was last updated 15 years, 1 month ago by soward.
-
AuthorPosts
-
October 29, 2008 at 6:27 pm #374592bigedmustafaParticipant
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.
January 13, 2009 at 2:06 am #375119gargesParticipantUse 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”
doneThis 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.
January 21, 2009 at 12:15 pm #375187sowardParticipantThere 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 -
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed