1 =head2 add-cdrom | cdrom
5 This function adds a virtual CD-ROM disk image to the guest.
7 This is equivalent to the qemu parameter C<-cdrom filename>.
13 This function adds a virtual machine disk image C<filename> to the
14 guest. The first time you call this function, the disk appears as IDE
15 disk 0 (C</dev/sda>) in the guest, the second time as C</dev/sdb>, and
18 You don't necessarily need to be root when using libguestfs. However
19 you obviously do need sufficient permissions to access the filename
20 for whatever operations you want to perform (ie. read access if you
21 just want to read the image or write access if you want to modify the
24 This is equivalent to the qemu parameter C<-drive file=filename>.
30 Return the contents of the file named C<path>.
32 Note that this function cannot correctly handle binary files
33 (specifically, files containing C<\0> character which is treated
34 as end of string). For those you need to use the C<read_file>
35 function which has a more complex interface.
39 config qemuparam qemuvalue
41 This can be used to add arbitrary qemu command line parameters
42 of the form C<-param value>. Actually it's not quite arbitrary - we
43 prevent you from setting some parameters which would interfere with
44 parameters that we use.
46 The first character of C<param> string must be a C<-> (dash).
54 Get the autosync flag.
60 Return the current search path.
62 This is always non-NULL. If it wasn't set already, then this will
63 return the default path.
69 This returns the verbose messages flag.
71 =head2 kill-subprocess
75 This kills the qemu subprocess. You should never need to call this.
81 Internally libguestfs is implemented by running a virtual machine
84 You should call this after configuring the handle
85 (eg. adding drives) but before performing any actions.
91 List all the block devices.
93 The full block device names are returned, eg. C</dev/sda>
95 =head2 list-partitions
99 List all the partitions detected on all block devices.
101 The full partition device names are returned, eg. C</dev/sda1>
103 This does not return logical volumes. For that you will need to
110 List the files in C<directory> (relative to the root directory,
111 there is no cwd) in the format of 'ls -la'.
113 This command is mostly useful for interactive sessions. It
114 is I<not> intended that you try to parse the output string.
120 List the files in C<directory> (relative to the root directory,
121 there is no cwd). The '.' and '..' entries are not returned, but
122 hidden files are shown.
124 This command is mostly useful for interactive sessions. Programs
125 should probably use C<readdir> instead.
131 List all the logical volumes detected. This is the equivalent
132 of the L<lvs(8)> command.
134 This returns a list of the logical volume device names
135 (eg. C</dev/VolGroup00/LogVol00>).
137 See also C<lvs_full>.
143 List all the logical volumes detected. This is the equivalent
144 of the L<lvs(8)> command. The "full" version includes all fields.
148 mount device mountpoint
150 Mount a guest disk at a position in the filesystem. Block devices
151 are named C</dev/sda>, C</dev/sdb> and so on, as they were added to
152 the guest. If those block devices contain partitions, they will have
153 the usual names (eg. C</dev/sda1>). Also LVM C</dev/VG/LV>-style
156 The rules are the same as for L<mount(2)>: A filesystem must
157 first be mounted on C</> before others can be mounted. Other
158 filesystems can only be mounted on directories which already
161 The mounted filesystem is writable, if we have sufficient permissions
162 on the underlying device.
164 The filesystem options C<sync> and C<noatime> are set with this
165 call, in order to improve reliability.
171 List all the physical volumes detected. This is the equivalent
172 of the L<pvs(8)> command.
174 This returns a list of just the device names that contain
175 PVs (eg. C</dev/sda2>).
177 See also C<pvs_full>.
183 List all the physical volumes detected. This is the equivalent
184 of the L<pvs(8)> command. The "full" version includes all fields.
190 Return the contents of the file named C<path>.
192 The file contents are returned as a list of lines. Trailing
193 C<LF> and C<CRLF> character sequences are I<not> returned.
195 Note that this function cannot correctly handle binary files
196 (specifically, files containing C<\0> character which is treated
197 as end of line). For those you need to use the C<read_file>
198 function which has a more complex interface.
200 =head2 set-autosync | autosync
202 set-autosync true|false
204 If C<autosync> is true, this enables autosync. Libguestfs will make a
205 best effort attempt to run C<sync> when the handle is closed
206 (also if the program exits without closing handles).
208 =head2 set-path | path
212 Set the path that libguestfs searches for kernel and initrd.img.
214 The default is C<$libdir/guestfs> unless overridden by setting
215 C<LIBGUESTFS_PATH> environment variable.
217 The string C<path> is stashed in the libguestfs handle, so the caller
218 must make sure it remains valid for the lifetime of the handle.
220 Setting C<path> to C<NULL> restores the default path.
222 =head2 set-verbose | verbose
224 set-verbose true|false
226 If C<verbose> is true, this turns on verbose messages (to C<stderr>).
228 Verbose messages are disabled unless the environment variable
229 C<LIBGUESTFS_DEBUG> is defined and set to C<1>.
235 This syncs the disk, so that any writes are flushed through to the
236 underlying disk image.
238 You should always call this if you have modified a disk image, before
245 Touch acts like the L<touch(1)> command. It can be used to
246 update the timestamps on a file, or, if the file does not exist,
247 to create a new zero-length file.
253 List all the volumes groups detected. This is the equivalent
254 of the L<vgs(8)> command.
256 This returns a list of just the volume group names that were
257 detected (eg. C<VolGroup00>).
259 See also C<vgs_full>.
265 List all the volumes groups detected. This is the equivalent
266 of the L<vgs(8)> command. The "full" version includes all fields.