Add new disk to Solaris 10

by mn.sobieh

Simply This article explains how to make your Solaris reconize the newly added storage and to be able to mount it.

The Story

For testing purposes I needed a Solaris server. So, created virtual machin to deploy Oracle Database I created one disk for operating system. and another one for database. However, after adding the new hard-disk I expected to be detected automatically like Linux  :). But I was disappointed and confused.Of course I tried to use my Linux commands but FAILED and after a lot of net surfing to fix my problem i found a lot of non useful pages but also found many useful sites.

Objectives

  • Make Solaris recognize the new hard disk.
  • Create a partition and format it.
  • mount the partitions (Permanent mount)

Step 1: Make Solaris recognize the new hard disk.

After adding the Hard-disk to the Virtual Machine hardware setting. Then, start the system.

As you will notice Solaris uses its shell which is abit different than you average Linux Shell “bash”. Therefore, we will  start the bash to get benefits of auto complete :). You can acheive that 

just type bash then hit enter :

#bash
bash-3.2#
 After  we are in bash ,  we will start the steps to achieve our target :
list the current detected drives you should find two drives one for Hard disk second for cdrom [c0t0d0s0 , c0t1d0s0] 
bash-3.2# ls /dev/rdsk/*s0
/dev/rdsk/c0t0d0s0 /dev/rdsk/c0t1d0s0

Now we force Solaris to scan for new hardware

bash-3.2# devfsadm

The default operation is to attempt to load every driver in the system and attach to all possible device instances. Next, the command devfsadm creates logical links to existing device nodes in /dev and /devices

now we test if the command did the trick. by executing the first command. it should show three entries

bash-3.2# ls /dev/rdsk/*s0
/dev/rdsk/c0t0d0s0 /dev/rdsk/c1t0d0s0 /dev/rdsk/c1t1d0s0

Step 2: Create Partition and format it

Now we can partition the hard disk using the command format it will show intercative prompt. It will give us message asking you to select a number of the device you want to partition

bash-3.2# format
Searching for disks…done AVAILABLE DISK SELECTIONS:
0. c1t0d0/[email protected],0/pci1000,[email protected]/[email protected],0
1. c1t1d0/[email protected],0/pci1000,[email protected]/[email protected],0 Specify disk (enter its number):
Type “1″ or the largest number (which is the last hard disk has been added )  then press “enter”. Depending on the type of disk it may be preformatted:

selecting c1t1d0[disk formatted]

If your drive is not formatted, type format at the format prompt to low level format your hard drive. 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” partitionType “y” to accept the default partition, otherwise type “n” to edit thepartition table.y
Next enter the partition menu, by typing partition:
format> partition
You can print out the current partitioning first if you like:
partition> print
Current partition table (original):
Total disk cylinders available: 1020 + 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 – 1020 1.99GB (1021/0/0) 4182016
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 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0
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. Note that partition 2 is used to reference the entire drive and is not a usable partition. To modify a given partition, just enter the number of the partition at the partition prompt:
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]: 1019c
And now to print the partition table again you can see what has changed:
partition> print
Current partition table (unnamed):
Total disk cylinders available: 1020 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 1 – 1019 1.99GB (1019/0/0) 4173824
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 – 1020 1.99GB (1021/0/0) 4182016
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 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0
Save your changes by writing the label to the disk:
partition> label
Ready to label disk, continue? y
Quit out of the partition prompt, and then the format prompt, which takes you back to the command prompt:
partition> quit
format> quit
#

Format the paritition (Create FileSystem)

Now we are ready to create a file system on this new partition (in this case UFS).
# newfs /dev/rdsk/c1t1d0s0
newfs: construct a new file system /dev/rdsk/c1t1d0s0: (y/n)? y
/dev/rdsk/c1t1d0s0: 4173824 sectors in 1019 cylinders of 128 tracks, 32 sectors
2038.0MB in 45 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192,
3298432, 3392672, 3486912, 3581152, 3675392, 3769632, 3863872, 3958112,
4052352, 4146592
Make sure that the file system is clean:
# fsck /dev/rdsk/c1t1d0s0
** /dev/rdsk/c1t1d0s0
** Last Mounted on
** Phase 1 – Check Blocks and Sizes
** Phase 2 – Check Pathnames
** Phase 3a – Check Connectivity
** Phase 3b – Verify Shadows/ACLs
** Phase 4 – Check Reference Counts
** Phase 5 – Check Cylinder Groups
2 files, 9 used, 2020758 free (14 frags, 252593 blocks, 0.0% fragmentation)

Step 3:Mount the parition 

As in Linux. the mount procedure is very semilar. Linux has fstab and Solaris has vfstab. In addition , you need a directory to mount into. As detailed bellow 
 
First, create the directory as your mount destination 
# mkdir /data
 
Next, add the following line to /etc/vfstab:
/dev/dsk/c1t1d0s0 /dev/rdsk/c1t1d0s0 /data ufs 2 yes -
finally, call the mount command to read the setting from vfstab and mount the partition

# mount /data
Check the storage size and mount 
# df -h /data

Filesystem        size   used   avail  capacity Mounted on 
/dev/dsk/c1t1d0s0 1.9G   2.0M   1.9G   1%       /data



Source :
UtahSysAdmin.com

Related Posts

Leave a Comment