mjzraz

updated

17 years ago

M

mjzraz

1 Rookie

93 Posts

0

3567

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

  • dynamox

    11 Legend

    20419 Posts

    87439 Points

    1387

    0

    Posted 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.

  • dynamox

    11 Legend

    20419 Posts

    87439 Points

    1389

    1

    Posted 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.

  • dynamox

    11 Legend

    20419 Posts

    87439 Points

    1388

    1

    Posted 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.
  • mjzraz

    1 Rookie

    93 Posts

    1388

    0

    Posted 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

  • mjzraz

    1 Rookie

    93 Posts

    1388

    0

    Posted 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...

  • mjzraz

    1 Rookie

    93 Posts

    1386

    0

    Posted 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.

  • ral67_xyz

    147 Posts

    1388

    0

    Posted 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

  • dynamox

    11 Legend

    20419 Posts

    87439 Points

    161

    0

    Posted 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

  • mjzraz

    1 Rookie

    93 Posts

    748

    0

    Posted 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

  • dynamox

    11 Legend

    20419 Posts

    87439 Points

    1386

    0

    Posted 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