前段时间安装虚拟Linux上的ASM实例,中间反复了几次,不过最终解决了这部分的问题。现记录下来与大家分享。
ASM是Oracle针对数据存储提出的解决方案。区别于传统的Oracle数据库使用数据库实例进行文件管理,ASM体系专门建立了ASM实例。同数据库实例相似,ASM实例是由一系列后台进程和一块共享内存SGA组成,专门负责文件的读写。数据库实例(单个和多个)不需要直接进行数据在磁盘上的读写,而是只需要连接ASM实例,与ASM实例进行交互读写数据。ASM专门进行I/O负载和存储管理等系列工作。
环境说明
本环境使用VMWare虚拟机搭建的CentOS4.8。虚拟硬盘两块,分别为30G和10G。其中30G空间为操作系统和软件,10G第二块硬盘分区作为ASM盘。
规划方案:计划将第二块硬盘分为三个分区,各个分区大小相等。每个分区作为一个ASM盘,名称分别为VOL1、VOL2和VOL3。
此时,第一块磁盘sda划分为系统盘区sda1,挂入点为/目录。此时使用率为9%。另一个sda2为swap分区,空间大概为1.5G左右。
Last login: Wed Apr 6 23:26:00 2011 from 192.168.0.1
[root@asmlab ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 28G 2.3G 25G 9% /
none 498M 0 498M 0% /dev/shm
硬件信息
[root@asmlab dev]# ls -l | grep sd
brw-rw---- 1 root disk 8, 0 Apr 9 2011 sda
brw-rw---- 1 root disk 8, 1 Apr 9 2011 sda1
brw-rw---- 1 root disk 8, 2 Apr 9 2011 sda2
brw-rw---- 1 root disk 8, 16 Apr 9 2011 sdb
磁盘分区情况为:
[root@asmlab dev]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3686 29607763+ 83 Linux
/dev/sda2 3687 3915 1839442+ 82 Linux swap
Disk /dev/sdb: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
进行ASM盘分区
首先需要根据规划方案,对sdb盘进行分区格式化操作。在linux上,可以使用fdisk命令,在交互的方式下进行磁盘分区。
[root@asmlab dev]# fdisk /dev/sdb --命令方式:fdisk <进行分区的磁盘文件>
The number of cylinders for this disk is set to 1566.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): m –查看一下命令方式
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n –新建立一个分区
Command action –要求输入新建主分区还是拓展分区,注意:一块硬盘上主分区只能有四个
e extended
p primary partition (1-4)
p //选择主分区
Partition number (1-4): 1 //主分区编号输入
First cylinder (1-1566, default 1): 1 //分区起始柱面,该硬盘可用的范围是1-1566;
Last cylinder or +size or +sizeM or +sizeK (1-1566, default 1566): 500 //分区截止柱面
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2 //输入第二个分区
First cylinder (501-1566, default 501): 501
Last cylinder or +size or +sizeM or +sizeK (501-1566, default 1566): 1000
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1001-1566, default 1001): 1001
Last cylinder or +size or +sizeM or +sizeK (1001-1566, default 1566): 1560
--注意:此时分区信息还没有正式写入,要求输入w命令后才能写入!
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
此时,分区信息为:
[root@asmlab dev]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3686 29607763+ 83 Linux
/dev/sda2 3687 3915 1839442+ 82 Linux swap
Disk /dev/sdb: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 500 4016218+ 83 Linux
/dev/sdb2 501 1000 4016250 83 Linux
/dev/sdb3 1001 1560 4498200 83 Linux
分区建立之后,还要用特定的文件系统格式进行分区格式化。
[root@asmlab dev]# mkfs.ext3 /dev/sdb1 //使用ext3格式进行格式化磁盘分区/dev/sdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
502944 inodes, 1004054 blocks
50202 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1031798784
31 block groups
32768 blocks per group, 32768 fragments per group
16224 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@asmlab dev]# mkfs.ext3 /dev/sdb2
180 days, whichever comes first. Use tune2fs -c or -i to override.
(篇幅所限,有删节…)
[root@asmlab dev]# mkfs.ext3 /dev/sdb3
mke2fs 1.35 (28-Feb-2004)
180 days, whichever comes first. Use tune2fs -c or -i to override.
(篇幅所限,有删节…)
准备好分区磁盘之后,就可以进行ASM驱动安装和ASM disk配置构建了。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17203031/viewspace-692538/ ,如需转载,请注明出处,否则将追究法律责任。