Announcement Banner
UNSOLVED

JohnH4

updated

18 years ago

J

JohnH4

32 Posts

0

619

February 13th, 2009 14:00

Script for unattended fs_copy ?

I want to call a script from cron to:

unexport a filesystem
do an fs_copy
re-export the filesystem

I have some ideas on how to script it up, but I would like to see if there are any sterling examples or caveats that I can review first.

-John
  • JohnH4

    32 Posts

    305

    0

    Posted February 13th, 2009 14:00

    or from at command ...
  • dynamox

    11 Legend

    •

    20419 Posts

    •

    87439 Points

    305

    0

    Posted February 13th, 2009 14:00

    perl , bash ?
  • dynamox

    11 Legend

    •

    20419 Posts

    •

    87439 Points

    305

    0

    Posted February 13th, 2009 15:00

    what are you trying to achieve ? Nightly backups, file system refresh for qa/development ?
  • JohnH4

    32 Posts

    305

    0

    Posted February 13th, 2009 15:00

    one time move of fs on ATA shelf - to new fs on new FC shelf

    I have done manually before, but would like to try scripting it for middle of night migration

    I know there is replication technique, but it seems too complex and I'm not sure about the sequence of steps

    -J
  • JohnH4

    32 Posts

    305

    0

    Posted February 13th, 2009 15:00

    bash
  • dynamox

    11 Legend

    •

    20419 Posts

    •

    87439 Points

    305

    1

    Posted February 14th, 2009 23:00

    since you have done it manually ..it's really just a matter of putting your command in a file and maybe using variable names instead of hard coding file system names, for example:

    export NAS_DB=/nas
    export PATH=$PATH:/nas/bin
     
    ## Target file system is created but not mounted ##
     
    SOURCEFS=fs59
    TARGETFS=fs69
    SERVER=server_4
    MOUNTPOINT=${TARGETFS}
    SNAPNAME=${SOURCEFS}_ckpt
     
    nas_fs -Type rawfs ${TARGETFS} -Force
    server_mountpoint ${SERVER} -create /${MOUNTPOINT}
    server_mount ${SERVER} -option ro ${TARGETFS} /${MOUNTPOINT}
    fs_ckpt ${SOURCEFS} -name ${SNAPNAME} -Create
    echo "Starting fs_copy process"
    fs_copy -start ${SNAPNAME} ${TARGETFS}
    echo "Initial fs_copy completed"
    nas_fs -delete ${SNAPNAME} -o umount=yes
    server_mount ${SERVER} -option rw ${TARGETFS} /${MOUNTPOINT}
    


    Unfortunately Celerra developers refuse to release error codes so it's nearly impossible to take actions within the script based on error codes. For example if there is a snapsure process in progress, it will not allow you to take a snapshot until the one running completes. Checking $? value does not help a lot. I submitted an RFE to get error codes from Celerra developers two years ago...still waiting.
  • JohnH4

    32 Posts

    305

    0

    Posted February 16th, 2009 08:00

    Many thanks dynamox,

    Thats what I was looking for, just a sanity check on a scripting method.

    I'll give that a go on a test fs and let you know.

    If anyone else wants to add, I'm keeping the topic open for a while.

    -John