gpart And VPS Disk: Disappearing swap Partition

Tim Daneliuk tundra at
Thu Jan 18 23:02:24 UTC 2018

On 01/18/2018 03:39 PM, Steve O'Hara-Smith wrote:
> On Thu, 18 Jan 2018 15:01:56 -0600
> Tim Daneliuk <tundra at> wrote:
>> I have Digital Ocean instance that has about 1G free on the disk.
>> I want to use this to create a second swap partition.  I am able to
>> run 'gpart add -t freebsd-swap ...' successfully.  That is, gpart show
>> shows that new swap partition as present and I can swap it on.  HOWEVER,
>> upon reboot, that partition disappears and the space shows as free again.
>> What am I missing here?
> 	An entry in /etc/fstab something like this:
> /dev/gpt/<gpt label>	none	swap	sw	0	0

No, that's not it.  There is no /dev/gpt/label to even attempt to mount.

Here is what I did:

  gpart add -t freebsd-swap -i4 vtbd0
  gpart modify -i4 -lswapfs2 vtbd0

At this point, I can see the new swap partition.  However, when I reboot,
it's no longer there.

So, I tried to follow the above commands with:

  gpart commit vtbd0

And I get "Operation not permitted"

So, I did this:

  sysctl kern.geom.debugflags=16

And tried again ... no go.

In short, I can interactively create the new partition, but it disappears on reboot.

I suspect that the problem has to do with not being able to commit my changes,
but I cannot seem to figure out why this is so.  And yes, I've tried this
in single user mode as well.

Tim Daneliuk     tundra at
PGP Key:

More information about the freebsd-questions mailing list