How to increase SWAP space/partition

How about delete the existing swap partition then resize the root to use the swap space, is it possible ?
 
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.
 
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
 
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.
 
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
 
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
 
How about delete the existing swap partition then resize the root to use the swap space, is it possible ?
Yes, but that still leaves you with (NO!) swap partition to resize.

Historically, the root partition has been lean with other partitions (that might be large) mounted on it. The thinking being that there is less "disk space" at risk; that you will likely be able to boot to a root partition and do work to bring the rest of the system up.

I keep separate partitions for /var, /usr, /usr/pkg, /home, /Source -- the last taking symlinks for all the "src" filesystems (src, xsrc, pkgsrc) from their expected locations in the rest of the hierarchy.
 
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
Is it better to have multiple swaps for say one drive? so you just added them all into fstab I see, how did you do dumpon? Do you have a manually selected swap for coredumps with savecore, if something like rc.dumpon runs it will load everyone of them right? Sorry yes I admit pfSense question. Is there any reason not to use .eli with the multiple swaps?
 
You can add multiple swap files (UFS) or use ZFS zvols for swap.

It doesn't make sense having multiple swap partitions, zvols or swapfiles on the same device. This causes unnecessary actuator movement for no reason whatsoever.

This of course depends on whether memory that is paged out and stays paged out. This is ok. Active paging kills performance. In that case you're better off adding RAM than adding swap.
 
Back
Top