## 12.11 Network, Memory, and File-Backed File Systems ***Reorganized and enhanced by Marc Fonvieille. *** Aside from the disks you physically insert into your computer: floppies, CDs, hard drives, and so forth; other forms of disks are understood by DragonFly - the ***virtual disks***. These include network file systems such as the [network-nfs.html Network File System], memory-based file systems and file-backed file systems. ### 12.11.1 File-Backed File System The utility [vnconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vnconfig§ion8) 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)](http://leaf.dragonflybsd.org/cgi/web-man?command=vnconfig§ion=8) uses files to create and operate a file system. One possible use is the mounting of floppy or CD images kept in files. To use [vnconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vnconfig§ion8), you need [vn(4)](http://leaf.dragonflybsd.org/cgi/web-man?command=vn§ion=4) support in your kernel configuration file: pseudo-device vn To mount an existing file system image: **Example 12-4. Using vnconfig to Mount an Existing File System Image** # vnconfig vn`***0***` `***diskimage***` # mount /dev/vn`***0***`c `***/mnt***` To create a new file system image with [vnconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vnconfig§ion8): **Example 12-5. Creating a New File-Backed Disk with `vnconfig`** # dd if#/dev/zero of`***newimage***` bs=1k count=`***5***`k 5120+0 records in 5120+0 records out # vnconfig -s labels -c vn`***0***` `***newimage***` # disklabel -r -w vn`***0***` auto # newfs vn`***0***`c Warning: 2048 sector(s) in last cylinder unallocated /dev/vn0c: 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: 32 # mount /dev/vn`***0***`c `***/mnt***` # df `***/mnt***` Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/vn0c 4927 1 4532 0% /mnt ### 12.11.2 Memory-Based File System The [md(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#md§ion4) driver is a simple, efficient means to create memory file systems. [malloc(9)](http://leaf.dragonflybsd.org/cgi/web-man?command=malloc§ion=9) is used to allocate the memory. Simply take a file system you have prepared with, for example, [vnconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vnconfig§ion8), and: **Example 12-6. md Memory Disk** # dd if#`***newimage***` of/dev/md`***0***` 5120+0 records in 5120+0 records out # mount /dev/md`***0c***` `***/mnt***` # df `***/mnt***` Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/md0c 4927 1 4532 0% /mnt For more details, please refer to [md(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#md§ion4) manual page. ### 12.11.3 Detaching a Memory Disk from the System When a memory-based or file-based file system is not used, you should release all resources to the system. The first thing to do is to unmount the file system, then use [mdconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#mdconfig§ion8) to detach the disk from the system and release the resources. For example to detach and free all resources used by `/dev/md4`: # mdconfig -d -u `***4***` It is possible to list information about configured [md(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#md§ion4) devices in using the command `mdconfig -l`. [vnconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vnconfig§ion8) is used to detach the device. For example to detach and free all resources used by `/dev/vn4`: # vnconfig -u vn`***4***` CategoryHandbook CategoryHandbook-storage