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.
186 =head2 set-autosync | autosync
188 set-autosync true|false
190 If C<autosync> is true, this enables autosync. Libguestfs will make a
191 best effort attempt to run C<sync> when the handle is closed
192 (also if the program exits without closing handles).
194 =head2 set-path | path
198 Set the path that libguestfs searches for kernel and initrd.img.
200 The default is C<$libdir/guestfs> unless overridden by setting
201 C<LIBGUESTFS_PATH> environment variable.
203 The string C<path> is stashed in the libguestfs handle, so the caller
204 must make sure it remains valid for the lifetime of the handle.
206 Setting C<path> to C<NULL> restores the default path.
208 =head2 set-verbose | verbose
210 set-verbose true|false
212 If C<verbose> is true, this turns on verbose messages (to C<stderr>).
214 Verbose messages are disabled unless the environment variable
215 C<LIBGUESTFS_DEBUG> is defined and set to C<1>.
221 This syncs the disk, so that any writes are flushed through to the
222 underlying disk image.
224 You should always call this if you have modified a disk image, before
231 Touch acts like the L<touch(1)> command. It can be used to
232 update the timestamps on a file, or, if the file does not exist,
233 to create a new zero-length file.
239 List all the volumes groups detected. This is the equivalent
240 of the L<vgs(8)> command.
242 This returns a list of just the volume group names that were
243 detected (eg. C<VolGroup00>).
245 See also C<vgs_full>.
251 List all the volumes groups detected. This is the equivalent
252 of the L<vgs(8)> command. The "full" version includes all fields.