Wednesday, 13 May 2015

Expand swap using SSM

The mere reason that I dug into SSM yeasterday was that I wanted to install the Oracle Database 12c.

(Did you know yesterday came from the word 'yeast'? So actually yeasterday: because one used the yeast of the day before to bake the bread of today. Also in Dutch  the word for yeast: 'gist', still sounds in the word for yeasterday: 'gisteren'.)

I ran however against the prerequisite check on the swap space that was only 2GB because of my default OL7 install. And the Universal Installer required 8GB at least. So I needed to expand it. There are several ways to do it. But since I was into SSM, it was a good practice to use that. And it turns out very simple to do. It shows how easy it is to add a new device to a pool and an existing volume.

So I created a new disk of 8GB to my VM (I only need 8GB, but I thought I'd simply add it to the existing 2GB, to be certain to have enough with 10GB).


So, after booting up, verify existence of non assigned device (/dev/sdc):
[root@darlin-vce-db ~]# ssm list
--------------------------------------------------------------
Device         Free       Used      Total  Pool    Mount point
--------------------------------------------------------------
/dev/sda                         20.00 GB          PARTITIONED
/dev/sda1                       500.00 MB          /boot      
/dev/sda2  40.00 MB   19.47 GB   19.51 GB  ol                 
/dev/sdb    0.00 KB  100.00 GB  100.00 GB  pool01             
/dev/sdc                          8.00 GB                     
--------------------------------------------------------------
-----------------------------------------------------
Pool    Type  Devices      Free       Used      Total  
-----------------------------------------------------
ol      lvm   1        40.00 MB   19.47 GB   19.51 GB  
pool01  lvm   1         0.00 KB  100.00 GB  100.00 GB  
-----------------------------------------------------
---------------------------------------------------------------------------
Volume  Pool    Volume size  FS     FS size       Free  Type    Mount point
---------------------------------------------------------------------------
/dev/ol/root
        ol         17.47 GB  xfs   17.46 GB   12.29 GB  linear  /          
/dev/ol/swap
        ol          2.00 GB                             linear             
/dev/pool01/disk01
        pool01    100.00 GB  xfs   99.95 GB   99.95 GB  linear  /u01       
/dev/sda1
                  500.00 MB  xfs  496.67 MB  305.97 MB  part    /boot      
---------------------------------------------------------------------------

Then add the device to the 'ol'-pool:
[root@darlin-vce-db ~]# ssm add -p ol /dev/sdc
  Physical volume "/dev/sdc" successfully created
  Volume group "ol" successfully extended

And verify again:
[root@darlin-vce-db ~]# ssm list
--------------------------------------------------------------
Device         Free       Used      Total  Pool    Mount point
--------------------------------------------------------------
/dev/sda                         20.00 GB          PARTITIONED
/dev/sda1                       500.00 MB          /boot      
/dev/sda2  40.00 MB   19.47 GB   19.51 GB  ol                 
/dev/sdb    0.00 KB  100.00 GB  100.00 GB  pool01             
/dev/sdc    8.00 GB    0.00 KB    8.00 GB  ol                 
--------------------------------------------------------------
----------------------------------------------------
Pool    Type  Devices     Free       Used      Total  
----------------------------------------------------
ol      lvm   2        8.04 GB   19.47 GB   27.50 GB  
pool01  lvm   1        0.00 KB  100.00 GB  100.00 GB  
----------------------------------------------------
---------------------------------------------------------------------------------------
Volume              Pool    Volume size  FS     FS size       Free  Type    Mount point
---------------------------------------------------------------------------------------
/dev/ol/root        ol         17.47 GB  xfs   17.46 GB   12.29 GB  linear  /          
/dev/ol/swap        ol          2.00 GB                             linear             
/dev/pool01/disk01  pool01    100.00 GB  xfs   99.95 GB   99.95 GB  linear  /u01       
/dev/sda1                     500.00 MB  xfs  496.67 MB  305.97 MB  part    /boot      
---------------------------------------------------------------------------------------

Now resize the swap volume:
[root@darlin-vce-db ~]# ssm resize -s+8GB /dev/ol/swap
  Size of logical volume ol/swap changed from 2.00 GiB (512 extents) to 10.00 GiB (2560 extents).
  Logical volume swap successfully resized

And, again, verify:
[root@darlin-vce-db ~]# ssm list
--------------------------------------------------------------
Device         Free       Used      Total  Pool    Mount point
--------------------------------------------------------------
/dev/sda                         20.00 GB          PARTITIONED
/dev/sda1                       500.00 MB          /boot      
/dev/sda2   0.00 KB   19.51 GB   19.51 GB  ol                 
/dev/sdb    0.00 KB  100.00 GB  100.00 GB  pool01             
/dev/sdc   36.00 MB    7.96 GB    8.00 GB  ol                 
--------------------------------------------------------------
-----------------------------------------------------
Pool    Type  Devices      Free       Used      Total  
-----------------------------------------------------
ol      lvm   2        36.00 MB   27.47 GB   27.50 GB  
pool01  lvm   1         0.00 KB  100.00 GB  100.00 GB  
-----------------------------------------------------
---------------------------------------------------------------------------------------
Volume              Pool    Volume size  FS     FS size       Free  Type    Mount point
---------------------------------------------------------------------------------------
/dev/ol/root        ol         17.47 GB  xfs   17.46 GB   12.29 GB  linear  /          
/dev/ol/swap        ol         10.00 GB                             linear             
/dev/pool01/disk01  pool01    100.00 GB  xfs   99.95 GB   99.95 GB  linear  /u01       
/dev/sda1                     500.00 MB  xfs  496.67 MB  305.97 MB  part    /boot      
---------------------------------------------------------------------------------------

Now check the swap space:
[root@darlin-vce-db ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1

Hey, it's still 2GB!

Let's check fstab to get the swap mount-definitions: 
[root@darlin-vce-db ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon May 11 20:20:14 2015
#
# 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-root         /                       xfs     defaults        0 0
UUID=7a285d9f-1812-4d72-9bd2-12e50eddc855 /boot                   xfs     defaults        0 0
/dev/mapper/ol-swap     swap                    swap    defaults        0 0
/dev/mapper/pool01-disk01    /u01                       xfs     defaults        0 0


Turn off swap:
[root@darlin-vce-db ~]# swapoff /dev/mapper/ol-swap

And (re-)create new swap:
[root@darlin-vce-db ~]# mkswap -c /dev/mapper/ol-swap
0 bad pages
mkswap: /dev/mapper/ol-swap: warning: wiping old swap signature.
Setting up swapspace version 1, size = 10485756 KiB
no label, UUID=843463de-7552-4a73-84a6-761f261d9e9f

Then enable swap again:
[root@darlin-vce-db ~]# swapon /dev/mapper/ol-swap

And check swap again:
[root@darlin-vce-db ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    10485756    0    -1

Yes!!! That did the job. Easy does it...

No comments :