How to Create ASM on Linux Volume Manager (LVM)

Creating ASM on Linux Volume Manager (LVM) is pretty straight forward

STEP 1
======

Create disk partitions
# dcserver20:/> fdisk /dev/sdcc

Command (m for help): p

Disk /dev/sdcc (Sun disk label): 128 heads, 32 sectors, 2558 cylinders
Units = cylinders of 4096 * 512 bytes

    Device Flag    Start       End    Blocks   Id  System
/dev/sdcc3  u          0      2558   5238784    5  Whole disk
/dev/sdcc8  u          0      2558   5238784    f  Unknown

Command (m for help): d
Partition number (1-8): 8

Command (m for help): p

Disk /dev/sdcc (Sun disk label): 128 heads, 32 sectors, 2558 cylinders
Units = cylinders of 4096 * 512 bytes

    Device Flag    Start       End    Blocks   Id  System
/dev/sdcc3  u          0      2558   5238784    5  Whole disk

Command (m for help): d
Partition number (1-8): 3
If you want to maintain SunOS/Solaris compatibility, consider leaving this
partition as Whole disk (5), starting at 0, with 10477568 sectors

Command (m for help): p

Disk /dev/sdcc (Sun disk label): 128 heads, 32 sectors, 2558 cylinders
Units = cylinders of 4096 * 512 bytes

    Device Flag    Start       End    Blocks   Id  System

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

STEP 2
======

Create Physical Volumes (PV)
# dcserver20:/> pvcreate  /dev/sdcd1 /dev/sdcc1 /dev/sdcb1
# dcserver20:/> pvdisplay

  — Physical volume —
  PV Name               /dev/sdcd1
  VG Name               pv1
  PV Size               4.98 GB / not usable 256.00 KB
  Allocatable           yes
  PE Size (KByte)       128
  Total PE              40782
  Free PE               782
  Allocated PE          40000
  PV UUID               jFY9US-2sI2-4eog-n5wA-5tyq-3lzF-k6yJuN

  — Physical volume —
  PV Name               /dev/sdcc1
  VG Name               pv1
  PV Size               4.98 GB / not usable 256.00 KB
  Allocatable           yes
  PE Size (KByte)       128
  Total PE              40782
  Free PE               782
  Allocated PE          40000
  PV UUID               1vm1BA-z8Mm-ZUuh-oO8K-gsPw-x5W3-pqOTFR

  — Physical volume —
  PV Name               /dev/sdcb1
  VG Name               pv1
  PV Size               4.98 GB / not usable 256.00 KB
  Allocatable           yes
  PE Size (KByte)       128
  Total PE              40782
  Free PE               40782
  Allocated PE          0
  PV UUID               kskH3E-oDeC-lUFC-vCM3-600u-NXAd-5uVjS8

STEP 3
======

Create Volume Group (VG)
# dcserver20:/> vgcreate -l 256 -p 256 -s 128k /dev/pv1 /dev/sdcd1 /dev/sdcc1 /dev/sdcb1
# dcserver20:/> vgdisplay

  — Volume group —
  VG Name               pv1
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                256
  Cur LV                0
  Open LV               0
  Max PV                256
  Cur PV                3
  Act PV                3
  VG Size               14.93 GB
  PE Size               128.00 KB
  Total PE              122346
  Alloc PE / Size       0 / 0
  Free  PE / Size       122346 / 14.93 GB
  VG UUID               fv6znB-eYGL-c7zA-cXV2-hOum-wFZJ-3iE5gy

STEP 4
======

Create Logical Volumes (LV)

# dcserver20:/> lvcreate -L 5000M -n datalv /dev/pv1
# dcserver20:/> lvcreate -L 5000M -n fralv /dev/pv1
# dcserver20:/> lvcreate -L 4000M -n data2lv /dev/pv1

# dcserver20:/> lvdisplay

  — Logical volume —
  LV Name                /dev/pv1/datalv
  VG Name                pv1
  LV UUID                9Ns3y7-5wct-zh5T-iovt-U6aH-vFn3-pi1hGO
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                4.88 GB
  Current LE             40000
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  – currently set to     1024
  Block device           253:0

  — Logical volume —
  LV Name                /dev/pv1/fralv
  VG Name                pv1
  LV UUID                KYfkf3-B4tY-5KzE-9wFn-PqCc-KYNI-JUUOe2
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                4.88 GB
  Current LE             40000
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  – currently set to     1024
  Block device           253:1

 — Logical volume —
  LV Name                /dev/pv1/data2lv
  VG Name                pv1
  LV UUID                rXh7Ev-Illn-0XD3-ZV0w-4e51-M8Jf-4xt8Jf
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                3.91 GB
  Current LE             32000
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  – currently set to     1024
  Block device           253:2

STEP 5
======

Change device permissions

# dcserver20:/> cd /dev/pv1
# ls -al
total 0
drwx——  2 root root   100 Oct 21 14:39 .
drwxr-xr-x 18 root root 12980 Oct 21 14:39 ..
lrwxrwxrwx  1 root root    23 Oct 21 14:39 data2lv -> /dev/mapper/pv1-data2lv
lrwxrwxrwx  1 root root    22 Oct 21 14:35 datalv -> /dev/mapper/pv1-datalv
lrwxrwxrwx  1 root root    21 Oct 21 14:36 fralv -> /dev/mapper/pv1-fralv
# cd /dev/mapper
# chown oragrid:asmdba *
# chmod 660 *

STEP 6
======

Create ASM diskgroups

SQL> alter system set  asm_diskstring =’/dev/mapper/*’
/

SQL> create diskgroup DG20_0 external redundancy disk ‘/dev/mapper/pv1-datalv’
/
Diskgroup created.

SQL> create diskgroup DG20_1 external redundancy disk ‘/dev/mapper/pv1-data2lv’
/
Diskgroup created.

SQL> create diskgroup DG20_2 external redundancy disk ‘/dev/mapper/pv1-fralv’
/
Diskgroup created.
SQL> select name, state, header_status, path,total_mb, free_mb from v$asm_disk
/

NAME                           STATE    HEADER_STATU PATH                                                 TOTAL_MB    FREE_MB
—————————— ——– ———— ————————————————– ———- ———-
DG20_1_0000                    NORMAL   MEMBER       /dev/mapper/pv1-data2lv               4000       3950
DG20_2_0000                    NORMAL   MEMBER       /dev/mapper/pv1-fralv                     5000       4950
DG20_0_0000                    NORMAL   MEMBER       /dev/mapper/pv1-datalv                  5000       4950

SQL> select name, state,total_mb, free_mb, required_mirror_free_mb, usable_file_mb  from v$asm_diskgroup
/

NAME                           STATE         TOTAL_MB    FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
—————————— ———– ———- ———- ———————– ————–
DG20_0                         MOUNTED           5000       4950                       0           4950
DG20_1                         MOUNTED           4000       3950                       0           3950
DG20_2                         MOUNTED           5000       4950                       0           4950
About these ads
This entry was posted in Oracle Automatic Storage Management and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s