日期:2014-05-16  浏览次数:20374 次

Oracle ASM Advanced Tranning 1 —— Configuration of Devices for ASM

Part 1 : Configure devices for ASM using file system files and loop devices

Check the amount of space available on file system

[root@vasm ~]# df -TH
Filesystem    Type     Size   Used  Avail Use% Mounted on
/dev/sda3     ext3      46G   6.3G    38G  15% /
/dev/sda1     ext3     200M    23M   167M  12% /boot
tmpfs        tmpfs     2.1G      0   2.1G   0% /dev/shm
/dev/sr0   iso9660     3.9G   3.9G      0 100% /media/disk

Create a directory to hold the files to be used as ASM devices

[oracle@vasm ~]$ mkdir -p /u01/app/asm_loop_devices
[oracle@vasm ~]$ ls -l /u01/app
total 8
drwxr-xr-x 2 oracle oinstall 4096 Feb 20 09:06 asm_loop_devices/
drwxr-xr-x 5 oracle oinstall 4096 Feb 19 15:59 oracle/

Create the files to be used as Asm devices

[oracle@vasm ~]$ cd /u01/app/asm_loop_devices
[oracle@vasm asm_loop_devices]$ dd if=/dev/zero of=/u01/app/asm_loop_devices/fs_dsk1 bs=1M count=500
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 0.79403 seconds, 660 MB/s
[oracle@vasm asm_loop_devices]$ dd if=/dev/zero of=/u01/app/asm_loop_devices/fs_dsk2 bs=1M count=500
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 0.864626 seconds, 606 MB/s
[oracle@vasm asm_loop_devices]$ dd if=/dev/zero of=/u01/app/asm_loop_devices/fs_dsk3 bs=1M count=500
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 7.32695 seconds, 71.6 MB/s
[oracle@vasm asm_loop_devices]$ dd if=/dev/zero of=/u01/app/asm_loop_devices/fs_dsk4 bs=1M count=500
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 3.04805 seconds, 172 MB/s
[oracle@vasm asm_loop_devices]$ ls -ltrh
total 2.0G
-rw-r--r-- 1 oracle oinstall 500M Feb 20 09:07 fs_dsk1
-rw-r--r-- 1 oracle oinstall 500M Feb 20 09:07 fs_dsk2
-rw-r--r-- 1 oracle oinstall 500M Feb 20 09:08 fs_dsk3
-rw-r--r-- 1 oracle oinstall 500M Feb 20 09:08 fs_dsk4
[oracle@vasm asm_loop_devices]$ pwd
/u01/app/asm_loop_devices

Connect to root and check if there are loop devices

[oracle@vasm asm_loop_devices]$ su - root
Password: 
[root@vasm ~]# raw -qa
[root@vasm ~]# 

As root create the loop devices

[root@vasm ~]# losetup /dev/loop1 /u01/app/asm_loop_devices/fs_dsk1 
[root@vasm ~]# losetup /dev/loop2 /u01/app/asm_loop_devices/fs_dsk2 
[root@vasm ~]# losetup /dev/loop3 /u01/app/asm_loop_devices/fs_dsk3
[root@vasm ~]# losetup /dev/loop4 /u01/app/asm_loop_devices/fs_dsk4

Bind the loop devices to raw devices