Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

3464

January 15th, 2010 11:00

How can I run a script to create 400 Quota trees at one time?

We are starting a migration and have 12,000 User Home Directories and 400 Departmental directories. For the User directories, we are using user based quotas. For the Departmental directories we want to use Tree quotas and create the directories and quotas before we start the migration.

Using Putty.exe from the CLI, I can run the following to create the Quota tree (which creates the folder) :

nas_quotas -on -tree -fs Data1 -path /treequotatest -comment 'this is a test'

Next I can run the following to set the quota limit:

$ nas_quotas -edit -tree -fs Data1 -block 102400:92160 3

I guess I have 2 questions, 1. how can I write a script or put a batch file together to create multiple Quota trees all at one time like:

nas_quotas -on -tree -fs Data1 -path /treequotatest1 -comment 'this is a test'

nas_quotas -on -tree -fs Data1 -path /treequotatest2 -comment 'this is a test'

nas_quotas -on -tree -fs Data1 -path /treequotatest3 -comment 'this is a test'

nas_quotas -on -tree -fs Data1 -path /treequotatest4 -comment 'this is a test'

nas_quotas -on -tree -fs Data1 -path /treequotatest5 -comment 'this is a test'

nas_quotas -on -tree -fs Data1 -path /treequotatest6 -comment 'this is a test'

etc...

2nd question is through the CLI, is there a way to reference the quota trees other than by the id# when running the cmd to edit the quota?

If not, I suppose there is some way to export the list of trees and the id#'s associated with them.

Trying to create 400 Quota trees from the Web GUI was painful, so i tried the CLI and was hoping for a way to do it more efficiently.

Thanks

1 Rookie

 • 

20.4K Posts

January 27th, 2010 06:00

let's make sure there are no control characters in your "departments.txt" file. On control station run this command:

dos2unix departments.txt

now try your comand again.

1 Rookie

 • 

20.4K Posts

January 15th, 2010 11:00

create a text file that contains a list of departments and save is as "departments.txt" , for example:

hr

marketing

management

then from command line run:

DEP=`cat departments.txt`

for i in $DEP

do

echo "Creating directory for $i"

nas_quotas -on -tree -fs Data1 -path "$i"  -comment 'this is a test'

done


i don't think there is another way to reference quota id's but output from nas_quotas -list -tree -fs and nas_quotas -report -tree -fs will help you script your nas_quotas -report -tree -fs command.

1 Rookie

 • 

20.4K Posts

January 26th, 2010 15:00

you need to copy this file to Celerra control station. You can use open source tools like FileZilla and connect control station using SFTP protocol.

90 Posts

January 26th, 2010 15:00

This is very helpful, but I am stuck on where to put the departments.txt file

I tried putting the file in the folder where I am running putty.exe from on my windows PC:

c:\putty\departments.txt

When I type:

DEP=`cat departments.txt`

I get:
cat: departments.txt: No such file or directory

I also tried it by typing:
DEP=`cat "c:\putty\departments.txt"`

I get:
cat: c:\putty\departments.txt: No such file or directory

90 Posts

January 27th, 2010 05:00

Thanks, now we are getting somewhere. I did use filezilla logged in with the same username and password and i was able to copy files to:

home/username Which is where my command prompt defaults to using putty.

It looks like it is reading the file now, but I got another error:

Error 13431603213: Control char: Invalid Tree Quota path character. A tree quota path on a Data Mover that does not have Unicode enabled must use ASCII characters only.

I tried twice with the following in my text file and got the same results:

/treetesta
/treetestb
/treetestc

and

/treetest1
/treetest2
/treetest3

The commands i am running are:

[admin@NAS1 ~]$ DEP=`cat departments.txt`

[admin@NAS1 ~]$ for i in $DEP; do nas_quotas -on -tree -fs Data1 -path "$i"; done

I searched for unicode, ascii in the documentation and havent found really anything not even how to enable it or what that will affect. Can't find anything on that error code. I am currently searching info on invalid ascii characters.I created the txt file in windows notepad and it is saved as ANSI which seems to be ascii from what I read so far...

90 Posts

January 27th, 2010 07:00

That was it !!!!!!!

I created a file on the control station using vi and it worked and running the command dos2unix worked as well. This is great thanks for the help.

When viewing the txt file on my PC It used to look like

/treetesta
/treetestb
/treetestc

now it looks like

/treetesta/treetestb/treetestc

however if I cut and paste it somewhere, the carriage returns re-appear and it looks like:

/treetesta
/treetestb
/treetestc

So I guess I either need to find a text editor that will save in unix format or run that dos2unix command.

147 Posts

January 27th, 2010 07:00

It looks like it is reading the file now, but I got another error:

Error 13431603213: Control char: Invalid Tree Quota path character. A tree quota path on a Data Mover that does not have Unicode enabled must use ASCII characters only.

I would also suggest to check if your CIFS servers are configured with Unicode support - just do a server_cifs server_2 and see what I18N mode says

server_checkup server_2 -test CIFS will also look for it

without it you cant use non-ASCII characters for Objects like shares and so on

Rainer

1 Rookie

 • 

20.4K Posts

January 27th, 2010 08:00

you would need that if you are trying to use multi-byte characters, like share names using german umlauts.

Ärger

90 Posts

January 27th, 2010 08:00

ral67 wrote:

I would also suggest to check if your CIFS servers are configured with Unicode support - just do a server_cifs server_2 and see what I18N mode says

Here's what i got:

I18N mode = UNICODE

server_checkup server_2 -test CIFS will also look for it

Here's what I got:

I18N      : Checking the I18N mode and the Unicode/UTF8 translation tables. Pass

1 Rookie

 • 

20.4K Posts

January 27th, 2010 08:00

So I guess I either need to find a text editor that will save in unix format or run that dos2unix command.

you will love Notepad ++

http://notepad-plus.sourceforge.net/uk/site.htm

147 Posts

January 27th, 2010 09:00

dynamox schrieb:

So I guess I either need to find a text editor that will save in unix format or run that dos2unix command.

you will love Notepad ++

http://notepad-plus.sourceforge.net/uk/site.htm

vi for Windows or vim of course :-)

147 Posts

January 27th, 2010 09:00

thats fine then - the error from nas_quota must have been a false one because of some control characters from your text editor

90 Posts

March 30th, 2010 22:00

I am still having trouble with this. I am trying to create 8 quota trees and modify 8 quota trees in a script.

What am I doing wrong?

Here is my script:

#!/bin/sh
echo "creating tree quotas"
nas_quotas -on -tree -fs Data2 -path /drm
nas_quotas -on -tree -fs Data2 -path /eve
nas_quotas -on -tree -fs Data2 -path /psych
nas_quotas -on -tree -fs Data2 -path /cardio
nas_quotas -on -tree -fs Data2 -path /drb
nas_quotas -on -tree -fs Data2 -path /drbl
nas_quotas -on -tree -fs Data2 -path /drev
nas_quotas -on -tree -fs Data2 -path /endo
echo "editing tree quotas"
nas_quotas -edit -tree -fs Data2 -block 94371840:104857600 1
nas_quotas -edit -tree -fs Data2 -block 94371840:104857600 2
nas_quotas -edit -tree -fs Data2 -block 188743680:209715200 3
nas_quotas -edit -tree -fs Data2 -block 471859200:524288000 4
nas_quotas -edit -tree -fs Data2 -block 47185920:52428800 5
nas_quotas -edit -tree -fs Data2 -block 37748736:41943040 6
nas_quotas -edit -tree -fs Data2 -block 28313600:31457280 7
nas_quotas -edit -tree -fs Data2 -block 235929600:262144000 8

It appears to run fine, but when I run nas_quotas -report -tree -fs Data2

I get:


Report for tree quotas on filesystem Data2 mounted on /root_vdm_3/Data2
+------------+---------------------------------+-------------------------------+
| Tree       |        Bytes Used  (1K)         |            Files              |
+------------+--------+-------+-------+--------+--------+------+------+--------+
|            |   Used |  Soft |  Hard |Timeleft|   Used | Soft | Hard |Timeleft|
+------------+--------+-------+-------+--------+--------+------+------+--------+
|#1          |       0|104857600|104857600|        |       1|     0|     0|                         |
|#2          |       0|104857600|104857600|        |       1|     0|     0|                         |
|#3          |       0|209715200|209715200|        |       1|     0|     0|                         |
|#4          |       0|524288000|524288000|        |       1|     0|     0|                         |
|#5          |       0|52428800|52428800|        |       1|     0|     0|                         |
|#6          |       0|41943040|41943040|        |       1|     0|     0|                         |
|#7          |       0|31457280|31457280|        |       1|     0|     0|                         |
|#8          |       0|262144000|262144000|        |       1|     0|     0|                         |
+------------+--------+-------+-------+--------+--------+------+------+--------+

It creates the quota trees, but the my soft limits are the same as my hard limits. It does the same if I run each command individually from the CLI.

Not as important, but the GUI is messed up as well:

TQGUI.JPG

Some quota trees show as 0MB, but If I right-click properties, I get:

TQProperties.JPG

Here it looks the same as from the CLI.

90 Posts

March 30th, 2010 22:00

I think I need some sleep...

I looked at the server log:


2010-03-31 00:48:21: CFS: 4: Tree block soft limit (104857600) can not be greater than hard limit(94371840), setting hard limit equal to soft limit
2010-03-31 00:48:21: ADMIN: 6: Command succeeded:  file quota /root_vdm_3/Data2 type=tree set id=2 bsoft=13107200 bhard=11796480 isoft=0 ihard=0
2010-03-31 00:48:21: ADMIN: 6: Indication: NULL list in addToSendList
2010-03-31 00:48:22: ADMIN: 6: last message repeated 7 times

from the celerra quotas documentation, here is the syntax:

$ nas_quotas -edit -tree -fs -block -inode -comment <‘comment’>

I thought it was soft:hard.... duh, well that could be the problem

After deleting all the quotas and trying again it seems to have worked:


Report for tree quotas on filesystem Data2 mounted on /root_vdm_3/Data2
+------------+---------------------------------+-------------------------------+
| Tree       |        Bytes Used  (1K)         |            Files              |
+------------+--------+-------+-------+--------+--------+------+------+--------+
|            |   Used |  Soft |  Hard |Timeleft|   Used | Soft | Hard |Timeleft|
+------------+--------+-------+-------+--------+--------+------+------+--------+
|#1          |       0|94371840|104857600|        |       1|     0|     0|        |
|#2          |       0|94371840|104857600|        |       1|     0|     0|        |
|#3          |       0|188743680|209715200|        |       1|     0|     0|        |
|#4          |       0|471859200|524288000|        |       1|     0|     0|        |
|#5          |       0|47185920|52428800|        |       1|     0|     0|        |
|#6          |       0|37748736|41943040|        |       1|     0|     0|        |
|#7          |       0|28313600|31457280|        |       1|     0|     0|        |
|#8          |       0|235929600|262144000|        |       1|     0|     0|        |
+------------+--------+-------+-------+--------+--------+------+------+--------+

The GUI even looks fine:

treeGUI.JPG

No Events found!

Top