changing swap size

Andy Greenwood greenwood.andy at gmail.com
Mon Nov 13 14:46:42 UTC 2006


On 11/13/06, Zbigniew Szalbot <zbyszek at szalbot.homedns.org> wrote:
> Hello,
>
> Following the advice about periodic freezes, I am going to add some RAM to
> my system. However, currently my swap size is 512MB. If I increase RAM to,
> say, 1GB, would I need to change the swap size to 2GB? If so, is it a safe
> process (I assume this can be done using FIPS)? Would I need to boot first
> in single-user mode?

As has already been said, you don't really need to change your swap
size unless you're going to be using all of your physical memory and
need the additional space. Since it doesn't sound like you're going to
be putting any more load on the server, it's unnecessary. However, if
you want to do it, you could, without going to single-user mode:

1) create an empty file somewhere. This will make a 1 MB file, adjust
bs and count as you need to.
# dd if=/dev/zero of=/path/to/some.file bs=1k count=1024

2) create a file based device with mdconfig like this.
# mdconfig -a -t vnode -f /path/to/some.file

3) swapon your shiny new md device. Use the md device that was given
as output from the above command.
# swapon /dev/md0

4) verify that your device is now working as a swap device with
# swapinfo -h

5) now you can swapoff your main swap, change it as you need, and swapon it back
# swapoff /dev/ad0s1b
<do something>
# swapon /dev/ad0s1b

6) now that you new, improved swap is working, you can swapoff your
temporary swap, remove the md device, delete the file, and verify that
your swap is right
# swapoff /dev/md0
# mdconfig -d -u md0
# rm /path/to/some.file
# swapinfo -h

> Any other thoughts? BTW - is there any easy way to
> make sure how much RAM is currently installed other than looking into the
> hardware? Top:
>
> Mem: 146M Active, 23M Inact, 98M Wired, 15M Cache, 41M Buf, 22M Free
>
> Which would seem to suggest I have 345 MB RAM. But from what I recall this
> machine uses 320 MB RAM. Thanks!
>
>
> --
> Zbigniew Szalbot
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>


-- 
I'm nerdy in the extreme and whiter than sour cream


More information about the freebsd-questions mailing list