mdconfig creating file based memory disk

Erich Dollansky erichsfreebsdlist at
Thu Sep 10 11:44:55 UTC 2015


On Thu, 10 Sep 2015 00:54:13 -0400
Quartz <quartz at> wrote:

> > It gives me double the size of 'swapfile' as swap space. It is
> > obvious to me that this must fail.
> Interestingly, I just tested this in a VM and it seems to work fine.
> I maxed out the ram by creating a few other ramdisks and filling them
> with dd zero files, and the most I got was a generic "out of swap
> space" error (no crashes or panics). Not sure exactly what it's doing
> though.

fill it either with random data (hard to verify) or one with 0s and the
other one with 1s. The data you write last should be on both disks

I did a simple test. I creates two memory disks using the same file,
put a file system on, mounted one memory disk, wrote file to it,
un-mounted it, mounted the other memory disk and the file was there.

So, it is obvious that both memory disks are written to the one and
only file without any warning. If this happens with swap, the damage
can be whatever is possible with a corrupted swap. It even opens
security holes if a normal user can either create memory disks or at
least mount them.


-questions at mailing list
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list