Using ASM with files (either locally or via NFS)

From time to time i need to configure additional and temporary storage for data migration or just testing purposes. Raw Devices are not recommended to use from 11g onwards.

So why not use the loopback device for that? With this scenario you can even place these disks on NFS and use it across nodes in a cluster:

 

1. Create the file

dd if=/dev/zero bs=1024k count=1000 of=/disk1

 

2. Setup loopback driver

losetup /dev/loop1 /disk1

 

3. Label device

oracleasm createdisk LOOP1 /dev/loop1

 

4. Use it with ASM

3 thoughts on “Using ASM with files (either locally or via NFS)”

  1. Regarding 11gR2 RAC, ASM, and NFS, it is my understanding that NFS mounted file systems are mounted as anonymous file systems rather than block devices and ASM requires block devices. The only way I know of to have Linux treat an anonymous file system mounted over NFS as a block device is to subsequently mount it as a loop device as shown in your article. However, the Oracle 11gR2 documentation specifically states, “ASM does not support loop devices”.

    How do I mount NFS file systems as block devices so ASM will use them?

    Without creating the loop device, oracleasm createdisk complains the given file is not a block device when i run

    /usr/sbin/oracleasm createdisk DISK1 /u01/oradata/data_disk_01

    where /u01/oradata is an NFS mount from a NetApp volume defined in /etc/fstab.

    When I use the asmca, it does not find any candidate disks even with the search path set.

  2. Oracle also claims that with 11gR2 RAC, that the Direct_NFS client works with ASM diskgroups. But how do you “discover” the mounted disks?
    I was able to discover the mounted disks using a similar approach to yours:
    # dd if=/dev/zero of=/u10/group001/disk001 bs=1024k count=100000
    # losetup /dev/loop1 /u10/group001/disk001
    # ./oracleasm createdisk DISK010 /dev/loop1

    but that doesn’t seem like it will remount on a reboot.
    There are a lot of blogs and white papers that tell you how to configure Direct NFS but nothing on how to get ASM to see this new disk group, officially.

    1. Hi,

      as far as i know “Direct NFS” refers to the ability to use DIRECT IO against data files placed on NFS shares.

      The way you are using ASM with NFS is the only way i know. For re-creating the mapping upon boot you have to write a custom init script.

Leave a Reply

Your email address will not be published.