Subject: Create Partitions in Solaris and add them as disks in ASM
Doc ID: Note:271621.1 Type: HOWTO
Last Revision Date: 16-JUN-2004 Status: PUBLISHED
The information in this article applies to:
Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 10.1.0.2
Solaris Operating System (x86)
Solaris Operating System (SPARC 64-bit)
Solaris Operating System (SPARC 32-bit)
Goal
1) To understand how to partition disk in solaris.
2) How to make these disks accessible to the ASM instance.
Fix
We'll take the example of Solaris on Sparc architecture for this Note, but the steps are the same for x86 based systems too.
In Sparc architecture, the solaris disk is subdivided into 8 slices.
Below is the common configuration of these eight slices:
slice 0: Holds files and directories that make up the operating system.*
slice 1: Swap, Provides virtual memory, or swap space.
slice 2: Refers to the entire disk, by convention. The size of this slice should not be changed.**
slice 3: /export, Holds alternative versions of the operating system.
slice 4: /export/swap. Provides virtual memory space for client systems. ***
slice 5: /opt. Holds application software added to a system.
slice 6: /usr. Holds operating system commands--also known as executables-- designed to be run by users.
slice 7: /home. Holds files created by users.
* Cannot be used as ASM disk. Using this slice causes disk corruption and may render the disk as unusable.
** Should not be used as ASM Disk, as slice refers to the entire disk (Including partition tables).
*** Is the recommended slice to be used for ASM disk.
Partitioning of Disk
==============
The format utility is most often used by system administrators to divide a disk into slices. The steps are:
a) Determining which slices are needed
b) Determining the size of each slice
c) Using the format utility to divide the disk into slices
d) Labeling the disk with new slice information
Free Hog
-------------
Before we see the syntax of the format command we must understand the free hog slice that this utility uses:
When you use the format utility to change the size of one or more disk slices, you designate a temporary slice that will expand and shrink to accommodate the resizing operations.
This temporary slice donates, or "frees," space when you expand a slice, and receives, or "hogs," the discarded space when you shrink a slice. This donor slice is called the free hog.
Format Utility
-------------------
# Caution: Any existing data will be destroyed when a disk with existing slices is repartitioned and relabeled.
The easiest way to divide a disk into slices is to use the modify command from the partition menu. The modify command allows you to create slices by specifying the size of each slice in megabytes without having to keep track of starting cylinder boundaries. It also keeps tracks of any disk space remainder in the "free hog" slice.
Following is a example of creating a slice of 5 Gb using format utility.
+++++++++++++
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0 ORACLE
/pci@1f,4000/scsi@3/sd@0,0
1. c0t1d0 ORACLE
/pci@1f,4000/scsi@3/sd@1,0
2. c0t2d0
/pci@1f,4000/scsi@3/sd@2,0
3. c0t3d0
/pci@1f,4000/scsi@3/sd@3,0
Specify disk (enter its number): 2
selecting c0t2d0
[disk formatted]
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
volname - set 8-character volume name
! - execute , then return
quit
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
! - execute , then return
quit
partition> print
Current partition table (original):
Total disk cylinders available: 4924 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 usr wm 0 - 584 1.00GB (585/0/0) 2100735
1 unassigned wm 585 - 1169 1.00GB (585/0/0) 2100735
2 unassigned wm 1170 - 1754 1.00GB (585/0/0) 2100735
3 unassigned wm 1755 - 2339 1.00GB (585/0/0) 2100735
4 unassigned wm 2340 - 2924 1.00GB (585/0/0) 2100735
5 unassigned wm 2925 - 3509 1.00GB (585/0/0) 2100735
6 unassigned wm 3509 - 4677 2.00GB (1169/0/0) 4197879
7 usr wu 4678 - 4923 431.00MB (246/0/0) 883386
partition> modify
Select partitioning base:
0. Current partition table (original)
1. All Free Hog
Choose base (enter number) [0]? 1
Part Tag Flag Cylinders Size Blocks
0 root wm 0 0 (0/0/0) 0
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 - 4923 8.43GB (4924/0/0) 17682084
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 usr wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
Do you wish to continue creating a new partition
table based on above table[yes]? yes
Free Hog partition[6]? 7
Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]: 500mb
Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]: 5gb
Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '6' [0b, 0c, 0.00mb, 0.00gb]:
Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 285 501.00MB (286/0/0) 1027026
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 - 4923 8.43GB (4924/0/0) 17682084
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 286 - 3206 5.00GB (2921/0/0) 10489311
5 unassigned wm 0 0 (0/0/0) 0
6 usr wm 0 0 (0/0/0) 0
7 unassigned wm 3207 - 4923 2.94GB (1717/0/0) 6165747
Okay to make this the current partition table[yes]? yes
Enter table name (remember quotes): "asm"
Ready to label disk, continue? y
partition> q
format> verify
format> q
+++++++++++++++++++++
This completes the creation of the slice to be used as a ASM disk.
Configuring the slice to be used as ASM disk
=================================
Once the slice has been created, It can be used as a ASM disk.
For doing that we need to give a raw interface (character) to it, with appropriate permissions.
In the directory /dev/rdsk we have a raw interfaces (logical) already existing for the slice that we have just created.
# cd /dev/rdsk
# ls -l c0t2d0s4
lrwxrwxrwx 1 root root 45 Feb 24 07:14 c0t2d0s4 -> ../../devices/
pci@1f,4000/scsi@3/sd@2,0:e,raw
This shows that this is a symbolic link to the physical device file.
# ls -lL c0t2d0s4
crw-r----- 1 root sys 32, 20 Feb 24 07:14 c0t2d0s4
This shows that the major and minor device number for this slice is 32,20 respectively.
The 'c' at the beginning shows that this is a character (raw) special file.
For better organization of ASM disks we'll create additional interfaces to this slice from a different location.
Let us create a directory to store these character special files:
# mkdir asmdisk
# cd asmdisk
'mknod' is the utility by which we can create character/block special files.
usage: mknod name [ b/c major minor ] [ p ]
# mknod disk1 c 32 20
This will create a character special file, that is a raw interface to the slice that we had created above i.e. c0t2d0s4.
# ls -l
crw-r--r-- 1 root other 32, 20 May 7 07:50 disk1
For this to be accessible to the ASM instance, we need to give oracle user permission to this file:
# chown oracle:dba disk1
# crw-r--r-- 1 oracle dba 32, 20 May 7 07:50 disk1
Now the slice is ready to be accessible by the ASM instance.
The only thing that we need to make sure now is that the parameter asm_diskstring has a path to this file that we have just created i.e. /asmdisk/disk1.
Once the disk has been discovered by the asm instance, it is ready to be added to any diskgroup.
References
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11118/viewspace-976083/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11118/viewspace-976083/