12.4 Network, Memory, and File-Based Filesystems

Aside from the disks you physically insert into your computer: floppies, CDs, hard drives, and so forth; other forms of disks are understood by FreeBSD - the virtual disks.

These include network filesystems such as the Network Filesystem and Coda, memory-based filesystems such as md and file-backed filesystems created by vnconfig or mdconfig.

12.4.1 vnconfig: File-Backed Filesystem

vnconfig(8) configures and enables vnode pseudo-disk devices. A vnode is a representation of a file, and is the focus of file activity. This means that vnconfig(8) uses files to create and operate a filesystem. One possible use is the mounting of floppy or CD images kept in files.

To mount an existing filesystem image:

Example 12-1. Using vnconfig to mount an Existing Filesystem Image

    # vnconfig vn0 diskimage
    # mount /dev/vn0c /mnt

To create a new filesystem image with vnconfig:

Example 12-2. Creating a New File-Backed Disk with vnconfig

    # dd if=/dev/zero of=newimage bs=1k count=5k
    5120+0 records in
    5120+0 records out
    # vnconfig -s labels -c vn0 newimage
    # disklabel -r -w vn0 auto
    # newfs vn0c
    Warning: 2048 sector(s) in last cylinder unallocated
    /dev/rvn0c:     10240 sectors in 3 cylinders of 1 tracks, 4096 sectors
            5.0MB in 1 cyl groups (16 c/g, 32.00MB/g, 1280 i/g)
    super-block backups (for fsck -b #) at:
    # mount /dev/vn0c /mnt
    # df /mnt
    Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
    /dev/vn0c        4927        1     4532     0%    /mnt

12.4.2 md: Memory Filesystem

md is a simple, efficient means to create memory filesystems.

Simply take a filesystem you have prepared with, for example, vnconfig(8), and:

Example 12-3. md Memory Disk

    # dd if=newimage of=/dev/md0
    5120+0 records in
    5120+0 records out
    # mount /dev/md0c /mnt
    # df /mnt
    Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
    /dev/md0c        4927        1     4532     0%    /mnt

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.