Friday, March 6, 2015

Labeling disks on Oracle Solaris for ASM diskgroup candidate disks (using format)

format> disk


AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <ATA-VBOX HARDDISK-1.0-62.76GB>
          /pci@0,0/pci8086,2829@d/disk@0,0
       1. c1t2d0 <ATA-VBOX HARDDISK-1.0-30.00GB>
          /pci@0,0/pci8086,2829@d/disk@2,0
       2. c2t0d0 <DEFAULT cyl 2085 alt 2 hd 255 sec 63 cyl 2085 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,8000@14/sd@0,0
       3. c2t1d0 <VBOX-HARDDISK-1.0 cyl 2086 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,8000@14/sd@1,0
       4. c2t2d0 <VBOX-HARDDISK-1.0 cyl 2086 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,8000@14/sd@2,0
       5. c2t3d0 <VBOX-HARDDISK-1.0 cyl 2086 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,8000@14/sd@3,0
       6. c2t4d0 <VBOX-HARDDISK-1.0 cyl 2086 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,8000@14/sd@4,0
Specify disk (enter its number)[2]: 3
selecting c2t1d0
[disk formatted]
No Solaris fdisk partition found.

format> partition
WARNING - This disk may be in use by an application that has
          modified the fdisk table. Ensure that this disk is
          not currently in use before proceeding to use fdisk.
format> fdisk
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition,  otherwise type "n" to edit the
partition table.
y

format> partition


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit

partition> print
Current partition table (default):
Total disk cylinders available: 2085 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)           0
  1 unassigned    wm       0               0         (0/0/0)           0
  2     backup    wu       0 - 2084       15.97GB    (2085/0/0) 33495525
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0

       
partition> 6
Part      Tag    Flag     Cylinders        Size            Blocks
  6 unassigned    wm       0               0         (0/0/0)           0

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 2 <--- can be 3 as well, just to skip cyl 0 to avoid VTOC
Enter partition size[0b, 0c, 2e, 0.00mb, 0.00gb]: 2082c
partition> print
Current partition table (unnamed):
Total disk cylinders available: 2085 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)           0
  1 unassigned    wm       0               0         (0/0/0)           0
  2     backup    wu       0 - 2084       15.97GB    (2085/0/0) 33495525
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       2 - 2083       15.95GB    (2082/0/0) 33447330
  7 unassigned    wm       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0

partition> label
Ready to label disk, continue? y

root@solaris:~# /usr/sbin/prtvtoc /dev/rdsk/c2t0d0s2
* /dev/rdsk/c2t0d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*    2087 cylinders
*    2085 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
* Unallocated space:
*       First     Sector    Last
*       Sector     Count    Sector
*       16065     16065     32129
*    33479460     16065  33495524
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       2      5    01          0  33495525  33495524
       6      0    00      32130  33447330  33479459
       8      1    01          0     16065     16064

root@solaris:~# ls -l /dev/rdsk/c2t*d0s6
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t0d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@0,0:g,raw
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t1d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@1,0:g,raw
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t2d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@2,0:g,raw
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t3d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@3,0:g,raw
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t4d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@4,0:g,raw
root@solaris:~# chown oracle:dba /dev/rdsk/c2t*d0s6
root@solaris:~# chmod 660 /dev/rdsk/c2t*d0s6

image