104b1 How to increase SWAP space/partition - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > Storage

Storage Place to ask questions about partitioning, labelling, filesystems, encryption or anything else related to storage area.

Reply
 
Thread Tools Display Modes
  #1  
Old August 17th, 2011, 11:28
alie's Avatar
alie alie is offline
Member
 
Join Date: Dec 2008
Location: Somewhere in the world
Posts: 549
Thanks: 173
Thanked 41 Times in 34 Posts
Default How to increase SWAP space/partition

Like the title, is there any way to increase swap partition ?

Thanks in advance
__________________
www.alielee.com
FreeBSD FreeBSD 9.1-PRERELEASE #0 r243320 /usr/obj/usr/src/sys/EZYCLIE amd64
Reply With Quote
  #2  
Old August 17th, 2011, 11:39
Beastie Beastie is offline
Senior Member
 
Join Date: Mar 2009
Location: /dev/earth0
Posts: 1,699
Thanks: 0
Thanked 301 Times in 245 Posts
Default

I don't think you can resize the existing partition. At least not easily. But you may create a swap file (see section 11.14.3 Swapfiles).
__________________
May the source be with you!
Reply With Quote
The Following User Says Thank You to Beastie For This Useful Post:
alie (August 17th, 2011)
  #3  
Old August 17th, 2011, 11:48
alie's Avatar
alie alie is offline
Member
 
Join Date: Dec 2008
Location: Somewhere in the world
Posts: 549
Thanks: 173
Thanked 41 Times in 34 Posts
Default

How about delete the existing swap partition then resize the root to use the swap space, is it possible ?
__________________
www.alielee.com
FreeBSD FreeBSD 9.1-PRERELEASE #0 r243320 /usr/obj/usr/src/sys/EZYCLIE amd64
Reply With Quote
  #4  
Old August 17th, 2011, 12:24
jem jem is offline
Member
 
Join Date: Oct 2009
Location: United Kingdom
Posts: 324
Thanks: 17
Thanked 51 Times in 41 Posts
Default

You can certainly remove your swap partition, then grow your root filesystem into the available space.

You'd use bsdlabel(8) to delete the b: partition, then increase the size of the a: partition to fill the freed space.

After that's done, you use growfs(8) to expand the UFS filesystem inside the a: partition.
__________________
http://www.b0rken.org/

Last edited by jem; August 17th, 2011 at 12:31.
Reply With Quote
  #5  
Old August 17th, 2011, 12:24
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,694
Thanks: 47
Thanked 2,020 Times in 1,859 Posts
Default

You can add multiple swap partitions.

Code:
dice@molly:~>swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/gpt/swap4    2097152   113344  1983808     5%
/dev/gpt/swap5    2097152   113824  1983328     5%
/dev/gpt/swap6    2097152   112936  1984216     5%
/dev/gpt/swap7    2097152   112660  1984492     5%
Total             8388608   452764  7935844     5%
dice@molly:~>grep swap /etc/fstab
/dev/gpt/swap4          none                    swap            sw              0       0
/dev/gpt/swap5          none                    swap            sw              0       0
/dev/gpt/swap6          none                    swap            sw              0       0
/dev/gpt/swap7          none                    swap            sw              0       0
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
  #6  
Old August 21st, 2011, 15:06
NewGuy NewGuy is offline
Junior Member
 
Join Date: Nov 2009
Posts: 99
Thanks: 3
Thanked 6 Times in 5 Posts
Default

You can install a tool like swapexd, which will grow a swap file for you on an as-needed basis. It's a tad slow, but gives you flexibility of just having the amount of swap you need.
Reply With Quote
  #7  
Old January 13th, 2012, 10:50
alie's Avatar
alie alie is offline
Member
 
Join Date: Dec 2008
Location: Somewhere in the world
Posts: 549
Thanks: 173
Thanked 41 Times in 34 Posts
Default

Can someone help me with the commands to delete /dev/ad10s1b partition and then grow /dev/ad10s1a partition? I am not familiar how the partition works.

Code:
[/usr/home/alie]# disklabel -e /dev/ad10s1b
# /dev/ad10s1b:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  a: 1953521009       4096    4.2BSD        0     0     0
  b:       4096          0      swap
  c: 1953525105          0    unused        0     0     # "raw" part, don't edit
then quit with q!

Code:
~
~
~
~
~
:q
partition a: partition extends past end of unit
partition c: partition extends past end of unit
disklabel: partition c doesn't cover the whole unit!
disklabel: An incorrect partition c may cause problems for standard system utilities
re-edit the label? [y]:
I didn't make any changes yet but seems there is something wrong with my partition.

Thanks
__________________
www.alielee.com
FreeBSD FreeBSD 9.1-PRERELEASE #0 r243320 /usr/obj/usr/src/sys/EZYCLIE amd64

Last edited by alie; January 13th, 2012 at 11:24.
Reply With Quote
  #8  
Old January 13th, 2012, 11:30
kpa kpa is offline
Senior Member
 
Join Date: Jul 2010
Location: People's Technocratic Republic of Finland
Posts: 1,980
Thanks: 44
Thanked 460 Times in 390 Posts
Default

You're looking at the wrong device, /dev/ad10s1b is the partition itself. You should use the slice with the bsd disklabel:

# bsdlabel -e /dev/ad10s1

gpart(8) can resize partitions in a bsdlabel'ed slice as well, deleting ad10s1b and then resizing ad10s1a
should go like this:

# gpart delete -i 2 ad10s1
# gpart resize -i 1 -s newsize ad10s1

The "-i 1" option means the 1st partition inside geom ad10s1, ad10s1a

Last edited by kpa; January 13th, 2012 at 11:36.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] How to increase disk space arupsarkar System Hardware 10 May 28th, 2010 15:44
Using a swap file and swap partition on same disk. atarahas General 4 April 22nd, 2010 20:51
SWAP File or SWAP Partition - VMWare VPS NuLL3rr0r General 9 March 27th, 2010 07:32
Increase space kfarmer General 9 December 1st, 2009 00:44
Using swap space from a logical partition. Madcap Installing & Upgrading 2 January 28th, 2009 11:17


All times are GMT +1. The time now is 09:59.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0