Script to format 4 new disks in Solaris 11


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to format 4 new disks in Solaris 11
# 1  
Old 01-15-2014
Script to format 4 new disks in Solaris 11

I want to develop a script that I can run like follows:

./format_disks.sh <disk name 1>, <disk name 2>, etc...

Some background. I've create a VMware based virtual machine that has Solaris 5.11 installed on it. Initially, the only disk that is on this VM is the one that hosts the OS. I then create 4 additional disks on this VM, while the VM is shutdown with the VMware software, specs as follows:

- 2GB, named c8t1d0
- 2GB, named c8t2d0
- 5GB, named c8t3d0
- 5GB, named c8t4d0

The manual process that I've been doing to get this done is running through the wizard in Solaris 5.11, by typing the format command, then supplying the values as the prompt requests the values, finagling ending the wizard by typing the label command to save the changes. I do this for each of the 4 disks above. Can I somehow accomplish the task I'm wanting by only typing the bolded command above? Or is there some other way to format disk in Solaris 5.11 other than the wizard I'm discussing?
# 2  
Old 01-24-2014
I have never used Solaris 11 and probably never will. But I have used Solaris 10. we would always mirror our disks. I needed two disks with the same layout. I would use the interactive format command on the first and then do:
Code:
prtvtoc /dev/rdsk/${rootdisk}s2 | fmthard -s - /dev/rdsk/${rootmirror}s2

The prtvtoc command just displays the disk geometry and the fmthard command reads this for it's input. I had a bunch of disks to layout and it occurred to me to simply save the output from prtvtoc and hard code it into a script.
Code:
#! /usr/bin/ksh

repeat() {
cat << EOF
* /dev/rdsk/c1t1d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*     424 sectors/track
*      24 tracks/cylinder
*   10176 sectors/cylinder
*   14089 cylinders
*   14087 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0  20606400  20606399
       1      3    01   20606400   8649600  29255999
       2      5    00          0 143349312 143349311
       3      8    00   29256000   4324800  33580799
       4      0    00   33580800 109615872 143196671
       7      0    01  143196672    152640 143349311
EOF
}
destination=/dev/rdsk/c1t0d0s2
echo Before:
prtvtoc $destination
echo
repeat | fmthard -s - $destination
echo After:
prtvtoc $destination
exit 0

Maybe you can adapt some of this for your purposes.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Solaris 10 Sparc. How to change Vendor info of SAN disks reported in "format" command?

Greetings! After block level migration using an external appliance, the luns are getting reported as DGC-RAID5 and these luns are infact from the new storage. I have a query on changing the device Vendor info from DGC-RAID5 to HP3par in the format o/p only. AVAILABLE DISK SELECTIONS: ... (3 Replies)
Discussion started by: n_Bhaskar
3 Replies

2. Solaris

Grant unprivileged user rights to see the output of echo|format but not modify disks

anyone have any idea how do to this with auth_attr? I suspect if I grant him solaris.device.:RO::Device Allocation::help=DevAllocHeader.html that will work but I'm unsure. Just looking for a second opinion. (10 Replies)
Discussion started by: os2mac
10 Replies

3. Solaris

list all solaris Disks

Hi Guy's can anyone advise me .. I have mapped some of EMC devices from EMC Storage to Sun Solaris server and I want to list all the disk which are assigned from the storage can anyone advise me with the command how to can I list all the disk in Solaris Thanks .. (2 Replies)
Discussion started by: roooooot
2 Replies

4. Solaris

Solaris raw disks info

Hi, I need the following information. 1. We have raw disks but how to identify raw disks. Is there any command to identify its type and size. 2. How to differentiate between disks which are used as file system and that are still available to be used as raw. I know we can use df -n to... (7 Replies)
Discussion started by: malikshahid85
7 Replies

5. Shell Programming and Scripting

getting number of disks in solaris

Friends, i have used the following code to get the number of disks in solaris echo | pfexec format | egrep -v "Searching|AVAILABLE|Specify|^$|@" | wc -l is there a better way to get the same result (5 Replies)
Discussion started by: achak01
5 Replies

6. Solaris

disks in solaris

whats the command to find name of all disks. Is it iostat -En ? (1 Reply)
Discussion started by: vikashtulsiyan
1 Replies

7. Solaris

Hard disks in solaris

I need to insert a new hard disk into a Sun Fire v210 machine. The (only) internal disk which is already in the machine is part number XRA-SC1CB-73G10K (DISK DRIVE ASSY. 73GB, 10K RPM, with SPUD BRACKET). I also have nearly endless access to IBM hard disks at extremely low prices and would there... (2 Replies)
Discussion started by: sprellari
2 Replies

8. Solaris

Solaris x86 - 2 new disks

Have a compaq dl380 proliant installed with solaris.. It has a smart array 5i controller.. currently I have 2 18gb disks - mirrored as far as I can see... I have just put in 2 36gb disks (just physically put in) How do I get solaris to recognise them so I can use them? format command - only... (2 Replies)
Discussion started by: frustrated1
2 Replies

9. SCO

Format disks

I need to decommission an old server which uses Unixware 2.1 and need to wipe the disks. Can anyone advise what the formatting command is as I'm not very familiar with this OS. Thanks (1 Reply)
Discussion started by: janetsimm
1 Replies

10. Filesystems, Disks and Memory

re-partition disks on solaris

hi all, i was wondering if i have some volume manager and i want to format all partitions/disks and re-create new slices can i use regular format command or what? i think veritas volume manager is already installed. (2 Replies)
Discussion started by: Bashar
2 Replies
Login or Register to Ask a Question