Need help in creating script for disk mirror and backup

Hi,

I am very new to scripting. I need to create a script which does following.

Scenario:

  1. First get the format command output echo | format
  2. Insert the new disk to Solaris Server
  3. Get Zpool status
  4. format the new disk
    ( Here I need to select the new disk which have been inserted, I do not know how to do it)
  5. Specify disk number (Based on disk in step4)
  6. Label the disk
  7. partition output
  8. print
  9. modify
  10. Chose base(enter number)0?1
  11. Free Hog partition6?0
  12. Enter table name (remember quotes):" "
    Label of the disk in step 4
  13. Ready to label disk. continue ? y
  14. quit format command
  15. Execution of mirror
  16. zpool attach rpool "Disk from Zpool status" New disk at step 4)
  17. Wait for resilvering
  18. Output reslivering is finished
  19. Create installboot

Please any advise and help is appreciated.
I am running on Sparc Solaris 10 x64 T4-1

Thanks,
Praveen

Even if it is possible to script all the tasks, I would not recommend to do so. Working with harddrives is something where you have to keep a lot of things in mind and check for lots of settings and parameters... If even a small thing goes wrong, you can destroy your whole system!
If you really want to go for it, you should check the tool fmthard , which does the same as format without the interactive CLI stuff.

1 Like