1748235 Members
3519 Online
108759 Solutions
New Discussion

Re: extend a swap

 
SOLVED
Go to solution
silusan
Regular Advisor

extend a swap

Hi

Primary swap is 8GB

added a sec swap of 8Gb(this entry is there in fstab) a few months back

now if i want o increase swap again...

then do I need to create a new lv and add it?

or can i lvextend the secondary swap? Thanks.

 

VG00 has enough space..to add/create LVs etc

 

# swapinfo -tam
             Mb      Mb      Mb   PCT  START/      Mb
TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME
dev        8192       0    8192    0%       0       -    1  /dev/vg00/lvol2
dev        8192       0    8192    0%       0       -    2  /dev/vg00/sec_swap
reserve       -   16384  -16384
memory    46705   19962   26743   43%
total     63089   36346   26743   58%       -       0    -
#

11 REPLIES 11
James R. Ferguson
Acclaimed Contributor

Re: extend a swap

Hi:

 

You can extend your secondary swap as long as you have immediately adjacent, free physical extents such that the 'contiguous' property is maintained for the logical volume.

 

Otherwise, add a new logical volume as swap.

 

Regards!

 

...JRF...

silusan
Regular Advisor

Re: extend a swap

Good point indeed.

Please let me know how to determine If i have such Contiguous space. Thank you

James R. Ferguson
Acclaimed Contributor

Re: extend a swap


@silusan wrote:

Good point indeed.

Please let me know how to determine If i have such Contiguous space. Thank you


Hi (again):

 

The output of 'pvdisplay -v <device>' will show you the distribution of used (current) and free extents.

 

Regards!

 

...JRF...

silusan
Regular Advisor

Re: extend a swap

JRF..

What I understand is....

55 PEs are free between sec swap LV and some other LV(lv10).

 PEs from 968 till 1023 are free.

PE size is 64MB

55PE x 64MB = 3520MB

sec swap can be extended by just 3520MB as a contiguos space.

If I want 8Gb addidtional swap..then i think i need to create a new LV.

Please suggest..thanks


vgdisplay -v vg00 gives:
   LV Name                     /dev/vg00/addiswap
   LV Status                   available/syncd
   LV Size (Mbytes)            8192
   Current LE                  128
   Allocated PE                256
   Used PV                     2


   --- Physical volumes ---
   PV Name                     /dev/disk/disk14_p2
   PV Status                   available
   Total PE                    4456
   Free PE                     3352
   Autoswitch                  On
   Proactive Polling           On

   PV Name                     /dev/disk/disk17_p2
   PV Status                   available
   Total PE                    4456
   Free PE                     3352
   Autoswitch                  On
   Proactive Polling           On


:/ #

:/ # pvdisplay -v /dev/disk/disk14_p2|more
--- Physical volumes ---
PV Name                     /dev/disk/disk14_p2
VG Name                     /dev/vg00
PV Status                   available
Allocatable                 yes
VGDA                        2
Cur LV                      12
PE Size (Mbytes)            64
Total PE                    4456
Free PE                     3352
Allocated PE                1104
Stale PE                    0
IO Timeout (Seconds)        default
Autoswitch                  On
Proactive Polling           On

   --- Distribution of physical volume ---
   LV Name                 LE of LV  PE for LV
   /dev/vg00/lvol1         24        24
   /dev/vg00/lvol2         128       128
   /dev/vg00/lvol3         96        96
   /dev/vg00/lvol4         8         8
   /dev/vg00/lvol5         104       104
   /dev/vg00/lvol6         64        64
   /dev/vg00/lvol7         72        72
   /dev/vg00/lvol8         128       128
   /dev/vg00/lvol9         256       256
   /dev/vg00/osmf          24        24
   /dev/vg00/lvol10        72        72
   /dev/vg00/addiswap      128       128

   --- Physical extents ---
   PE    Status   LV                      LE
   00000 current  /dev/vg00/lvol1         00000
   00001 current  /dev/vg00/lvol1         00001
   00002 current  /dev/vg00/lvol1         00002
   ....
   00011 current  /dev/vg00/lvol1         00011
   00012 current  /dev/vg00/lvol1         00012
....

    00839 current  /dev/vg00/osmf          00023
   00840 current  /dev/vg00/addiswap      00000
   00841 current  /dev/vg00/addiswap      00001
   00842 current  /dev/vg00/addiswap      00002
   ....
   00861 current  /dev/vg00/addiswap      00021
   00862 current  /dev/vg00/addiswap      00022
   00863 current  /dev/vg00/addiswap      00023
   00864 current  /dev/vg00/addiswap      00024
   00865 current  /dev/vg00/addiswap      00025
   00866 current  /dev/vg00/addiswap      00026
   00867 current  /dev/vg00/addiswap      00027
   00868 current  /dev/vg00/addiswap      00028
   ....
   00885 current  /dev/vg00/addiswap      00045
   00886 current  /dev/vg00/addiswap      00046
   ....
   00957 current  /dev/vg00/addiswap      00117
   00958 current  /dev/vg00/addiswap      00118
   ....
   00966 current  /dev/vg00/addiswap      00126
   00967 current  /dev/vg00/addiswap      00127
   00968 free                                          00000
   00969 free                                          00000
    ....
   01020 free                                          00000
   01021 free                                          00000
   01022 free                                          00000
   01023 free                                          00000
   01024 current  /dev/vg00/lvol10            00000
   01025 current  /dev/vg00/lvol10            00001
   01026 current  /dev/vg00/lvol10            00002
   01027 current  /dev/vg00/lvol10            00003
   01028 current  /dev/vg00/lvol10            00004

James R. Ferguson
Acclaimed Contributor

Re: extend a swap


@silusan wrote:

If I want 8Gb addidtional swap..then i think i need to create a new LV.



Yes, that is what I would do.

 

Regards!

 

...JRF...

silusan
Regular Advisor

Re: extend a swap

would it be

swapon -p 3 /dev/vg00/third_swap

 

(after creating an LV ..for say 8GB)

James R. Ferguson
Acclaimed Contributor

Re: extend a swap


@silusan wrote:

would it be

swapon -p 3 /dev/vg00/third_swap

 

(after creating an LV ..for say 8GB)


Hi:

 

The swap priority given that all of the swap devices are on the same volume group can be argued two ways.  Swap devices of equal priority cause swap to interleave between/among the devices.  Swap devices of different priority mean that one or more devices will be used before proceeding to the next.  The priority value is the opposite of the choice order.

 

Given this, creating swap devices of equal priority on a given volume group may cause disk head-banging as swap I/O occurs, leading to a further degradation in performance.

 

Then again, as a friend named Clay liked to say, worrying about swap priority is like worrying about re-arranging the deck chairs on the Titanic.

 

The choice is yours.  Your best choice is not to overload your server and have ample memory.  Then, swap space becomes important only for process swap reservation and real swapping never occurs.

 

Regards!

 

...JRF...

silusan
Regular Advisor

Re: extend a swap

Thanks . I understood.

# swapinfo -tam
             Mb      Mb      Mb   PCT  START/      Mb
TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME
dev        8192       0    8192    0%       0       -    1  /dev/vg00/lvol2
dev        8192       0    8192    0%       0       -    2  /dev/vg00/addiswap
reserve       -   16384  -16384
memory    31121   18852   12269   61%
total     47505   35236   12269   74%       -       0    -
le85odb1:/ #

 

lvol2 is priority 1

(lv)addiswap is priority 2

so i think (lv)thirdswap prority as 3 would be the order.

 

I didnt quite understood this line "The priority value is the opposite of the choice order"
Does that mean swap with priority 1 would be used only after swap  with priority 2 is fully consumed?

silusan
Regular Advisor

Re: extend a swap

JRF...the memory in the above swapinfo is not 32GB. increased it to 48GB today. copy pasted the old output.
swap=8+8=16GB already
memory=48GB
User may ask to get the swap increased. so I am contemplating ...whether to extend lv or create a new lv. I got the answer from you(JRF) - need contiguous PEs to do lvextend..otherwise create new lv.