Another part of these useful guides may be a guide about how to mount external drive to Solaris and use it as ORACLE partition.
Attach a new hard
drive to Solaris system and check if it is visible by Solaris. You can do this
by executing a command:
# ls
/dev/rdsk/*s0
or using a format
command:
# format
You should get output similar to the following:
# format
You should get output similar to the following:
You can see that
there is a two drives listed. First drive is your root drive and the second one
is extra drive that we have attached to the system. From the first command,
remember the path of the second drive (/dev/rdsk/s0t2d0s0).
Important: if
you can’t see the second drive, then issue the following command:
# devfsadm
It is possible
that Solaris is not aware of that you just added a new drive so you need to
tell to Solaris to check any new hardware. Then follow the steps described
above.
After selecting the
appropriate drive, in our case number 1, pressing Enter and getting the message
that the disk is being formated, at format prompt, you need to enter partition
command:
format>
partition
In my specific case, I got a message like:
In my specific case, I got a message like:
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.
Workaround for
this issue is that you type command:
format>
fdisk
and answer YES
to the question you get.
At last, issue
the partition command and at partition menu, write:
partition>
modify
We will use all
free space on disk partition for ORACLE. Select the option for "All Free
Hog", which should be option 1, and press ENTER. Answer "yes"
when asked if you want to continue creating a new partition table.It will ask
you which slice you want to be the Free Hog partition. Type 0, and then press
ENTER. It will then ask you for the size of the rest of the slices, starting
with 1 and working to 7. Hit ENTER for each of these. It will automatically set
each one to a size of 0, meaning that it is not given any space. Since we set
slice 0 to be the "Free Hog" partition, this ensures that slice 0
takes up the entire space of the drive.
You are then shown the partition table as you have just created it. Note that slice 0 contains the full size of the drive, but so does slice 2. The reason for this is that slice 2 is representative of the entire drive. You should never change it -- it is for the computer's use only.
Answer "yes" when asked if it is ok to make this the current partition table.
It will then ask you for a table name. This is completely up to you. I like to just call it "u01" or something simple like that. Press ENTER. You will then be asked if you are ready to label the disk. Answer "yes" to this question.
At the "partition>" menu, type:
partition> quit
At the "format>" menu, type:
format> save
You will be asked to enter a file name. This is the name of the file where it will save the partition information you have just created. The system reads this information from a file called /etc/format.dat However, if you notice, the line reads:
Enter file name["./format.dat"]:
If you just hit ENTER, you will be saving the partition information to a file called format.dat IN THE CURRENT DIRECTORY! This means that if you are not currently in the “/etc” directory, you will be saving the partition information to the wrong file. VERY IMPORTANT: When it asks you to enter the filename, ALWAYS type the entire pathname:
/etc/format.dat
At the "format>" prompt, type:
You are then shown the partition table as you have just created it. Note that slice 0 contains the full size of the drive, but so does slice 2. The reason for this is that slice 2 is representative of the entire drive. You should never change it -- it is for the computer's use only.
Answer "yes" when asked if it is ok to make this the current partition table.
It will then ask you for a table name. This is completely up to you. I like to just call it "u01" or something simple like that. Press ENTER. You will then be asked if you are ready to label the disk. Answer "yes" to this question.
At the "partition>" menu, type:
partition> quit
At the "format>" menu, type:
format> save
You will be asked to enter a file name. This is the name of the file where it will save the partition information you have just created. The system reads this information from a file called /etc/format.dat However, if you notice, the line reads:
Enter file name["./format.dat"]:
If you just hit ENTER, you will be saving the partition information to a file called format.dat IN THE CURRENT DIRECTORY! This means that if you are not currently in the “/etc” directory, you will be saving the partition information to the wrong file. VERY IMPORTANT: When it asks you to enter the filename, ALWAYS type the entire pathname:
/etc/format.dat
At the "format>" prompt, type:
format> quit
Write a new file system to the slice ("partition."). Now it’s time to involve thing you have remembered at the beginning of this text (controller/target number). We need to issue next command and the syntax is like:
newfs /dev/rdsk/{controller/target/disk number}
In keeping with the example we've been using, to write a new filesystem to the slice we just created, type the following:
# newfs /dev/rdsk/c0t2d0s0
After hitting ENTER, you will be asked if you want to construct a new file system on the device you just specified. Answer "yes" and press ENTER.
Now, finally, we need to create a mount point (aka "directory") where you will mount the slice. The mount point can be named anything you want but since we need it for ORACLE, it is useful if we give it the name “u01”. To create the mount point, type:
# mkdir /u01
One step more: mount the slice to that mount point. Once the mount point has been created, you can manually mount the slice to the mount point by typing:
# mount /dev/dsk/c0t2d0s0 /u01
This will mount slice 0 (s0) of the second disk (t2) on the mount point, or directory, known as /u01. Since we have put the entire drive space of the second disk onto slice 0 of the second disk, consequently, the entire second disk has now been mounted (and therefore is accessible) at /u01.
Write a new file system to the slice ("partition."). Now it’s time to involve thing you have remembered at the beginning of this text (controller/target number). We need to issue next command and the syntax is like:
newfs /dev/rdsk/{controller/target/disk number}
In keeping with the example we've been using, to write a new filesystem to the slice we just created, type the following:
# newfs /dev/rdsk/c0t2d0s0
After hitting ENTER, you will be asked if you want to construct a new file system on the device you just specified. Answer "yes" and press ENTER.
Now, finally, we need to create a mount point (aka "directory") where you will mount the slice. The mount point can be named anything you want but since we need it for ORACLE, it is useful if we give it the name “u01”. To create the mount point, type:
# mkdir /u01
One step more: mount the slice to that mount point. Once the mount point has been created, you can manually mount the slice to the mount point by typing:
# mount /dev/dsk/c0t2d0s0 /u01
This will mount slice 0 (s0) of the second disk (t2) on the mount point, or directory, known as /u01. Since we have put the entire drive space of the second disk onto slice 0 of the second disk, consequently, the entire second disk has now been mounted (and therefore is accessible) at /u01.
One important
thing to note is that when you manually mount things with the mount command, as
we did above, it is only 'temporarily' mounted. By this, I mean that the next
time you reboot the machine, it will no longer be mounted. To fix this, you
need to edit a file called /etc/vfstab. Add a new line like:
/dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s0 /u01 ufs 2 yes -
Thanks!
SvarSlettExcellent Work. Really helpful. Thanks
SvarSlett