Extending swap space

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Extending swap space
# 1  
Old 06-02-2015
Extending swap space

I've to install Oracle binaries (I'm oracle DBA) and for that I've extend swap space in my home computer. My situation is like this.

Code:
[root@rac1 ~]# parted -s /dev/sda print free
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 38.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  525MB   524MB   primary  ext4         boot
 2      525MB   21.5GB  20.9GB  primary               lvm
        21.5GB  21.5GB  1370kB           Free Space
 3      21.5GB  24.7GB  3216MB  primary
 4      24.7GB  32.2GB  7518MB  primary
        32.2GB  38.7GB  6445MB           Free Space

[root@rac1 ~]# pvs /dev/sda
  Failed to read physical volume "/dev/sda"
[root@rac1 ~]# pvs
  PV         VG      Fmt  Attr PSize  PFree
  /dev/sda2  vg_rac1 lvm2 a--  19.51g     0
  /dev/sda3  vg_rac1 lvm2 a--   2.99g     0
  /dev/sda4  vg_rac1 lvm2 a--   7.00g 92.00m

[root@rac1 ~]# vgs
  VG      #PV #LV #SN Attr   VSize  VFree
  vg_rac1   3   2   0 wz--n- 29.50g 92.00m
[root@rac1 ~]# pvs
  PV         VG      Fmt  Attr PSize  PFree
  /dev/sda2  vg_rac1 lvm2 a--  19.51g     0
  /dev/sda3  vg_rac1 lvm2 a--   2.99g     0
  /dev/sda4  vg_rac1 lvm2 a--   7.00g 92.00m
[root@rac1 ~]# lvs
  LV      VG      Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  lv_root vg_rac1 -wi-ao--- 27.75g
  lv_swap vg_rac1 -wi-ao---  1.66g
[root@rac1 ~]#

[root@rac1 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_rac1
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               29.50 GiB
  PE Size               4.00 MiB
  Total PE              7552
  Alloc PE / Size       7529 / 29.41 GiB
  Free  PE / Size       23 / 92.00 MiB
  VG UUID               bXwPby-NHXU-enXI-xPyd-PA36-GhoU-9OR76p

[root@rac1 ~]#
[root@rac1 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_rac1/lv_root
  LV Name                lv_root
  VG Name                vg_rac1
  LV UUID                zMH9da-7isj-DNmd-cDM2-SCE3-HDA3-Xye4bo
  LV Write Access        read/write
  LV Creation host, time rac1.localdomain, 2015-05-27 16:20:24 -0400
  LV Status              available
  # open                 1
  LV Size                27.75 GiB
  Current LE             7104
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/vg_rac1/lv_swap
  LV Name                lv_swap
  VG Name                vg_rac1
  LV UUID                8NRkpq-A2l4-qdia-YCdM-ZWkX-6Ase-N7wTex
  LV Write Access        read/write
  LV Creation host, time rac1.localdomain, 2015-05-27 16:20:28 -0400
  LV Status              available
  # open                 2
  LV Size                1.66 GiB
  Current LE             425
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

[root@rac1 ~]#


As you can see above that 6445MB is free above and I want to take 4 GB out of that to extend the swap space.

I tried this command but failed. Can you suggest please how to extend the space? Please let me know if you need more info.

Code:
[root@rac1 ~]# lvresize /dev/vg_rac1/lv_swap -L +4G
  Extending logical volume lv_swap to 5.66 GiB
  Insufficient free space: 1024 extents needed, but only 23 available
[root@rac1 ~]#

Thanks

Last edited by rbatte1; 06-02-2015 at 12:10 PM.. Reason: Added CODE tags
# 2  
Old 06-02-2015
I would suggest that there is Insufficient free space as your error message (which should all be in CODE tags to make it clear) tells you.

Did you look at where you are trying to increase the swap space?



Robin
# 3  
Old 06-02-2015
What do I need to modify to increase the swap? I don't want to rebuild this virtual machine since I've grid infrastructure already working fine.

Thanks
# 4  
Old 06-02-2015
Your free (unallocated) disk space on the server for this volume group (not sure if there are any more) is shown in this line:-
Code:
  Free  PE / Size       23 / 92.00 MiB

You cannot extend the logical volume by added space that you do not have.

Can you assign more disk to the server, e.g. another LUN or VM disk?

If so, then you can increase the volume group by adding in the new LUN and try your lvresize again.



Robin
# 5  
Old 06-02-2015
if you see below you can see that I've added 6445 MB space to the disk and it is unallocated. How can I use / assign this space?

Code:
[root@rac1 ~]# parted -s /dev/sda print free
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 38.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  525MB   524MB   primary  ext4         boot
 2      525MB   21.5GB  20.9GB  primary               lvm
        21.5GB  21.5GB  1370kB           Free Space
 3      21.5GB  24.7GB  3216MB  primary
 4      24.7GB  32.2GB  7518MB  primary
        32.2GB  38.7GB  6445MB           Free Space

# 6  
Old 06-02-2015
How did you assign slice 2 to LVM? Was it a choice in the install process or did you manually define it? If it is the latter, then you have the same steps to perform,except that you extend the volume group rather than create it.

You might get away with:-
Code:
pvcreate /dev/sda4
vgextend vg_rac1 /dev/sda4
lvresize ..........


I hope that this helps,
Robin
# 7  
Old 06-02-2015
I added about 7 GB to my VM from the host machine using the following command on host

Code:
vboxmanage modifyhd --resize <the_size_mb>

After that I used the "disk tool" shortcut from linux console to create /dev/sd4.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Extending swap space

I've to install Oracle binaries (I'm oracle DBA) and for that I've extend swap space in my home computer. My situation is like this. # parted -s /dev/sda print free Model: ATA VBOX HARDDISK (scsi) Disk /dev/sda: 38.7GB Sector size (logical/physical): 512B/512B Partition Table: msdos ... (1 Reply)
Discussion started by: Mukul Sharma
1 Replies

2. Red Hat

Swap space not getting used

CENT OS 5.8 server running with a huge java application which uses up all my ram (4GB) and requires excess of atleast 2GB.But the swap is not getting used up((8GB) of swap space left unused) leading a wierd error and stopping application to stop working. Any one here dealt with the same kind of... (2 Replies)
Discussion started by: shiek.kaleem
2 Replies

3. Solaris

Swap space

Dear All, I have a swap space of 16G available in Sol 10. I have allocated it as a seperate file system. But when the RAM Is full used , the system gets rebooted and the swap is not being used,. Any reasons for this. Rgds Rj (5 Replies)
Discussion started by: jegaraman
5 Replies

4. Linux

How to reclaim the space which i used to increse the swap space on Xen,

Hi, i have done a blunder here, i increased the swap space on Xen5.6 server machine using below steps :- 1056 dd if=/dev/zero of=/root/myswapfile bs=1M count=1024 1057 ls -l /root/myswapfile 1058 chmod 600 /root/myswapfile 1059 mkswap /root/myswapfile 1060 swapon /root/myswapfile ... (1 Reply)
Discussion started by: apm
1 Replies

5. Solaris

Swap Space

Could someone please explain how you know how much swap space you have on your system. See below: # swap -s total: 8225048k bytes allocated + 4863488k reserved = 13088536k used, 4008032k available # swap -l swapfile dev swaplo blocks free /dev/dsk/c3t0d0s1 32,25 16... (2 Replies)
Discussion started by: jamba1
2 Replies

6. Linux

swap space

Hi, I want to know how can i free the swap space if it is completely full, 0 mb remaining, (1 Reply)
Discussion started by: manoj.solaris
1 Replies

7. UNIX for Dummies Questions & Answers

Swap space used???

Plz I need to know how much swap mem free and used i have. I'm using Compaq Tru64 UNIX V5.1A (rev 1885) Thanx (1 Reply)
Discussion started by: Lestat
1 Replies

8. AIX

swap space / paging space

how do you get the paging space reduced without rebooting the machine ? the os is aix (2 Replies)
Discussion started by: aaronh
2 Replies

9. UNIX for Dummies Questions & Answers

pageing space vs swap space

Hello, I would like to know if there is any difference between the pageing space and the swap space. Thank you in advance. (1 Reply)
Discussion started by: VeroL
1 Replies

10. UNIX for Dummies Questions & Answers

SWAP SPACE

All, I am using SOLARIS 7. I have formated my hard drive to consist of only 150MB of swap space. This isn't enough considering I am running Oracle. How do I create additional swap space? Please list sources or commands. PS mkswap doesn't work on my machine. ( I have swap and... (5 Replies)
Discussion started by: SmartJuniorUnix
5 Replies
Login or Register to Ask a Question