Saturday, 11 October 2014

Adding a New Disk to Oracle Solaris 10

Adding new disks to OS is a regular task of a system administrator as well as database admin. In this article I will demonstrate how to add a hard drive to Solaris 10, including the format, fdisk, partition, and then creation of the file system.

1- Run the following command to show the original drives
    # ls /dev/rdsk/*s0
    /dev/rdsk/c0t0d0s0 /dev/rdsk/c1t0d0s0
2- Let Solaris check for new hardware:
   # devfsadm
   Now you can see there is a new disk on another bus (c1t1d0).
3-  Next, we want to format and create partition the drive
# format
Searching for disks…done
AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@0,0/pci1000,30@10/sd@0,0
1. c1t1d0
/pci@0,0/pci1000,30@10/sd@1,0
Specify disk (enter its number):Type “1″, the option for the new drive and hit “enter”. Depending on the type of disk it may be     preformatted:
4- If your drive is not formatted, type format at the format prompt to low level format your hard drive.
5- Next, we need to use fdisk to create the partitions, type “y” to create the default Solaris partition:
          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
6-You can print out the current partitioning
         partition> print
         Current partition table (original):
In this case, I just want to create one large partition for some extra storage so I will allocate all I can to partition 0.

      partition> 0
      Part Tag Flag Cylinders Size Blocks
      0 unassigned wm 0 0 (0/0/0) 0
      Enter partition id tag[unassigned]:
      Enter partition permission flags[wm]:
      Enter new starting cyl[0]: 1
      Enter partition size[0b, 0c, 1e, 0.00mb, 0.00gb]:
7- And now to print the partition table again you can see what has changed:
     partition> print
     Current partition table (unnamed):
8- Save your changes by writing the label to the disk:
     partition> label
     Ready to label disk, continue? y
9-Quit out of the partition prompt, and then the format prompt
10- Now we are ready to create a file system on this new partition
     # newfs /dev/rdsk/c1t1d0s0
11- Next, add the proper line to /etc/vfstab:
    /dev/dsk/c1t1d0s0 /dev/rdsk/c1t1d0s0 /data ufs 2 yes -
12- Make a partition and then mount the partition.
     # mkdir /data
     # mount /data
     # df -h /data