Logical Volume operations for Oracle RAC

Extend a XFS partition

Check space 
[root@mclu21 ~]# df /u01
Filesystem                 1K-blocks    Used Available Use% Mounted on
/dev/mapper/ol_ractw21-u01  15718400 7318448   8399952  47% /u01

[root@mclu21 ~]# pvs
  PV         VG         Fmt  Attr PSize  PFree 
  /dev/sda2  ol_ractw21 lvm2 a--  49.00g 11.12g

Extend the XFS partition
[root@mclu21 ~]# lvextend /dev/mapper/ol_ractw21-u01 -L +4G -r
  Size of logical volume ol_ractw21/u01 changed from 15.00 GiB (3840 extents) to 19.00 GiB (4864 extents).
  Logical volume ol_ractw21/u01 successfully resized.
meta-data=/dev/mapper/ol_ractw21-u01 isize=256    agcount=4, agsize=983040 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=3932160, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 3932160 to 4980736

[root@mclu21 ~]# df  /u01
Filesystem                 1K-blocks    Used Available Use% Mounted on
/dev/mapper/ol_ractw21-u01  19912704 7318476  12594228  37% /u01

Create a Logical Volume for additional Swap Space

Verify whether there is enough space 
[root@ractw21 ~]# pvs
  PV         VG         Fmt  Attr PSize  PFree 
  /dev/sda2  ol_ractw21 lvm2 a--  49.00g 30.12g

Check current swap size 
[root@ractw21 ~]# lvdisplay /dev/ol_ractw21/swap
  --- Logical volume ---
  LV Path                /dev/ol_ractw21/swap
  LV Name                swap
  VG Name                ol_ractw21
  LV UUID                cRqOFr-qctc-8lni-kzsV-fB5X-CVmv-MwakG7
  LV Write Access        read/write
  LV Creation host, time ractw21.example.com, 2017-04-04 12:13:14 +0200
  LV Status              available
  # open                 2
  LV Size                3.88 GiB
  Current LE             992
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           251:1

Just add some space to Logical Volume swap

[root@ractw21 ~]#   lvextend -L+4G /dev/ol_ractw21/swap
  Size of logical volume ol_ractw21/swap changed from 3.88 GiB (992 extents) to 7.88 GiB (2016 extents).
  Logical volume ol_ractw21/swap successfully resized.
[root@ractw21 ~]# pvs
  PV         VG         Fmt  Attr PSize  PFree 
  /dev/sda2  ol_ractw21 lvm2 a--  49.00g 26.12g
 
[root@ractw21 ~]# lvs --segments -o +devices
  LV   VG         Attr       #Str Type   SSize  Devices        
  root ol_ractw21 -wi-ao----    1 linear 15.00g /dev/sda2(992) 
  swap ol_ractw21 -wi-ao----    1 linear  3.88g /dev/sda2(0)   
  swap ol_ractw21 -wi-ao----    1 linear  4.00g /dev/sda2(4832)

Add the newly create Volume to the Swap Space

Check current swap space 
[root@ractw21 etc]# free
              total        used        free      shared  buff/cache   available
Mem:        5700592      556224     4512632       11364      631736     5051276
Swap:       4063228           0     4063228
                                                 
   
[root@ractw21 etc]#  lvs --segments -o +devices
  LV   VG         Attr       #Str Type   SSize  Devices        
  root ol_ractw21 -wi-ao----    1 linear 15.00g /dev/sda2(992) 
  swap ol_ractw21 -wi-ao----    1 linear  3.88g /dev/sda2(0)   
  swap ol_ractw21 -wi-ao----    1 linear  4.00g /dev/sda2(4832)
  u01  ol_ractw21 -wi-ao----    1 linear 15.00g /dev/sda2(5856)

[root@ractw21 etc]# lvscan
  ACTIVE            '/dev/ol_ractw21/swap' [7.88 GiB] inherit
  ACTIVE            '/dev/ol_ractw21/root' [15.00 GiB] inherit
  ACTIVE            '/dev/ol_ractw21/u01' [15.00 GiB] inherit

Despite our Swap LV has now about 8 GByte Space only 4 GByte was used.

Remove and add the swap LV again 
[root@ractw21 etc]# swapoff -v /dev/ol_ractw21/swap
swapoff /dev/ol_ractw21/swap

[root@ractw21 etc]# mkswap /dev/ol_ractw21/swap
mkswap: /dev/ol_ractw21/swap: warning: wiping old swap signature.
Setting up swapspace version 1, size = 8257532 KiB
no label, UUID=95b7991f-22c6-4710-9ee3-6b6eab5dd36b

[root@ractw21 etc]# swapon -va
swapon /dev/mapper/ol_ractw21-swap
swapon: /dev/mapper/ol_ractw21-swap: found swap signature: version 1, page-size 4, same byte order
swapon: /dev/mapper/ol_ractw21-swap: pagesize=4096, swapsize=8455716864, devsize=8455716864
[root@ractw21 etc]# 
[root@ractw21 etc]# free
              total        used        free      shared  buff/cache   available
Mem:        5700592      559064     4509516       11364      632012     5048452
Swap:       8257532           0     8257532

Now 8 GByte swap is available in our system !

Create a NEW oracle software  partition /u01

  
[root@ractw21 ~]# lvcreate -L 15G -n u01 /dev/ol_ractw21
  Logical volume "u01" created.
[root@ractw21 ~]# lvs --segments -o +devices
  LV   VG         Attr       #Str Type   SSize  Devices        
  root ol_ractw21 -wi-ao----    1 linear 15.00g /dev/sda2(992) 
  swap ol_ractw21 -wi-ao----    1 linear  3.88g /dev/sda2(0)   
  swap ol_ractw21 -wi-ao----    1 linear  4.00g /dev/sda2(4832)
  u01  ol_ractw21 -wi-a-----    1 linear 15.00g /dev/sda2(5856)
 
[root@ractw21 ~]#  mkfs.xfs -L u01 /dev/ol_ractw21/u01
meta-data=/dev/ol_ractw21/u01    isize=256    agcount=4, agsize=983040 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0
data     =                       bsize=4096   blocks=3932160, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
 
[root@ractw21 ~]# mkdir /u01
[root@ractw21 ~]# lvscan
  ACTIVE            '/dev/ol_ractw21/swap' [7.88 GiB] inherit
  ACTIVE            '/dev/ol_ractw21/root' [15.00 GiB] inherit
  ACTIVE            '/dev/ol_ractw21/u01' [15.00 GiB] inherit
 
Add following line to /etc/fstab
/dev/mapper/ol_ractw21-u01                       /u01    xfs   defaults        0 1

[root@ractw21 ~]# mount -a
[root@ractw21 ~]# df
Filesystem                   1K-blocks       Used Available Use% Mounted on
devtmpfs                       2826556          0   2826556   0% /dev
tmpfs                          2850296        144   2850152   1% /dev/shm
tmpfs                          2850296       8984   2841312   1% /run
tmpfs                          2850296          0   2850296   0% /sys/fs/cgroup
/dev/mapper/ol_ractw21-root   15718400    9042272   6676128  58% /
/dev/sda1                      1038336     308824    729512  30% /boot
kits                        2930253820 2254231536 676022284  77% /media/sf_kits
tmpfs                           570060          8    570052   1% /run/user/0
/dev/sr1                         57990      57990         0 100% /run/media/root/VBOXADDITIONS_5.1.18_114002
/dev/mapper/ol_ractw21-u01    15718400      32928  15685472   1% /u01
 
Verify remaining disk space 
 [root@ractw21 ~]# pvs
  PV         VG         Fmt  Attr PSize  PFree 
  /dev/sda2  ol_ractw21 lvm2 a--  49.00g 11.12g

Using parted to create a new ORACLE_BASE partition for a Domain Service Cluster

  • The minimum disk requirements  for an  ORACLE_BASE is 102 GBybte for a Domain Service Cluster
  • It makes sense to create an own partition for this space
[root@dsctw21 ~]# parted /dev/sdi print
Error: /dev/sdi: unrecognised disk label
Model: ATA VBOX HARDDISK (scsi)                                           
Disk /dev/sdi: 129GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

[root@dsctw21 ~]#  parted /dev/sdi mklabel msdos
Information: You may need to update /etc/fstab.

[root@dsctw21 ~]# parted /dev/sdi print                                   
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdi: 129GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 
Number  Start  End  Size  Type  File system  Flags

[root@dsctw21 ~]#  parted /dev/sdi mkpart --  primary 1 -1
Information: You may need to update /etc/fstab.

[root@dsctw21 ~]#  parted /dev/sdi print                                  
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdi: 129GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 
Number  Start   End    Size   Type     File system  Flags
 1      1049kB  129GB  129GB  primary

Create new XFS file System for the new partion 
[root@dsctw21 app]#  mkfs.xfs  /dev/sdi1
meta-data=/dev/sdi1              isize=256    agcount=4, agsize=7859072 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0
data     =                       bsize=4096   blocks=31436288, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=15349, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[grid@dsctw21 log]$ env | grep ORACLE_BASE
ORACLE_BASE=/u01/app/grid
mount /dev/sdb1 /backup      
[root@dsctw21 app]# mkdir /u01/app/grid

[root@dsctw21 app]#  mount /dev/sdi1   /u01/app/grid
[root@dsctw21 app]# df  /u01/app/grid
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/sdi1      125683756 32928 125650828   1% /u01/app/grid
[root@dsctw21 app]# chown grid:oinstall  /u01/app/grid

[root@dsctw21 app]# df / /u01 /u01/app/grid
Filesystem                  1K-blocks    Used Available Use% Mounted on
/dev/mapper/ol_ractw21-root  15718400 9085996   6632404  58% /
/dev/mapper/ol_ractw21-u01   15718400 7409732   8308668  48% /u01
/dev/sdi1                   125683756   32928 125650828   1% /u01/app/grid

Add an entry to fstab to get /u01/app/grid mounted after reboot 
[root@dsctw21 app]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Apr  4 12:13:16 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/ol_ractw21-root             /                       xfs     defaults        0 0
UUID=4394c11d-f8bf-48fe-a654-4ca194703b5b     /boot                   xfs     defaults        0 0
/dev/mapper/ol_ractw21-swap             swap                    swap    defaults        0 0
/dev/mapper/ol_ractw21-u01              /u01            xfs       defaults        0 1
/dev/sdi1                    /u01/app/grid       xfs       defaults        0 2

Reference