Add reflection plugin.
[nbdkit/ericb.git] / plugins / memory / nbdkit-memory-plugin.pod
blob450365149ed2884b7afd0f52adde7b9ea5c07b4d
1 =head1 NAME
3 nbdkit-memory-plugin - nbdkit virtual memory (RAM disk) plugin
5 =head1 SYNOPSIS
7  nbdkit memory [size=]SIZE
9 =head1 DESCRIPTION
11 C<nbdkit-memory-plugin> is a plugin for L<nbdkit(1)> which stores a
12 single disk image in virtual memory, and discards it when nbdkit
13 exits.  This plugin can be used for testing or where you don't care
14 about the final content of the disk image.
16 All nbdkit clients will see the same disk content, initially all
17 zeroes.
19 The disk image is stored in memory using a sparse array.  The
20 allocated parts of the disk image cannot be larger than physical RAM
21 plus swap, less whatever is being used by the rest of the system.  If
22 you want to allocate more space than this use L<nbdkit-file-plugin(1)>
23 backed by a temporary file instead.
25 However the virtual size can be as large as you like, up to the
26 maximum supported by nbdkit (S<2⁶³-1 bytes>).  This limit is tested
27 when nbdkit is compiled, and it should work on all platforms and
28 architectures supported by nbdkit.
30 =head1 EXAMPLES
32 Create a one gigabyte sparse RAM disk:
34  nbdkit memory 1G
36 If you want to loop mount the above disk, see L<nbdkit-loop(1)>.
38 Create the largest possible RAM disk:
40  nbdkit memory $(( 2**63 - 1 ))
42 =head1 PARAMETERS
44 =over 4
46 =item [B<size=>]SIZE
48 Specify the virtual size of the disk image.
50 This parameter is required.
52 C<size=> is a magic config key and may be omitted in most cases.
53 See L<nbdkit(1)/Magic parameters>.
55 =back
57 =head1 NOTES
59 =head2 Preloading small amounts of data
61 If you want an in-memory disk image preinitialized with a small amount
62 of data specified on the command line, look at
63 L<nbdkit-data-plugin(1)> instead.  Note by "small" this does not mean
64 that the virtual disk image must be small, but that the amount of data
65 initially stored sparsely is small enough to specify on the command
66 line.
68 =head2 Preloading large amounts of data
70 If you want to preload a large amount of data (eg. a disk image) into
71 the memory plugin, use L<qemu-img(1)>:
73  $ rm -f pid
74  $ nbdkit -P pid memory 10G
76  # wait for nbdkit to become ready to accept connections:
77  $ while [ ! -f pid ]; do sleep 1; done
79  # preload Fedora disk image:
80  $ virt-builder fedora-28 --size=10G
81  $ qemu-img convert -p -n fedora-28.img nbd:localhost:10809
83 =head1 SEE ALSO
85 L<nbdkit(1)>,
86 L<nbdkit-plugin(3)>,
87 L<nbdkit-loop(1)>,
88 L<nbdkit-data-plugin(1)>,
89 L<nbdkit-file-plugin(1)>,
90 L<nbdkit-reflection-plugin(1)>.
92 =head1 AUTHORS
94 Richard W.M. Jones
96 =head1 COPYRIGHT
98 Copyright (C) 2017-2018 Red Hat Inc.