1nbdkit-memory-plugin(1) NBDKIT nbdkit-memory-plugin(1)
2
3
4
6 nbdkit-memory-plugin - nbdkit virtual memory (RAM disk) plugin
7
9 nbdkit memory [size=]SIZE
10
12 "nbdkit-memory-plugin" is a plugin for nbdkit(1) which stores a single
13 disk image in virtual memory, and discards it when nbdkit exits. This
14 plugin can be used for testing or where you don't care about the final
15 content of the disk image.
16
17 All nbdkit clients will see the same disk content, initially all
18 zeroes.
19
20 The disk image is stored in memory using a sparse array. The allocated
21 parts of the disk image cannot be larger than physical RAM plus swap,
22 less whatever is being used by the rest of the system. If you want to
23 allocate more space than this use nbdkit-file-plugin(1) backed by a
24 temporary file instead.
25
26 However the virtual size can be as large as you like, up to the maximum
27 supported by nbdkit (2⁶³-1 bytes). This limit is tested when nbdkit is
28 compiled, and it should work on all platforms and architectures
29 supported by nbdkit.
30
32 Create a one gigabyte sparse RAM disk:
33
34 nbdkit memory 1G
35
36 If you want to loop mount the above disk, see nbdkit-loop(1).
37
38 Create the largest possible RAM disk:
39
40 nbdkit memory $(( 2**63 - 1 ))
41
43 [size=]SIZE
44 Specify the virtual size of the disk image.
45
46 This parameter is required.
47
48 "size=" is a magic config key and may be omitted in most cases.
49 See "Magic parameters" in nbdkit(1).
50
52 Preloading small amounts of data
53 If you want an in-memory disk image preinitialized with a small amount
54 of data specified on the command line, look at nbdkit-data-plugin(1)
55 instead. Note by "small" this does not mean that the virtual disk
56 image must be small, but that the amount of data initially stored
57 sparsely is small enough to specify on the command line.
58
59 Preloading large amounts of data
60 If you want to preload a large amount of data (eg. a disk image) into
61 the memory plugin, use qemu-img(1):
62
63 $ rm -f pid
64 $ nbdkit -P pid memory 10G
65
66 # wait for nbdkit to become ready to accept connections:
67 $ while [ ! -f pid ]; do sleep 1; done
68
69 # preload Fedora disk image:
70 $ virt-builder fedora-28 --size=10G
71 $ qemu-img convert -p -n fedora-28.img nbd:localhost:10809
72
74 $plugindir/nbdkit-memory-plugin.so
75 The plugin.
76
77 Use "nbdkit --dump-config" to find the location of $plugindir.
78
80 "nbdkit-memory-plugin" first appeared in nbdkit 1.2.
81
83 nbdkit(1), nbdkit-plugin(3), nbdkit-loop(1), nbdkit-data-plugin(1),
84 nbdkit-file-plugin(1), nbdkit-info-plugin(1).
85
87 Richard W.M. Jones
88
90 Copyright (C) 2017-2018 Red Hat Inc.
91
93 Redistribution and use in source and binary forms, with or without
94 modification, are permitted provided that the following conditions are
95 met:
96
97 · Redistributions of source code must retain the above copyright
98 notice, this list of conditions and the following disclaimer.
99
100 · Redistributions in binary form must reproduce the above copyright
101 notice, this list of conditions and the following disclaimer in the
102 documentation and/or other materials provided with the
103 distribution.
104
105 · Neither the name of Red Hat nor the names of its contributors may
106 be used to endorse or promote products derived from this software
107 without specific prior written permission.
108
109 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
110 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
111 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
112 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
113 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
114 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
115 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
116 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
117 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
118 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
119 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
120
121
122
123nbdkit-1.16.1 2019-12-03 nbdkit-memory-plugin(1)