3 ## 12.11 Network, Memory, and File-Backed File Systems
\r
5 ***Reorganized and enhanced by Marc Fonvieille. ***
\r
7 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***.
\r
9 These include network file systems such as the [network-nfs.html Network File System], memory-based file systems and file-backed file systems.
\r
11 ### 12.11.1 File-Backed File System
\r
13 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.
\r
15 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:
\r
21 To mount an existing file system image:
\r
23 **Example 12-4. Using vnconfig to Mount an Existing File System Image**
\r
26 # vnconfig vn`***0***` `***diskimage***`
\r
27 # mount /dev/vn`***0***`c `***/mnt***`
\r
30 To create a new file system image with [vnconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vnconfig§ion8):
\r
32 **Example 12-5. Creating a New File-Backed Disk with `vnconfig`**
\r
35 # dd if#/dev/zero of`***newimage***` bs=1k count=`***5***`k
\r
38 # vnconfig -s labels -c vn`***0***` `***newimage***`
\r
39 # disklabel -r -w vn`***0***` auto
\r
40 # newfs vn`***0***`c
\r
41 Warning: 2048 sector(s) in last cylinder unallocated
\r
42 /dev/vn0c: 10240 sectors in 3 cylinders of 1 tracks, 4096 sectors
\r
43 5.0MB in 1 cyl groups (16 c/g, 32.00MB/g, 1280 i/g)
\r
44 super-block backups (for fsck -b #) at:
\r
46 # mount /dev/vn`***0***`c `***/mnt***`
\r
48 Filesystem 1K-blocks Used Avail Capacity Mounted on
\r
49 /dev/vn0c 4927 1 4532 0% /mnt
\r
52 ### 12.11.2 Memory-Based File System
\r
54 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.
\r
56 Simply take a file system you have prepared with, for example, [vnconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vnconfig§ion8), and:
\r
58 **Example 12-6. md Memory Disk**
\r
61 # dd if#`***newimage***` of/dev/md`***0***`
\r
64 # mount /dev/md`***0c***` `***/mnt***`
\r
66 Filesystem 1K-blocks Used Avail Capacity Mounted on
\r
67 /dev/md0c 4927 1 4532 0% /mnt
\r
70 For more details, please refer to [md(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#md§ion4) manual page.
\r
72 ### 12.11.3 Detaching a Memory Disk from the System
\r
74 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.
\r
76 For example to detach and free all resources used by `/dev/md4`:
\r
79 # mdconfig -d -u `***4***`
\r
82 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`.
\r
84 [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`:
\r
87 # vnconfig -u vn`***4***`
\r
93 CategoryHandbook-storage
\r