Add new disk to the ASM diskgroup

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
  • After adding disk on the server.
[root@ol6 ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bc539

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        3917    30944256   8e  Linux LVM

Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x824e4e46

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         522     4192933+  83  Linux

Disk /dev/sdc: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3b820f86

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         522     4192933+  83  Linux

Disk /dev/sdd: 524 MB, 524288000 bytes
255 heads, 63 sectors/track, 63 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xfed4f385

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1          63      506016   83  Linux

Disk /dev/sde: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sde doesn't contain a valid partition table    <===== New disk. No partition 

Disk /dev/mapper/vg_ol6-lv_root: 27.0 GB, 26952597504 bytes
255 heads, 63 sectors/track, 3276 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_ol6-lv_root doesn't contain a valid partition table

Disk /dev/mapper/vg_ol6-lv_swap: 4731 MB, 4731174912 bytes
255 heads, 63 sectors/track, 575 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_ol6-lv_swap doesn't contain a valid partition table
  • Call fdisk to partition it.
[root@ol6 ~]# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb05ec87f.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522): 
Using default value 522

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@ol6 ~]# 
  • Check newly-created paritions
[root@ol6 init.d]# ls -ltrh /dev/sd*
brw-rw---- 1 root   disk     8,  0 Jun 22 18:04 /dev/sda
brw-rw---- 1 root   disk     8,  2 Jun 22 18:04 /dev/sda2
brw-rw---- 1 root   disk     8,  1 Jun 22 18:04 /dev/sda1
brw-rw---- 1 root   disk     8, 16 Jun 22 18:05 /dev/sdb
brw-rw---- 1 root   disk     8, 32 Jun 22 18:05 /dev/sdc
brw-rw---- 1 root   disk     8, 48 Jun 22 18:05 /dev/sdd
brw------- 1 oracle oinstall 8, 33 Jun 22 18:05 /dev/sdc1
brw------- 1 oracle oinstall 8, 17 Jun 22 18:05 /dev/sdb1
brw-rw---- 1 root   disk     8, 49 Jun 22 18:05 /dev/sdd1
brw-rw---- 1 root   disk     8, 64 Jun 22 18:07 /dev/sde
brw-rw---- 1 root   disk     8, 65 Jun 22 18:07 /dev/sde1
  • Change ownership and permission
# chown oracle:oinstall /dev/sde1
# chmod 600 /dev/sde1
  • Update the /etc/rc.local so permission will persist upon reboot.
# chown oracle:oinstall /dev/sde1
# chmod 600 /dev/sde1
  • If this is the first time, configure oracleasm.
# service oracleasm configure

    Configuring the Oracle ASM library driver.

    This will configure the on-boot properties of the Oracle ASM library
    driver. The following questions will determine whether the driver is
    loaded on boot and what permissions it will have. The current values
    will be shown in brackets (‘[]‘). Hitting <ENTER> without typing an
    answer will keep that current value. Ctrl-C will abort.

    Default user to own the driver interface []: oracle
    Default group to own the driver interface []: oinstall
    Start Oracle ASM library driver on boot (y/n) [n]: y
    Scan for Oracle ASM disks on boot (y/n) [y]: y
    Writing Oracle ASM library driver configuration: done
    Initializing the Oracle ASMLib driver: [ OK ]
    Scanning the system for Oracle ASMLib disks: [ OK ]
  • Label the disks as ASM disks.
[root@ol6 init.d]# service oracleasm createdisk DG1B /dev/sde1
Marking disk "DG1B" as an ASM disk:                        [  OK  ]
  • Verify
[root@ol6 init.d]# service oracleasm listdisks
DATA
DG1
DG1B
DG2
  • Query in the _+ASM instance.
SQL> select path from v$asm_disk;

PATH
--------------------------------------------------------------------------------
/dev/oracleasm/disks/DG1B
/dev/oracleasm/disks/DATA
/dev/oracleasm/disks/DG2
/dev/oracleasm/disks/DG1
  • Add new disk into the existing diskgroup.
SQL> alter diskgroup DG1 add disk '/dev/oracleasm/disks/DG1B';

Diskgroup altered.