gpart And VPS Disk: Disappearing swap Partition

Steve O'Hara-Smith steve at sohara.org
Fri Jan 19 07:59:54 UTC 2018


On Thu, 18 Jan 2018 17:02:14 -0600
Tim Daneliuk <tundra at tundraware.com> wrote:

> 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 tundraware.com> 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.

	My bad, I was assuming you gave it a gpt label, it's pretty much a
reflex with me when using gpart :)

> Here is what I did:
> 
>   gpart add -t freebsd-swap -i4 vtbd0

	Try adding -l swap1 to that command viz:

gpart add -t freebsd-swap -l swap1 -i4 vtbd0

	That *should* cause a /dev/gpt/swap1 to appear and persist through
reboots.

>   gpart modify -i4 -lswapfs2 vtbd0
> 
> At this point, I can see the new swap partition.  However, when I reboot,
> it's no longer there.

	Hmm - does vtbd0 exist at all after reboot ?

> So, I tried to follow the above commands with:
> 
>   gpart commit vtbd0
> 
> And I get "Operation not permitted"

	Hmm interesting, by default commit is a no-op as generally there
are no pending changes.

> 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.

	I don't think it's lack of commit, but 'operation not permitted'
seems odd. I think the problem stems from vtbd0 not having a /dev/ entry
but I could easily be wrong.

-- 
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
The computer obeys and wins.                |    licences available see
You lose and Bill collects.                 |    http://www.sohara.org/


More information about the freebsd-questions mailing list