Skip site navigation (1)Skip section navigation (2)
Date:      27 Feb 2018 14:16:08 -0500
From:      "John R. Levine" <johnl@iecc.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Compiling Swap space
Message-ID:  <alpine.OSX.2.21.1802271414110.45674@ary.qy>

next in thread | raw e-mail | index | archive | help
> You don't need mdconfig, just make a large file and use swapon like this:
>
># dd if=/dev/zero of=swapfile bs=1m count=1024
># swapon swapfile

Nope.  Try it.  You need a block device.

# dd if=/dev/zero of=/var/swap bs=1m count=100
100+0 records in
100+0 records out
# swapon /var/swap
swapon: /var/swap: Block device required

# mdconfig -f /var/swap
md0
# swapon /dev/md0
#

Assuming you want your swap space to come back after a reboot, put a
line into /etc/fstab and it'll do the mdconfig and mount at boot time:

# Device		Mountpoint	FStype	Options		Dump	Pass#
/dev/vtbd1		none		swap	sw		0	0
/dev/vtbd0s1a		/		ufs	rw		1	1
md99			none		swap	sw,file=/var/swap,late 0 0

-- 
Regards,
John Levine, johnl@iecc.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.OSX.2.21.1802271414110.45674>