Its quite easy to create raw devices on Unix/Linux for testing out the ASM feature provided by oracle 10g. It works great for testing Oracle ASM. The following processes I followd to create virtual raw device on hard device.

Create directory to store the files

# mkdir /asm

Usedd command to create files full of zeros, if specifies the input path. of specifies the output path. bs sets both input and output block sizes to n bytes, count copies only n input blocks.

# dd if=/dev/zero of=/asm/disk1 bs=1024 count=2097152
# dd if=/dev/zero of=/asm/disk2 bs=1024 count=2097152
# dd if=/dev/zero of=/asm/disk3 bs=1024 count=2097152
# dd if=/dev/zero of=/asm/disk4 bs=1024 count=2097152
# dd if=/dev/zero of=/asm/disk5 bs=1024 count=2097152

Here three files are created of Size 2GB each. Now change the ownership of the files on the /asm directory

# chown oracle:dba /asm/disk*

losetup is used to associate loop devices with regular files or block devices.

# losetup /dev/loop1 /asm/disk1
# losetup /dev/loop2 /asm/disk2
# losetup /dev/loop3 /asm/disk3
# losetup /dev/loop4 /asm/disk4
# losetup /dev/loop5 /asm/disk5

The final step is to associate the character block device with a raw block device. Use the raw command to make the association.

# raw /dev/raw/raw1 /dev/loop1
# raw /dev/raw/raw2 /dev/loop2
# raw /dev/raw/raw3 /dev/loop3
# raw /dev/raw/raw4 /dev/loop4
# raw /dev/raw/raw5 /dev/loop5
# chown oracle:dba /dev/raw/raw[1-3]

It always a best practice to zero out the first few megabytes of any raw partition to be used for Oracle ASM.

# dd if=/dev/zero of=/dev/loop1 bs=1024 count=10240
# dd if=/dev/zero of=/dev/loop2 bs=1024 count=10240
# dd if=/dev/zero of=/dev/loop3 bs=1024 count=10240
# dd if=/dev/zero of=/dev/loop4 bs=1024 count=10240
# dd if=/dev/zero of=/dev/loop5 bs=1024 count=10240

At this point, these are three (3) raw devices in the /dev directory, ready to be used by Oracle ASM. Note: All the loopback devices and association to raw devices are lost if the system is rebooted. If you want to make these persistent, place all of those above commands into /etc/rc.local.