1guestfish(1) Virtualization Support guestfish(1)
2
3
4
6 guestfish - the guest filesystem shell
7
9 guestfish [--options] [commands]
10
11 guestfish
12
13 guestfish [--ro|--rw] -a disk.img
14
15 guestfish [--ro|--rw] -a disk.img -m dev[:mountpoint]
16
17 guestfish -d libvirt-domain
18
19 guestfish [--ro|--rw] -a disk.img -i
20
21 guestfish -d libvirt-domain -i
22
24 Using "guestfish" in write mode on live virtual machines, or
25 concurrently with other disk editing tools, can be dangerous,
26 potentially causing disk corruption. The virtual machine must be shut
27 down before you use this command, and disk images must not be edited
28 concurrently.
29
30 Use the --ro (read-only) option to use "guestfish" safely if the disk
31 image or virtual machine might be live. You may see strange or
32 inconsistent results if running concurrently with other changes, but
33 with this option you won't risk disk corruption.
34
36 Guestfish is a shell and command-line tool for examining and modifying
37 virtual machine filesystems. It uses libguestfs and exposes all of the
38 functionality of the guestfs API, see guestfs(3).
39
40 Guestfish gives you structured access to the libguestfs API, from shell
41 scripts or the command line or interactively. If you want to rescue a
42 broken virtual machine image, you should look at the virt-rescue(1)
43 command.
44
46 As an interactive shell
47 $ guestfish
48
49 Welcome to guestfish, the guest filesystem shell for
50 editing virtual machine filesystems.
51
52 Type: 'help' for a list of commands
53 'man' to read the manual
54 'quit' to quit the shell
55
56 ><fs> add-ro disk.img
57 ><fs> run
58 ><fs> list-filesystems
59 /dev/sda1: ext4
60 /dev/vg_guest/lv_root: ext4
61 /dev/vg_guest/lv_swap: swap
62 ><fs> mount /dev/vg_guest/lv_root /
63 ><fs> cat /etc/fstab
64 # /etc/fstab
65 # Created by anaconda
66 [...]
67 ><fs> exit
68
69 From shell scripts
70 Create a new /etc/motd file in a guest or disk image:
71
72 guestfish <<_EOF_
73 add disk.img
74 run
75 mount /dev/vg_guest/lv_root /
76 write /etc/motd "Welcome, new users"
77 _EOF_
78
79 List the LVM logical volumes in a disk image:
80
81 guestfish -a disk.img --ro <<_EOF_
82 run
83 lvs
84 _EOF_
85
86 List all the filesystems in a disk image:
87
88 guestfish -a disk.img --ro <<_EOF_
89 run
90 list-filesystems
91 _EOF_
92
93 On one command line
94 Update /etc/resolv.conf in a guest:
95
96 guestfish \
97 add disk.img : run : mount /dev/vg_guest/lv_root / : \
98 write /etc/resolv.conf "nameserver 1.2.3.4"
99
100 Edit /boot/grub/grub.conf interactively:
101
102 guestfish --rw --add disk.img \
103 --mount /dev/vg_guest/lv_root \
104 --mount /dev/sda1:/boot \
105 edit /boot/grub/grub.conf
106
107 Mount disks automatically
108 Use the -i option to automatically mount the disks from a virtual
109 machine:
110
111 guestfish --ro -a disk.img -i cat /etc/group
112
113 guestfish --ro -d libvirt-domain -i cat /etc/group
114
115 Another way to edit /boot/grub/grub.conf interactively is:
116
117 guestfish --rw -a disk.img -i edit /boot/grub/grub.conf
118
119 As a script interpreter
120 Create a 100MB disk containing an ext2-formatted partition:
121
122 #!/usr/bin/guestfish -f
123 sparse test1.img 100M
124 run
125 part-disk /dev/sda mbr
126 mkfs ext2 /dev/sda1
127
128 Start with a prepared disk
129 Create a 1G disk called test1.img containing a single ext2-formatted
130 partition:
131
132 guestfish -N fs
133
134 To list what is available do:
135
136 guestfish -N help | less
137
138 Remote drives
139 Access a remote disk using ssh:
140
141 guestfish -a ssh://example.com/path/to/disk.img
142
143 Remote control
144 eval "`guestfish --listen`"
145 guestfish --remote add-ro disk.img
146 guestfish --remote run
147 guestfish --remote lvs
148
150 --help
151 Displays general help on options.
152
153 -h
154 --cmd-help
155 Lists all available guestfish commands.
156
157 -h CMD
158 --cmd-help CMD
159 Displays detailed help on a single command "cmd".
160
161 -a IMAGE
162 --add IMAGE
163 Add a block device or virtual machine image to the shell.
164
165 The format of the disk image is auto-detected. To override this
166 and force a particular format use the --format=.. option.
167
168 Using this flag is mostly equivalent to using the "add" command,
169 with "readonly:true" if the --ro flag was given, and with
170 "format:..." if the --format=... flag was given.
171
172 -a URI
173 --add URI
174 Add a remote disk. See "ADDING REMOTE STORAGE".
175
176 -c URI
177 --connect URI
178 When used in conjunction with the -d option, this specifies the
179 libvirt URI to use. The default is to use the default libvirt
180 connection.
181
182 --csh
183 If using the --listen option and a csh-like shell, use this option.
184 See section "REMOTE CONTROL AND CSH" below.
185
186 -d LIBVIRT-DOMAIN
187 --domain LIBVIRT-DOMAIN
188 Add disks from the named libvirt domain. If the --ro option is
189 also used, then any libvirt domain can be used. However in write
190 mode, only libvirt domains which are shut down can be named here.
191
192 Domain UUIDs can be used instead of names.
193
194 Using this flag is mostly equivalent to using the "add-domain"
195 command, with "readonly:true" if the --ro flag was given, and with
196 "format:..." if the --format=... flag was given.
197
198 --echo-keys
199 When prompting for keys and passphrases, guestfish normally turns
200 echoing off so you cannot see what you are typing. If you are not
201 worried about Tempest attacks and there is no one else in the room
202 you can specify this flag to see what you are typing.
203
204 -f FILE
205 --file FILE
206 Read commands from "FILE". To write pure guestfish scripts, use:
207
208 #!/usr/bin/guestfish -f
209
210 --format=raw|qcow2|..
211 --format
212 The default for the -a option is to auto-detect the format of the
213 disk image. Using this forces the disk format for -a options which
214 follow on the command line. Using --format with no argument
215 switches back to auto-detection for subsequent -a options.
216
217 For example:
218
219 guestfish --format=raw -a disk.img
220
221 forces raw format (no auto-detection) for disk.img.
222
223 guestfish --format=raw -a disk.img --format -a another.img
224
225 forces raw format (no auto-detection) for disk.img and reverts to
226 auto-detection for another.img.
227
228 If you have untrusted raw-format guest disk images, you should use
229 this option to specify the disk format. This avoids a possible
230 security problem with malicious guests (CVE-2010-3851). See also
231 "add".
232
233 -i
234 --inspector
235 Using virt-inspector(1) code, inspect the disks looking for an
236 operating system and mount filesystems as they would be mounted on
237 the real virtual machine.
238
239 Typical usage is either:
240
241 guestfish -d myguest -i
242
243 (for an inactive libvirt domain called myguest), or:
244
245 guestfish --ro -d myguest -i
246
247 (for active domains, readonly), or specify the block device
248 directly:
249
250 guestfish --rw -a /dev/Guests/MyGuest -i
251
252 Note that the command line syntax changed slightly over older
253 versions of guestfish. You can still use the old syntax:
254
255 guestfish [--ro] -i disk.img
256
257 guestfish [--ro] -i libvirt-domain
258
259 Using this flag is mostly equivalent to using the "inspect-os"
260 command and then using other commands to mount the filesystems that
261 were found.
262
263 --key SELECTOR
264 Specify a key for LUKS, to automatically open a LUKS device when
265 using the inspection. "SELECTOR" can be in one of the following
266 formats:
267
268 --key "DEVICE":key:KEY_STRING
269 Use the specified "KEY_STRING" as passphrase.
270
271 --key "DEVICE":file:FILENAME
272 Read the passphrase from FILENAME.
273
274 --keys-from-stdin
275 Read key or passphrase parameters from stdin. The default is to
276 try to read passphrases from the user by opening /dev/tty.
277
278 --listen
279 Fork into the background and listen for remote commands. See
280 section "REMOTE CONTROL GUESTFISH OVER A SOCKET" below.
281
282 --live
283 Connect to a live virtual machine. (Experimental, see "ATTACHING
284 TO RUNNING DAEMONS" in guestfs(3)).
285
286 -m dev[:mountpoint[:options[:fstype]]]
287 --mount dev[:mountpoint[:options[:fstype]]]
288 Mount the named partition or logical volume on the given
289 mountpoint.
290
291 If the mountpoint is omitted, it defaults to /.
292
293 You have to mount something on / before most commands will work.
294
295 If any -m or --mount options are given, the guest is automatically
296 launched.
297
298 If you don’t know what filesystems a disk image contains, you can
299 either run guestfish without this option, then list the partitions,
300 filesystems and LVs available (see "list-partitions", "list-
301 filesystems" and "lvs" commands), or you can use the
302 virt-filesystems(1) program.
303
304 The third (and rarely used) part of the mount parameter is the list
305 of mount options used to mount the underlying filesystem. If this
306 is not given, then the mount options are either the empty string or
307 "ro" (the latter if the --ro flag is used). By specifying the
308 mount options, you override this default choice. Probably the only
309 time you would use this is to enable ACLs and/or extended
310 attributes if the filesystem can support them:
311
312 -m /dev/sda1:/:acl,user_xattr
313
314 Using this flag is equivalent to using the "mount-options" command.
315
316 The fourth part of the parameter is the filesystem driver to use,
317 such as "ext3" or "ntfs". This is rarely needed, but can be useful
318 if multiple drivers are valid for a filesystem (eg: "ext2" and
319 "ext3"), or if libguestfs misidentifies a filesystem.
320
321 --network
322 Enable QEMU user networking in the guest.
323
324 -N [FILENAME=]TYPE
325 --new [FILENAME=]TYPE
326 -N help
327 Prepare a fresh disk image formatted as "TYPE". This is an
328 alternative to the -a option: whereas -a adds an existing disk, -N
329 creates a preformatted disk with a filesystem and adds it. See
330 "PREPARED DISK IMAGES" below.
331
332 -n
333 --no-sync
334 Disable autosync. This is enabled by default. See the discussion
335 of autosync in the guestfs(3) manpage.
336
337 --no-dest-paths
338 Don’t tab-complete paths on the guest filesystem. It is useful to
339 be able to hit the tab key to complete paths on the guest
340 filesystem, but this causes extra "hidden" guestfs calls to be
341 made, so this option is here to allow this feature to be disabled.
342
343 --pipe-error
344 If writes fail to pipe commands (see "PIPES" below), then the
345 command returns an error.
346
347 The default (also for historical reasons) is to ignore such errors
348 so that:
349
350 ><fs> command_with_lots_of_output | head
351
352 doesn't give an error.
353
354 --progress-bars
355 Enable progress bars, even when guestfish is used non-
356 interactively.
357
358 Progress bars are enabled by default when guestfish is used as an
359 interactive shell.
360
361 --no-progress-bars
362 Disable progress bars.
363
364 --remote
365 --remote=PID
366 Send remote commands to $GUESTFISH_PID or "pid". See section
367 "REMOTE CONTROL GUESTFISH OVER A SOCKET" below.
368
369 -r
370 --ro
371 This changes the -a, -d and -m options so that disks are added and
372 mounts are done read-only.
373
374 The option must always be used if the disk image or virtual machine
375 might be running, and is generally recommended in cases where you
376 don't need write access to the disk.
377
378 Note that prepared disk images created with -N are not affected by
379 this option. Also commands like "add" are not affected - you have
380 to specify the "readonly:true" option explicitly if you need it.
381
382 See also "OPENING DISKS FOR READ AND WRITE" below.
383
384 --selinux
385 This option is provided for backwards compatibility and does
386 nothing.
387
388 -v
389 --verbose
390 Enable very verbose messages. This is particularly useful if you
391 find a bug.
392
393 -V
394 --version
395 Display the guestfish / libguestfs version number and exit.
396
397 -w
398 --rw
399 This changes the -a, -d and -m options so that disks are added and
400 mounts are done read-write.
401
402 See "OPENING DISKS FOR READ AND WRITE" below.
403
404 -x Echo each command before executing it.
405
407 Any additional (non-option) arguments are treated as commands to
408 execute.
409
410 Commands to execute should be separated by a colon (":"), where the
411 colon is a separate parameter. Thus:
412
413 guestfish cmd [args...] : cmd [args...] : cmd [args...] ...
414
415 If there are no additional arguments, then we enter a shell, either an
416 interactive shell with a prompt (if the input is a terminal) or a non-
417 interactive shell.
418
419 In either command line mode or non-interactive shell, the first command
420 that gives an error causes the whole shell to exit. In interactive
421 mode (with a prompt) if a command fails, you can continue to enter
422 commands.
423
424 Note that arguments of the commands will be considered as guestfish
425 options if they start with a dash ("-"): you can always separate the
426 guestfish options and the rest of the commands (with their arguments)
427 using a double dash ("--"). For example:
428
429 guestfish -- disk_create overlay.qcow2 qcow2 -1 backingfile:image.img
430
432 As with guestfs(3), you must first configure your guest by adding
433 disks, then launch it, then mount any disks you need, and finally issue
434 actions/commands. So the general order of the day is:
435
436 · add or -a/--add
437
438 · launch (aka run)
439
440 · mount or -m/--mount
441
442 · any other commands
443
444 "run" is a synonym for "launch". You must "launch" (or "run") your
445 guest before mounting or performing any other commands.
446
447 The only exception is that if any of the -i, -m, --mount, -N or --new
448 options were given then "run" is done automatically, simply because
449 guestfish can't perform the action you asked for without doing this.
450
452 The guestfish, guestmount(1) and virt-rescue(1) options --ro and --rw
453 affect whether the other command line options -a, -c, -d, -i and -m
454 open disk images read-only or for writing.
455
456 In libguestfs ≤ 1.10, guestfish, guestmount and virt-rescue defaulted
457 to opening disk images supplied on the command line for write. To open
458 a disk image read-only you have to do -a image --ro.
459
460 This matters: If you accidentally open a live VM disk image writable
461 then you will cause irreversible disk corruption.
462
463 In a future libguestfs we intend to change the default the other way.
464 Disk images will be opened read-only. You will have to either specify
465 guestfish --rw, guestmount --rw, virt-rescue --rw, or change the
466 configuration file in order to get write access for disk images
467 specified by those other command line options.
468
469 This version of guestfish, guestmount and virt-rescue has a --rw option
470 which does nothing (it is already the default). However it is highly
471 recommended that you use this option to indicate that you need write
472 access, and prepare your scripts for the day when this option will be
473 required for write access.
474
475 Note: This does not affect commands like "add" and "mount", or any
476 other libguestfs program apart from guestfish and guestmount.
477
479 You can quote ordinary parameters using either single or double quotes.
480 For example:
481
482 add "file with a space.img"
483
484 rm '/file name'
485
486 rm '/"'
487
488 A few commands require a list of strings to be passed. For these, use
489 a whitespace-separated list, enclosed in quotes. Strings containing
490 whitespace to be passed through must be enclosed in single quotes. A
491 literal single quote must be escaped with a backslash.
492
493 vgcreate VG "/dev/sda1 /dev/sdb1"
494 command "/bin/echo 'foo bar'"
495 command "/bin/echo \'foo\'"
496
497 ESCAPE SEQUENCES IN DOUBLE QUOTED ARGUMENTS
498 In double-quoted arguments (only) use backslash to insert special
499 characters:
500
501 "\a"
502 Alert (bell) character.
503
504 "\b"
505 Backspace character.
506
507 "\f"
508 Form feed character.
509
510 "\n"
511 Newline character.
512
513 "\r"
514 Carriage return character.
515
516 "\t"
517 Horizontal tab character.
518
519 "\v"
520 Vertical tab character.
521
522 "\""
523 A literal double quote character.
524
525 "\ooo"
526 A character with octal value ooo. There must be precisely 3 octal
527 digits (unlike C).
528
529 "\xhh"
530 A character with hex value hh. There must be precisely 2 hex
531 digits.
532
533 In the current implementation "\000" and "\x00" cannot be used in
534 strings.
535
536 "\\"
537 A literal backslash character.
538
540 Some commands take optional arguments. These arguments appear in this
541 documentation as "[argname:..]". You can use them as in these
542 examples:
543
544 add filename
545
546 add filename readonly:true
547
548 add filename format:qcow2 readonly:false
549
550 Each optional argument can appear at most once. All optional arguments
551 must appear after the required ones.
552
554 This section applies to all commands which can take integers as
555 parameters.
556
557 SIZE SUFFIX
558 When the command takes a parameter measured in bytes, you can use one
559 of the following suffixes to specify kilobytes, megabytes and larger
560 sizes:
561
562 k or K or KiB
563 The size in kilobytes (multiplied by 1024).
564
565 KB The size in SI 1000 byte units.
566
567 M or MiB
568 The size in megabytes (multiplied by 1048576).
569
570 MB The size in SI 1000000 byte units.
571
572 G or GiB
573 The size in gigabytes (multiplied by 2**30).
574
575 GB The size in SI 10**9 byte units.
576
577 T or TiB
578 The size in terabytes (multiplied by 2**40).
579
580 TB The size in SI 10**12 byte units.
581
582 P or PiB
583 The size in petabytes (multiplied by 2**50).
584
585 PB The size in SI 10**15 byte units.
586
587 E or EiB
588 The size in exabytes (multiplied by 2**60).
589
590 EB The size in SI 10**18 byte units.
591
592 Z or ZiB
593 The size in zettabytes (multiplied by 2**70).
594
595 ZB The size in SI 10**21 byte units.
596
597 Y or YiB
598 The size in yottabytes (multiplied by 2**80).
599
600 YB The size in SI 10**24 byte units.
601
602 For example:
603
604 truncate-size /file 1G
605
606 would truncate the file to 1 gigabyte.
607
608 Be careful because a few commands take sizes in kilobytes or megabytes
609 (eg. the parameter to "memsize" is specified in megabytes already).
610 Adding a suffix will probably not do what you expect.
611
612 OCTAL AND HEXADECIMAL NUMBERS
613 For specifying the radix (base) use the C convention: 0 to prefix an
614 octal number or "0x" to prefix a hexadecimal number. For example:
615
616 1234 decimal number 1234
617 02322 octal number, equivalent to decimal 1234
618 0x4d2 hexadecimal number, equivalent to decimal 1234
619
620 When using the "chmod" command, you almost always want to specify an
621 octal number for the mode, and you must prefix it with 0 (unlike the
622 Unix chmod(1) program):
623
624 chmod 0777 /public # OK
625 chmod 777 /public # WRONG! This is mode 777 decimal = 01411 octal.
626
627 Commands that return numbers usually print them in decimal, but some
628 commands print numbers in other radices (eg. "umask" prints the mode in
629 octal, preceded by 0).
630
632 Neither guestfish nor the underlying guestfs API performs wildcard
633 expansion (globbing) by default. So for example the following will not
634 do what you expect:
635
636 rm-rf /home/*
637
638 Assuming you don’t have a directory called literally /home/* then the
639 above command will return an error.
640
641 To perform wildcard expansion, use the "glob" command.
642
643 glob rm-rf /home/*
644
645 runs "rm-rf" on each path that matches (ie. potentially running the
646 command many times), equivalent to:
647
648 rm-rf /home/jim
649 rm-rf /home/joe
650 rm-rf /home/mary
651
652 "glob" only works on simple guest paths and not on device names.
653
654 If you have several parameters, each containing a wildcard, then glob
655 will perform a Cartesian product.
656
658 Any line which starts with a # character is treated as a comment and
659 ignored. The # can optionally be preceded by whitespace, but not by a
660 command. For example:
661
662 # this is a comment
663 # this is a comment
664 foo # NOT a comment
665
666 Blank lines are also ignored.
667
669 Any line which starts with a ! character is treated as a command sent
670 to the local shell (/bin/sh or whatever system(3) uses). For example:
671
672 !mkdir local
673 tgz-out /remote local/remote-data.tar.gz
674
675 will create a directory "local" on the host, and then export the
676 contents of /remote on the mounted filesystem to
677 local/remote-data.tar.gz. (See "tgz-out").
678
679 To change the local directory, use the "lcd" command. "!cd" will have
680 no effect, due to the way that subprocesses work in Unix.
681
682 LOCAL COMMANDS WITH INLINE EXECUTION
683 If a line starts with <! then the shell command is executed (as for !),
684 but subsequently any output (stdout) of the shell command is parsed and
685 executed as guestfish commands.
686
687 Thus you can use shell script to construct arbitrary guestfish commands
688 which are then parsed by guestfish.
689
690 For example it is tedious to create a sequence of files (eg. /foo.1
691 through /foo.100) using guestfish commands alone. However this is
692 simple if we use a shell script to create the guestfish commands for
693 us:
694
695 <! for n in `seq 1 100`; do echo write /foo.$n $n; done
696
697 or with names like /foo.001:
698
699 <! for n in `seq 1 100`; do printf "write /foo.%03d %d\n" $n $n; done
700
701 When using guestfish interactively it can be helpful to just run the
702 shell script first (ie. remove the initial "<" character so it is just
703 an ordinary ! local command), see what guestfish commands it would run,
704 and when you are happy with those prepend the "<" character to run the
705 guestfish commands for real.
706
708 Use "command <space> | command" to pipe the output of the first command
709 (a guestfish command) to the second command (any host command). For
710 example:
711
712 cat /etc/passwd | awk -F: '$3 == 0 { print }'
713
714 (where "cat" is the guestfish cat command, but "awk" is the host awk
715 program). The above command would list all accounts in the guest
716 filesystem which have UID 0, ie. root accounts including backdoors.
717 Other examples:
718
719 hexdump /bin/ls | head
720 list-devices | tail -1
721 tgz-out / - | tar ztf -
722
723 The space before the pipe symbol is required, any space after the pipe
724 symbol is optional. Everything after the pipe symbol is just passed
725 straight to the host shell, so it can contain redirections, globs and
726 anything else that makes sense on the host side.
727
728 To use a literal argument which begins with a pipe symbol, you have to
729 quote it, eg:
730
731 echo "|"
732
734 If a parameter starts with the character "~" then the tilde may be
735 expanded as a home directory path (either "~" for the current user's
736 home directory, or "~user" for another user).
737
738 Note that home directory expansion happens for users known on the host,
739 not in the guest filesystem.
740
741 To use a literal argument which begins with a tilde, you have to quote
742 it, eg:
743
744 echo "~"
745
747 Libguestfs has some support for Linux guests encrypted according to the
748 Linux Unified Key Setup (LUKS) standard, which includes nearly all
749 whole disk encryption systems used by modern Linux guests. Currently
750 only LVM-on-LUKS is supported.
751
752 Identify encrypted block devices and partitions using "vfs-type":
753
754 ><fs> vfs-type /dev/sda2
755 crypto_LUKS
756
757 Then open those devices using "luks-open". This creates a device-
758 mapper device called /dev/mapper/luksdev.
759
760 ><fs> luks-open /dev/sda2 luksdev
761 Enter key or passphrase ("key"): <enter the passphrase>
762
763 Finally you have to tell LVM to scan for volume groups on the newly
764 created mapper device:
765
766 vgscan
767 vg-activate-all true
768
769 The logical volume(s) can now be mounted in the usual way.
770
771 Before closing a LUKS device you must unmount any logical volumes on it
772 and deactivate the volume groups by calling "vg-activate false VG" on
773 each one. Then you can close the mapper device:
774
775 vg-activate false /dev/VG
776 luks-close /dev/mapper/luksdev
777
779 If a path is prefixed with "win:" then you can use Windows-style drive
780 letters and paths (with some limitations). The following commands are
781 equivalent:
782
783 file /WINDOWS/system32/config/system.LOG
784
785 file win:\windows\system32\config\system.log
786
787 file WIN:C:\Windows\SYSTEM32\CONFIG\SYSTEM.LOG
788
789 The parameter is rewritten "behind the scenes" by looking up the
790 position where the drive is mounted, prepending that to the path,
791 changing all backslash characters to forward slash, then resolving the
792 result using "case-sensitive-path". For example if the E: drive was
793 mounted on /e then the parameter might be rewritten like this:
794
795 win:e:\foo\bar => /e/FOO/bar
796
797 This only works in argument positions that expect a path.
798
800 For commands such as "upload", "download", "tar-in", "tar-out" and
801 others which upload from or download to a local file, you can use the
802 special filename "-" to mean "from stdin" or "to stdout". For example:
803
804 upload - /foo
805
806 reads stdin and creates from that a file /foo in the disk image, and:
807
808 tar-out /etc - | tar tf -
809
810 writes the tarball to stdout and then pipes that into the external
811 "tar" command (see "PIPES").
812
813 When using "-" to read from stdin, the input is read up to the end of
814 stdin. You can also use a special "heredoc"-like syntax to read up to
815 some arbitrary end marker:
816
817 upload -<<END /foo
818 input line 1
819 input line 2
820 input line 3
821 END
822
823 Any string of characters can be used instead of "END". The end marker
824 must appear on a line of its own, without any preceding or following
825 characters (not even spaces).
826
827 Note that the "-<<" syntax only applies to parameters used to upload
828 local files (so-called "FileIn" parameters in the generator).
829
831 By default, guestfish will ignore any errors when in interactive mode
832 (ie. taking commands from a human over a tty), and will exit on the
833 first error in non-interactive mode (scripts, commands given on the
834 command line).
835
836 If you prefix a command with a - character, then that command will not
837 cause guestfish to exit, even if that (one) command returns an error.
838
840 Guestfish can be remote-controlled over a socket. This is useful
841 particularly in shell scripts where you want to make several different
842 changes to a filesystem, but you don't want the overhead of starting up
843 a guestfish process each time.
844
845 Start a guestfish server process using:
846
847 eval "`guestfish --listen`"
848
849 and then send it commands by doing:
850
851 guestfish --remote cmd [...]
852
853 To cause the server to exit, send it the exit command:
854
855 guestfish --remote exit
856
857 Note that the server will normally exit if there is an error in a
858 command. You can change this in the usual way. See section "EXIT ON
859 ERROR BEHAVIOUR".
860
861 CONTROLLING MULTIPLE GUESTFISH PROCESSES
862 The "eval" statement sets the environment variable $GUESTFISH_PID,
863 which is how the --remote option knows where to send the commands. You
864 can have several guestfish listener processes running using:
865
866 eval "`guestfish --listen`"
867 pid1=$GUESTFISH_PID
868 eval "`guestfish --listen`"
869 pid2=$GUESTFISH_PID
870 ...
871 guestfish --remote=$pid1 cmd
872 guestfish --remote=$pid2 cmd
873
874 REMOTE CONTROL AND CSH
875 When using csh-like shells (csh, tcsh etc) you have to add the --csh
876 option:
877
878 eval "`guestfish --listen --csh`"
879
880 REMOTE CONTROL DETAILS
881 Remote control happens over a Unix domain socket called
882 /tmp/.guestfish-$UID/socket-$PID, where $UID is the effective user ID
883 of the process, and $PID is the process ID of the server.
884
885 Guestfish client and server versions must match exactly.
886
887 Older versions of guestfish were vulnerable to CVE-2013-4419 (see
888 "CVE-2013-4419" in guestfs(3)). This is fixed in the current version.
889
890 USING REMOTE CONTROL ROBUSTLY FROM SHELL SCRIPTS
891 From Bash, you can use the following code which creates a guestfish
892 instance, correctly quotes the command line, handles failure to start,
893 and cleans up guestfish when the script exits:
894
895 #!/bin/bash -
896
897 set -e
898
899 guestfish[0]="guestfish"
900 guestfish[1]="--listen"
901 guestfish[2]="--ro"
902 guestfish[3]="-a"
903 guestfish[4]="disk.img"
904
905 GUESTFISH_PID=
906 eval $("${guestfish[@]}")
907 if [ -z "$GUESTFISH_PID" ]; then
908 echo "error: guestfish didn't start up, see error messages above"
909 exit 1
910 fi
911
912 cleanup_guestfish ()
913 {
914 guestfish --remote -- exit >/dev/null 2>&1 ||:
915 }
916 trap cleanup_guestfish EXIT ERR
917
918 guestfish --remote -- run
919
920 # ...
921
922 REMOTE CONTROL DOES NOT WORK WITH -a ETC. OPTIONS
923 Options such as -a, --add, -N, --new etc don’t interact properly with
924 remote support. They are processed locally, and not sent through to
925 the remote guestfish. In particular this won't do what you expect:
926
927 guestfish --remote --add disk.img
928
929 Don’t use these options. Use the equivalent commands instead, eg:
930
931 guestfish --remote add-drive disk.img
932
933 or:
934
935 guestfish --remote
936 ><fs> add disk.img
937
938 REMOTE CONTROL RUN COMMAND HANGING
939 Using the "run" (or "launch") command remotely in a command
940 substitution context hangs, ie. don't do (note the backquotes):
941
942 a=`guestfish --remote run`
943
944 Since the "run" command produces no output on stdout, this is not
945 useful anyway. For further information see
946 https://bugzilla.redhat.com/show_bug.cgi?id=592910.
947
949 Use the -N [filename=]type or --new [filename=]type parameter to select
950 one of a set of preformatted disk images that guestfish can make for
951 you to save typing. This is particularly useful for testing purposes.
952 This option is used instead of the -a option, and like -a can appear
953 multiple times (and can be mixed with -a).
954
955 The new disk is called test1.img for the first -N, test2.img for the
956 second and so on. Existing files in the current directory are
957 overwritten. You can use a different filename by specifying
958 "filename=" before the type (see examples below).
959
960 The type briefly describes how the disk should be sized, partitioned,
961 how filesystem(s) should be created, and how content should be added.
962 Optionally the type can be followed by extra parameters, separated by
963 ":" (colon) characters. For example, -N fs creates a default 1G,
964 sparsely-allocated disk, containing a single partition, with the
965 partition formatted as ext2. -N fs:ext4:2G is the same, but for an
966 ext4 filesystem on a 2GB disk instead.
967
968 Note that the prepared filesystem is not mounted. You would usually
969 have to use the "mount /dev/sda1 /" command or add the -m /dev/sda1
970 option.
971
972 If any -N or --new options are given, the libguestfs appliance is
973 automatically launched.
974
975 EXAMPLES
976 Create a 1G disk with an ext4-formatted partition, called test1.img in
977 the current directory:
978
979 guestfish -N fs:ext4
980
981 Create a 32MB disk with a VFAT-formatted partition, and mount it:
982
983 guestfish -N fs:vfat:32M -m /dev/sda1
984
985 Create a blank 200MB disk:
986
987 guestfish -N disk:200M
988
989 Create a blank 200MB disk called blankdisk.img (instead of test1.img):
990
991 guestfish -N blankdisk.img=disk:200M
992
993 -N disk - create a blank disk
994 "guestfish -N [filename=]disk[:size]"
995
996 Create a blank disk, size 1G (by default).
997
998 The default size can be changed by supplying an optional parameter.
999
1000 The optional parameters are:
1001
1002 Name Default value
1003 size 1G the size of the disk image
1004
1005 -N part - create a partitioned disk
1006 "guestfish -N [filename=]part[:size[:partition]]"
1007
1008 Create a disk with a single partition. By default the size of the disk
1009 is 1G (the available space in the partition will be a tiny bit smaller)
1010 and the partition table will be MBR (old DOS-style).
1011
1012 These defaults can be changed by supplying optional parameters.
1013
1014 The optional parameters are:
1015
1016 Name Default value
1017 size 1G the size of the disk image
1018 partition mbr partition table type
1019
1020 -N fs - create a filesystem
1021 "guestfish -N [filename=]fs[:filesystem[:size[:partition]]]"
1022
1023 Create a disk with a single partition, with the partition containing an
1024 empty filesystem. This defaults to creating a 1G disk (the available
1025 space in the filesystem will be a tiny bit smaller) with an MBR (old
1026 DOS-style) partition table and an ext2 filesystem.
1027
1028 These defaults can be changed by supplying optional parameters.
1029
1030 The optional parameters are:
1031
1032 Name Default value
1033 filesystem ext2 the type of filesystem to use
1034 size 1G the size of the disk image
1035 partition mbr partition table type
1036
1037 -N lv - create a disk with logical volume
1038 "guestfish -N [filename=]lv[:name[:size[:partition]]]"
1039
1040 Create a disk with a single partition, set up the partition as an LVM2
1041 physical volume, and place a volume group and logical volume on there.
1042 This defaults to creating a 1G disk with the VG and LV called
1043 "/dev/VG/LV". You can change the name of the VG and LV by supplying an
1044 alternate name as the first optional parameter.
1045
1046 Note this does not create a filesystem. Use 'lvfs' to do that.
1047
1048 The optional parameters are:
1049
1050 Name Default value
1051 name /dev/VG/LV the name of the VG and LV to use
1052 size 1G the size of the disk image
1053 partition mbr partition table type
1054
1055 -N lvfs - create a disk with logical volume and filesystem
1056 "guestfish -N [filename=]lvfs[:name[:filesystem[:size[:partition]]]]"
1057
1058 Create a disk with a single partition, set up the partition as an LVM2
1059 physical volume, and place a volume group and logical volume on there.
1060 Then format the LV with a filesystem. This defaults to creating a 1G
1061 disk with the VG and LV called "/dev/VG/LV", with an ext2 filesystem.
1062
1063 The optional parameters are:
1064
1065 Name Default value
1066 name /dev/VG/LV the name of the VG and LV to use
1067 filesystem ext2 the type of filesystem to use
1068 size 1G the size of the disk image
1069 partition mbr partition table type
1070
1071 -N bootroot - create a boot and root filesystem
1072 "guestfish -N
1073 [filename=]bootroot[:bootfs[:rootfs[:size[:bootsize[:partition]]]]]"
1074
1075 Create a disk with two partitions, for boot and root filesystem.
1076 Format the two filesystems independently. There are several optional
1077 parameters which control the exact layout and filesystem types.
1078
1079 The optional parameters are:
1080
1081 Name Default value
1082 bootfs ext2 the type of filesystem to use for boot
1083 rootfs ext2 the type of filesystem to use for root
1084 size 1G the size of the disk image
1085 bootsize 128M the size of the boot filesystem
1086 partition mbr partition table type
1087
1088 -N bootrootlv - create a boot and root filesystem using LVM
1089 "guestfish -N
1090 [filename=]bootrootlv[:name[:bootfs[:rootfs[:size[:bootsize[:partition]]]]]]"
1091
1092 This is the same as "bootroot" but the root filesystem (only) is placed
1093 on a logical volume, named by default "/dev/VG/LV". There are several
1094 optional parameters which control the exact layout.
1095
1096 The optional parameters are:
1097
1098 Name Default value
1099 name /dev/VG/LV the name of the VG and LV for root
1100 bootfs ext2 the type of filesystem to use for boot
1101 rootfs ext2 the type of filesystem to use for root
1102 size 1G the size of the disk image
1103 bootsize 128M the size of the boot filesystem
1104 partition mbr partition table type
1105
1107 For API-level documentation on this topic, see "guestfs_add_drive_opts"
1108 in guestfs(3) and "REMOTE STORAGE" in guestfs(3).
1109
1110 On the command line, you can use the -a option to add network block
1111 devices using a URI-style format, for example:
1112
1113 guestfish -a ssh://root@example.com/disk.img
1114
1115 URIs cannot be used with the "add" command. The equivalent command
1116 using the API directly is:
1117
1118 ><fs> add /disk.img protocol:ssh server:tcp:example.com username:root
1119
1120 The possible -a URI formats are described below.
1121
1122 -a disk.img
1123 -a file:///path/to/disk.img
1124 Add the local disk image (or device) called disk.img.
1125
1126 -a ftp://[user@]example.com[:port]/disk.img
1127 -a ftps://[user@]example.com[:port]/disk.img
1128 -a http://[user@]example.com[:port]/disk.img
1129 -a https://[user@]example.com[:port]/disk.img
1130 -a tftp://[user@]example.com[:port]/disk.img
1131 Add a disk located on a remote FTP, HTTP or TFTP server.
1132
1133 The equivalent API command would be:
1134
1135 ><fs> add /disk.img protocol:(ftp|...) server:tcp:example.com
1136
1137 -a gluster://example.com[:port]/volname/image
1138 Add a disk image located on GlusterFS storage.
1139
1140 The server is the one running "glusterd", and may be "localhost".
1141
1142 The equivalent API command would be:
1143
1144 ><fs> add volname/image protocol:gluster server:tcp:example.com
1145
1146 -a iscsi://example.com[:port]/target-iqn-name[/lun]
1147 Add a disk located on an iSCSI server.
1148
1149 The equivalent API command would be:
1150
1151 ><fs> add target-iqn-name/lun protocol:iscsi server:tcp:example.com
1152
1153 -a nbd://example.com[:port]
1154 -a nbd://example.com[:port]/exportname
1155 -a nbd://?socket=/socket
1156 -a nbd:///exportname?socket=/socket
1157 Add a disk located on Network Block Device (nbd) storage.
1158
1159 The /exportname part of the URI specifies an NBD export name, but is
1160 usually left empty.
1161
1162 The optional ?socket parameter can be used to specify a Unix domain
1163 socket that we talk to the NBD server over. Note that you cannot mix
1164 server name (ie. TCP/IP) and socket path.
1165
1166 The equivalent API command would be (no export name):
1167
1168 ><fs> add "" protocol:nbd server:[tcp:example.com|unix:/socket]
1169
1170 -a rbd:///pool/disk
1171 -a rbd://example.com[:port]/pool/disk
1172 Add a disk image located on a Ceph (RBD/librbd) storage volume.
1173
1174 Although libguestfs and Ceph supports multiple servers, only a single
1175 server can be specified when using this URI syntax.
1176
1177 The equivalent API command would be:
1178
1179 ><fs> add pool/disk protocol:rbd server:tcp:example.com:port
1180
1181 -a sheepdog://[example.com[:port]]/volume/image
1182 Add a disk image located on a Sheepdog volume.
1183
1184 The server name is optional. Although libguestfs and Sheepdog supports
1185 multiple servers, only at most one server can be specified when using
1186 this URI syntax.
1187
1188 The equivalent API command would be:
1189
1190 ><fs> add volume protocol:sheepdog [server:tcp:example.com]
1191
1192 -a ssh://[user@]example.com[:port]/disk.img
1193 Add a disk image located on a remote server, accessed using the Secure
1194 Shell (ssh) SFTP protocol. SFTP is supported out of the box by all
1195 major SSH servers.
1196
1197 The equivalent API command would be:
1198
1199 ><fs> add /disk protocol:ssh server:tcp:example.com [username:user]
1200
1201 Note that the URIs follow the syntax of RFC 3986: in particular, there
1202 are restrictions on the allowed characters for the various components
1203 of the URI. Characters such as ":", "@", and "/" must be percent-
1204 encoded:
1205
1206 $ guestfish -a ssh://user:pass%40word@example.com/disk.img
1207
1208 In this case, the password is "pass@word".
1209
1211 Some (not all) long-running commands send progress notification
1212 messages as they are running. Guestfish turns these messages into
1213 progress bars.
1214
1215 When a command that supports progress bars takes longer than two
1216 seconds to run, and if progress bars are enabled, then you will see one
1217 appearing below the command:
1218
1219 ><fs> copy-size /large-file /another-file 2048M
1220 / 10% [#####-----------------------------------------] 00:30
1221
1222 The spinner on the left hand side moves round once for every progress
1223 notification received from the backend. This is a (reasonably) golden
1224 assurance that the command is "doing something" even if the progress
1225 bar is not moving, because the command is able to send the progress
1226 notifications. When the bar reaches 100% and the command finishes, the
1227 spinner disappears.
1228
1229 Progress bars are enabled by default when guestfish is used
1230 interactively. You can enable them even for non-interactive modes
1231 using --progress-bars, and you can disable them completely using
1232 --no-progress-bars.
1233
1235 You can change or add colours to the default prompt ("><fs>") by
1236 setting the "GUESTFISH_PS1" environment variable. A second string
1237 ("GUESTFISH_OUTPUT") is printed after the command has been entered and
1238 before the output, allowing you to control the colour of the output. A
1239 third string ("GUESTFISH_INIT") is printed before the welcome message,
1240 allowing you to control the colour of that message. A fourth string
1241 ("GUESTFISH_RESTORE") is printed before guestfish exits.
1242
1243 A simple prompt can be set by setting "GUESTFISH_PS1" to an alternate
1244 string:
1245
1246 $ GUESTFISH_PS1='(type a command) '
1247 $ export GUESTFISH_PS1
1248 $ guestfish
1249 [...]
1250 (type a command) ▂
1251
1252 You can also use special escape sequences, as described in the table
1253 below:
1254
1255 \\ A literal backslash character.
1256
1257 \[
1258 \] (These should only be used in "GUESTFISH_PS1".)
1259
1260 Place non-printing characters (eg. terminal control codes for
1261 colours) between "\[...\]". What this does it to tell the
1262 readline(3) library that it should treat this subsequence as zero-
1263 width, so that command-line redisplay, editing etc works.
1264
1265 \a A bell character.
1266
1267 \e An ASCII ESC (escape) character.
1268
1269 \n A newline.
1270
1271 \r A carriage return.
1272
1273 \NNN
1274 The ASCII character whose code is the octal value NNN.
1275
1276 \xNN
1277 The ASCII character whose code is the hex value NN.
1278
1279 EXAMPLES OF PROMPTS
1280 Note that these examples require a terminal that supports ANSI escape
1281 codes.
1282
1283 ·
1284
1285
1286 GUESTFISH_PS1='\[\e[1;30m\]><fs>\[\e[0;30m\] '
1287
1288 A bold black version of the ordinary prompt.
1289
1290 ·
1291
1292
1293 GUESTFISH_PS1='\[\e[1;32m\]><fs>\[\e[0;31m\] '
1294 GUESTFISH_OUTPUT='\e[0m'
1295 GUESTFISH_RESTORE="$GUESTFISH_OUTPUT"
1296 GUESTFISH_INIT='\e[1;34m'
1297
1298 Blue welcome text, green prompt, red commands, black command
1299 output.
1300
1302 Windows 8 "fast startup" can prevent guestfish from mounting NTFS
1303 partitions. See "WINDOWS HIBERNATION AND WINDOWS 8 FAST STARTUP" in
1304 guestfs(3).
1305
1307 The commands in this section are guestfish convenience commands, in
1308 other words, they are not part of the guestfs(3) API.
1309
1310 help
1311 help
1312 help cmd
1313 help -l|--list
1314
1315 Without any parameter, this provides general help.
1316
1317 With a "cmd" parameter, this displays detailed help for that command.
1318
1319 With -l or --list, this list all commands.
1320
1321 exit
1322 quit
1323 This exits guestfish. You can also use "^D" key.
1324
1325 alloc
1326 allocate
1327 alloc filename size
1328
1329 This creates an empty (zeroed) file of the given size, and then adds so
1330 it can be further examined.
1331
1332 For more advanced image creation, see "disk-create".
1333
1334 Size can be specified using standard suffixes, eg. "1M".
1335
1336 To create a sparse file, use "sparse" instead. To create a prepared
1337 disk image, see "PREPARED DISK IMAGES".
1338
1339 copy-in
1340 copy-in local [local ...] /remotedir
1341
1342 "copy-in" copies local files or directories recursively into the disk
1343 image, placing them in the directory called /remotedir (which must
1344 exist). This guestfish meta-command turns into a sequence of "tar-in"
1345 and other commands as necessary.
1346
1347 Multiple local files and directories can be specified, but the last
1348 parameter must always be a remote directory. Wildcards cannot be used.
1349
1350 copy-out
1351 copy-out remote [remote ...] localdir
1352
1353 "copy-out" copies remote files or directories recursively out of the
1354 disk image, placing them on the host disk in a local directory called
1355 "localdir" (which must exist). This guestfish meta-command turns into
1356 a sequence of "download", "tar-out" and other commands as necessary.
1357
1358 Multiple remote files and directories can be specified, but the last
1359 parameter must always be a local directory. To download to the current
1360 directory, use "." as in:
1361
1362 copy-out /home .
1363
1364 Wildcards cannot be used in the ordinary command, but you can use them
1365 with the help of "glob" like this:
1366
1367 glob copy-out /home/* .
1368
1369 delete-event
1370 delete-event name
1371
1372 Delete the event handler which was previously registered as "name". If
1373 multiple event handlers were registered with the same name, they are
1374 all deleted.
1375
1376 See also the guestfish commands "event" and "list-events".
1377
1378 display
1379 display filename
1380
1381 Use "display" (a graphical display program) to display an image file.
1382 It downloads the file, and runs "display" on it.
1383
1384 To use an alternative program, set the "GUESTFISH_DISPLAY_IMAGE"
1385 environment variable. For example to use the GNOME display program:
1386
1387 export GUESTFISH_DISPLAY_IMAGE=eog
1388
1389 See also display(1).
1390
1391 echo
1392 echo [params ...]
1393
1394 This echos the parameters to the terminal.
1395
1396 edit
1397 vi
1398 emacs
1399 edit filename
1400
1401 This is used to edit a file. It downloads the file, edits it locally
1402 using your editor, then uploads the result.
1403
1404 The editor is $EDITOR. However if you use the alternate commands "vi"
1405 or "emacs" you will get those corresponding editors.
1406
1407 event
1408 event name eventset "shell script ..."
1409
1410 Register a shell script fragment which is executed when an event is
1411 raised. See "guestfs_set_event_callback" in guestfs(3) for a
1412 discussion of the event API in libguestfs.
1413
1414 The "name" parameter is a name that you give to this event handler. It
1415 can be any string (even the empty string) and is simply there so you
1416 can delete the handler using the guestfish "delete-event" command.
1417
1418 The "eventset" parameter is a comma-separated list of one or more
1419 events, for example "close" or "close,trace". The special value "*"
1420 means all events.
1421
1422 The third and final parameter is the shell script fragment (or any
1423 external command) that is executed when any of the events in the
1424 eventset occurs. It is executed using "$SHELL -c", or if $SHELL is not
1425 set then /bin/sh -c.
1426
1427 The shell script fragment receives callback parameters as arguments $1,
1428 $2 etc. The actual event that was called is available in the
1429 environment variable $EVENT.
1430
1431 event "" close "echo closed"
1432 event messages appliance,library,trace "echo $@"
1433 event "" progress "echo progress: $3/$4"
1434 event "" * "echo $EVENT $@"
1435
1436 See also the guestfish commands "delete-event" and "list-events".
1437
1438 glob
1439 glob command args...
1440
1441 Expand wildcards in any paths in the args list, and run "command"
1442 repeatedly on each matching path.
1443
1444 See "WILDCARDS AND GLOBBING".
1445
1446 hexedit
1447 hexedit <filename|device>
1448 hexedit <filename|device> <max>
1449 hexedit <filename|device> <start> <max>
1450
1451 Use hexedit (a hex editor) to edit all or part of a binary file or
1452 block device.
1453
1454 This command works by downloading potentially the whole file or device,
1455 editing it locally, then uploading it. If the file or device is large,
1456 you have to specify which part you wish to edit by using "max" and/or
1457 "start" "max" parameters. "start" and "max" are specified in bytes,
1458 with the usual modifiers allowed such as "1M" (1 megabyte).
1459
1460 For example to edit the first few sectors of a disk you might do:
1461
1462 hexedit /dev/sda 1M
1463
1464 which would allow you to edit anywhere within the first megabyte of the
1465 disk.
1466
1467 To edit the superblock of an ext2 filesystem on /dev/sda1, do:
1468
1469 hexedit /dev/sda1 0x400 0x400
1470
1471 (assuming the superblock is in the standard location).
1472
1473 This command requires the external hexedit(1) program. You can specify
1474 another program to use by setting the "HEXEDITOR" environment variable.
1475
1476 See also "hexdump".
1477
1478 lcd
1479 lcd directory
1480
1481 Change the local directory, ie. the current directory of guestfish
1482 itself.
1483
1484 Note that "!cd" won't do what you might expect.
1485
1486 list-events
1487 list-events
1488
1489 List the event handlers registered using the guestfish "event" command.
1490
1491 man
1492 manual
1493 man
1494
1495 Opens the manual page for guestfish.
1496
1497 more
1498 less
1499 more filename
1500
1501 less filename
1502
1503 This is used to view a file.
1504
1505 The default viewer is $PAGER. However if you use the alternate command
1506 "less" you will get the "less" command specifically.
1507
1508 reopen
1509 reopen
1510
1511 Close and reopen the libguestfs handle. It is not necessary to use
1512 this normally, because the handle is closed properly when guestfish
1513 exits. However this is occasionally useful for testing.
1514
1515 setenv
1516 setenv VAR value
1517
1518 Set the environment variable "VAR" to the string "value".
1519
1520 To print the value of an environment variable use a shell command such
1521 as:
1522
1523 !echo $VAR
1524
1525 sparse
1526 sparse filename size
1527
1528 This creates an empty sparse file of the given size, and then adds so
1529 it can be further examined.
1530
1531 In all respects it works the same as the "alloc" command, except that
1532 the image file is allocated sparsely, which means that disk blocks are
1533 not assigned to the file until they are needed. Sparse disk files only
1534 use space when written to, but they are slower and there is a danger
1535 you could run out of real disk space during a write operation.
1536
1537 For more advanced image creation, see "disk-create".
1538
1539 Size can be specified using standard suffixes, eg. "1M".
1540
1541 See also the guestfish "scratch" command.
1542
1543 supported
1544 supported
1545
1546 This command returns a list of the optional groups known to the daemon,
1547 and indicates which ones are supported by this build of the libguestfs
1548 appliance.
1549
1550 See also "AVAILABILITY" in guestfs(3).
1551
1552 time
1553 time command args...
1554
1555 Run the command as usual, but print the elapsed time afterwards. This
1556 can be useful for benchmarking operations.
1557
1558 unsetenv
1559 unsetenv VAR
1560
1561 Remove "VAR" from the environment.
1562
1564 acl-delete-def-file
1565 acl-delete-def-file dir
1566
1567 This function deletes the default POSIX Access Control List (ACL)
1568 attached to directory "dir".
1569
1570 This command depends on the feature "acl". See also "feature-
1571 available".
1572
1573 acl-get-file
1574 acl-get-file path acltype
1575
1576 This function returns the POSIX Access Control List (ACL) attached to
1577 "path". The ACL is returned in "long text form" (see acl(5)).
1578
1579 The "acltype" parameter may be:
1580
1581 "access"
1582 Return the ordinary (access) ACL for any file, directory or other
1583 filesystem object.
1584
1585 "default"
1586 Return the default ACL. Normally this only makes sense if "path"
1587 is a directory.
1588
1589 This command depends on the feature "acl". See also "feature-
1590 available".
1591
1592 acl-set-file
1593 acl-set-file path acltype acl
1594
1595 This function sets the POSIX Access Control List (ACL) attached to
1596 "path".
1597
1598 The "acltype" parameter may be:
1599
1600 "access"
1601 Set the ordinary (access) ACL for any file, directory or other
1602 filesystem object.
1603
1604 "default"
1605 Set the default ACL. Normally this only makes sense if "path" is a
1606 directory.
1607
1608 The "acl" parameter is the new ACL in either "long text form" or "short
1609 text form" (see acl(5)). The new ACL completely replaces any previous
1610 ACL on the file. The ACL must contain the full Unix permissions (eg.
1611 "u::rwx,g::rx,o::rx").
1612
1613 If you are specifying individual users or groups, then the mask field
1614 is also required (eg. "m::rwx"), followed by the "u:ID:..." and/or
1615 "g:ID:..." field(s). A full ACL string might therefore look like this:
1616
1617 u::rwx,g::rwx,o::rwx,m::rwx,u:500:rwx,g:500:rwx
1618 \ Unix permissions / \mask/ \ ACL /
1619
1620 You should use numeric UIDs and GIDs. To map usernames and groupnames
1621 to the correct numeric ID in the context of the guest, use the Augeas
1622 functions (see "aug-init").
1623
1624 This command depends on the feature "acl". See also "feature-
1625 available".
1626
1627 add-cdrom
1628 add-cdrom filename
1629
1630 This function adds a virtual CD-ROM disk image to the guest.
1631
1632 The image is added as read-only drive, so this function is equivalent
1633 of "add-drive-ro".
1634
1635 This function is deprecated. In new code, use the "add-drive-ro" call
1636 instead.
1637
1638 Deprecated functions will not be removed from the API, but the fact
1639 that they are deprecated indicates that there are problems with correct
1640 use of these functions.
1641
1642 add-domain
1643 domain
1644 add-domain dom [libvirturi:..] [readonly:true|false] [iface:..] [live:true|false] [allowuuid:true|false] [readonlydisk:..] [cachemode:..] [discard:..] [copyonread:true|false]
1645
1646 This function adds the disk(s) attached to the named libvirt domain
1647 "dom". It works by connecting to libvirt, requesting the domain and
1648 domain XML from libvirt, parsing it for disks, and calling "add-drive-
1649 opts" on each one.
1650
1651 The number of disks added is returned. This operation is atomic: if an
1652 error is returned, then no disks are added.
1653
1654 This function does some minimal checks to make sure the libvirt domain
1655 is not running (unless "readonly" is true). In a future version we
1656 will try to acquire the libvirt lock on each disk.
1657
1658 Disks must be accessible locally. This often means that adding disks
1659 from a remote libvirt connection (see http://libvirt.org/remote.html)
1660 will fail unless those disks are accessible via the same device path
1661 locally too.
1662
1663 The optional "libvirturi" parameter sets the libvirt URI (see
1664 http://libvirt.org/uri.html). If this is not set then we connect to
1665 the default libvirt URI (or one set through an environment variable,
1666 see the libvirt documentation for full details).
1667
1668 The optional "live" flag controls whether this call will try to connect
1669 to a running virtual machine "guestfsd" process if it sees a suitable
1670 <channel> element in the libvirt XML definition. The default (if the
1671 flag is omitted) is never to try. See "ATTACHING TO RUNNING DAEMONS"
1672 in guestfs(3) for more information.
1673
1674 If the "allowuuid" flag is true (default is false) then a UUID may be
1675 passed instead of the domain name. The "dom" string is treated as a
1676 UUID first and looked up, and if that lookup fails then we treat "dom"
1677 as a name as usual.
1678
1679 The optional "readonlydisk" parameter controls what we do for disks
1680 which are marked <readonly/> in the libvirt XML. Possible values are:
1681
1682 readonlydisk = "error"
1683 If "readonly" is false:
1684
1685 The whole call is aborted with an error if any disk with the
1686 <readonly/> flag is found.
1687
1688 If "readonly" is true:
1689
1690 Disks with the <readonly/> flag are added read-only.
1691
1692 readonlydisk = "read"
1693 If "readonly" is false:
1694
1695 Disks with the <readonly/> flag are added read-only. Other disks
1696 are added read/write.
1697
1698 If "readonly" is true:
1699
1700 Disks with the <readonly/> flag are added read-only.
1701
1702 readonlydisk = "write" (default)
1703 If "readonly" is false:
1704
1705 Disks with the <readonly/> flag are added read/write.
1706
1707 If "readonly" is true:
1708
1709 Disks with the <readonly/> flag are added read-only.
1710
1711 readonlydisk = "ignore"
1712 If "readonly" is true or false:
1713
1714 Disks with the <readonly/> flag are skipped.
1715
1716 The other optional parameters are passed directly through to "add-
1717 drive-opts".
1718
1719 This command has one or more optional arguments. See "OPTIONAL
1720 ARGUMENTS".
1721
1722 add-drive
1723 add
1724 add-drive-opts
1725 add-drive filename [readonly:true|false] [format:..] [iface:..] [name:..] [label:..] [protocol:..] [server:..] [username:..] [secret:..] [cachemode:..] [discard:..] [copyonread:true|false]
1726
1727 This function adds a disk image called filename to the handle.
1728 filename may be a regular host file or a host device.
1729
1730 When this function is called before "launch" (the usual case) then the
1731 first time you call this function, the disk appears in the API as
1732 /dev/sda, the second time as /dev/sdb, and so on.
1733
1734 In libguestfs ≥ 1.20 you can also call this function after launch (with
1735 some restrictions). This is called "hotplugging". When hotplugging,
1736 you must specify a "label" so that the new disk gets a predictable
1737 name. For more information see "HOTPLUGGING" in guestfs(3).
1738
1739 You don't necessarily need to be root when using libguestfs. However
1740 you obviously do need sufficient permissions to access the filename for
1741 whatever operations you want to perform (ie. read access if you just
1742 want to read the image or write access if you want to modify the
1743 image).
1744
1745 This call checks that filename exists.
1746
1747 filename may be the special string "/dev/null". See "NULL DISKS" in
1748 guestfs(3).
1749
1750 The optional arguments are:
1751
1752 "readonly"
1753 If true then the image is treated as read-only. Writes are still
1754 allowed, but they are stored in a temporary snapshot overlay which
1755 is discarded at the end. The disk that you add is not modified.
1756
1757 "format"
1758 This forces the image format. If you omit this (or use "add-drive"
1759 or "add-drive-ro") then the format is automatically detected.
1760 Possible formats include "raw" and "qcow2".
1761
1762 Automatic detection of the format opens you up to a potential
1763 security hole when dealing with untrusted raw-format images. See
1764 CVE-2010-3851 and RHBZ#642934. Specifying the format closes this
1765 security hole.
1766
1767 "iface"
1768 This rarely-used option lets you emulate the behaviour of the
1769 deprecated "add-drive-with-if" call (q.v.)
1770
1771 "name"
1772 The name the drive had in the original guest, e.g. /dev/sdb. This
1773 is used as a hint to the guest inspection process if it is
1774 available.
1775
1776 "label"
1777 Give the disk a label. The label should be a unique, short string
1778 using only ASCII characters "[a-zA-Z]". As well as its usual name
1779 in the API (such as /dev/sda), the drive will also be named
1780 /dev/disk/guestfs/label.
1781
1782 See "DISK LABELS" in guestfs(3).
1783
1784 "protocol"
1785 The optional protocol argument can be used to select an alternate
1786 source protocol.
1787
1788 See also: "REMOTE STORAGE" in guestfs(3).
1789
1790 "protocol = "file""
1791 filename is interpreted as a local file or device. This is the
1792 default if the optional protocol parameter is omitted.
1793
1794 "protocol = "ftp"|"ftps"|"http"|"https"|"tftp""
1795 Connect to a remote FTP, HTTP or TFTP server. The "server"
1796 parameter must also be supplied - see below.
1797
1798 See also: "FTP, HTTP AND TFTP" in guestfs(3)
1799
1800 "protocol = "gluster""
1801 Connect to the GlusterFS server. The "server" parameter must
1802 also be supplied - see below.
1803
1804 See also: "GLUSTER" in guestfs(3)
1805
1806 "protocol = "iscsi""
1807 Connect to the iSCSI server. The "server" parameter must also
1808 be supplied - see below. The "username" parameter may be
1809 supplied. See below. The "secret" parameter may be supplied.
1810 See below.
1811
1812 See also: "ISCSI" in guestfs(3).
1813
1814 "protocol = "nbd""
1815 Connect to the Network Block Device server. The "server"
1816 parameter must also be supplied - see below.
1817
1818 See also: "NETWORK BLOCK DEVICE" in guestfs(3).
1819
1820 "protocol = "rbd""
1821 Connect to the Ceph (librbd/RBD) server. The "server"
1822 parameter must also be supplied - see below. The "username"
1823 parameter may be supplied. See below. The "secret" parameter
1824 may be supplied. See below.
1825
1826 See also: "CEPH" in guestfs(3).
1827
1828 "protocol = "sheepdog""
1829 Connect to the Sheepdog server. The "server" parameter may
1830 also be supplied - see below.
1831
1832 See also: "SHEEPDOG" in guestfs(3).
1833
1834 "protocol = "ssh""
1835 Connect to the Secure Shell (ssh) server.
1836
1837 The "server" parameter must be supplied. The "username"
1838 parameter may be supplied. See below.
1839
1840 See also: "SSH" in guestfs(3).
1841
1842 "server"
1843 For protocols which require access to a remote server, this is a
1844 list of server(s).
1845
1846 Protocol Number of servers required
1847 -------- --------------------------
1848 file List must be empty or param not used at all
1849 ftp|ftps|http|https|tftp Exactly one
1850 gluster Exactly one
1851 iscsi Exactly one
1852 nbd Exactly one
1853 rbd Zero or more
1854 sheepdog Zero or more
1855 ssh Exactly one
1856
1857 Each list element is a string specifying a server. The string must
1858 be in one of the following formats:
1859
1860 hostname
1861 hostname:port
1862 tcp:hostname
1863 tcp:hostname:port
1864 unix:/path/to/socket
1865
1866 If the port number is omitted, then the standard port number for
1867 the protocol is used (see /etc/services).
1868
1869 "username"
1870 For the "ftp", "ftps", "http", "https", "iscsi", "rbd", "ssh" and
1871 "tftp" protocols, this specifies the remote username.
1872
1873 If not given, then the local username is used for "ssh", and no
1874 authentication is attempted for ceph. But note this sometimes may
1875 give unexpected results, for example if using the libvirt backend
1876 and if the libvirt backend is configured to start the qemu
1877 appliance as a special user such as "qemu.qemu". If in doubt,
1878 specify the remote username you want.
1879
1880 "secret"
1881 For the "rbd" protocol only, this specifies the ‘secret’ to use
1882 when connecting to the remote device. It must be base64 encoded.
1883
1884 If not given, then a secret matching the given username will be
1885 looked up in the default keychain locations, or if no username is
1886 given, then no authentication will be used.
1887
1888 "cachemode"
1889 Choose whether or not libguestfs will obey sync operations (safe
1890 but slow) or not (unsafe but fast). The possible values for this
1891 string are:
1892
1893 "cachemode = "writeback""
1894 This is the default.
1895
1896 Write operations in the API do not return until a write(2) call
1897 has completed in the host [but note this does not imply that
1898 anything gets written to disk].
1899
1900 Sync operations in the API, including implicit syncs caused by
1901 filesystem journalling, will not return until an fdatasync(2)
1902 call has completed in the host, indicating that data has been
1903 committed to disk.
1904
1905 "cachemode = "unsafe""
1906 In this mode, there are no guarantees. Libguestfs may cache
1907 anything and ignore sync requests. This is suitable only for
1908 scratch or temporary disks.
1909
1910 "discard"
1911 Enable or disable discard (a.k.a. trim or unmap) support on this
1912 drive. If enabled, operations such as "fstrim" will be able to
1913 discard / make thin / punch holes in the underlying host file or
1914 device.
1915
1916 Possible discard settings are:
1917
1918 "discard = "disable""
1919 Disable discard support. This is the default.
1920
1921 "discard = "enable""
1922 Enable discard support. Fail if discard is not possible.
1923
1924 "discard = "besteffort""
1925 Enable discard support if possible, but don't fail if it is not
1926 supported.
1927
1928 Since not all backends and not all underlying systems support
1929 discard, this is a good choice if you want to use discard if
1930 possible, but don't mind if it doesn't work.
1931
1932 "copyonread"
1933 The boolean parameter "copyonread" enables copy-on-read support.
1934 This only affects disk formats which have backing files, and causes
1935 reads to be stored in the overlay layer, speeding up multiple reads
1936 of the same area of disk.
1937
1938 The default is false.
1939
1940 This command has one or more optional arguments. See "OPTIONAL
1941 ARGUMENTS".
1942
1943 add-drive-ro
1944 add-ro
1945 add-drive-ro filename
1946
1947 This function is the equivalent of calling "add-drive-opts" with the
1948 optional parameter "GUESTFS_ADD_DRIVE_OPTS_READONLY" set to 1, so the
1949 disk is added read-only, with the format being detected automatically.
1950
1951 add-drive-ro-with-if
1952 add-drive-ro-with-if filename iface
1953
1954 This is the same as "add-drive-ro" but it allows you to specify the
1955 QEMU interface emulation to use at run time.
1956
1957 This function is deprecated. In new code, use the "add-drive" call
1958 instead.
1959
1960 Deprecated functions will not be removed from the API, but the fact
1961 that they are deprecated indicates that there are problems with correct
1962 use of these functions.
1963
1964 add-drive-scratch
1965 scratch
1966 add-drive-scratch size [name:..] [label:..]
1967
1968 This command adds a temporary scratch drive to the handle. The "size"
1969 parameter is the virtual size (in bytes). The scratch drive is blank
1970 initially (all reads return zeroes until you start writing to it). The
1971 drive is deleted when the handle is closed.
1972
1973 The optional arguments "name" and "label" are passed through to "add-
1974 drive".
1975
1976 This command has one or more optional arguments. See "OPTIONAL
1977 ARGUMENTS".
1978
1979 add-drive-with-if
1980 add-drive-with-if filename iface
1981
1982 This is the same as "add-drive" but it allows you to specify the QEMU
1983 interface emulation to use at run time.
1984
1985 This function is deprecated. In new code, use the "add-drive" call
1986 instead.
1987
1988 Deprecated functions will not be removed from the API, but the fact
1989 that they are deprecated indicates that there are problems with correct
1990 use of these functions.
1991
1992 aug-clear
1993 aug-clear augpath
1994
1995 Set the value associated with "path" to "NULL". This is the same as
1996 the augtool(1) "clear" command.
1997
1998 aug-close
1999 aug-close
2000
2001 Close the current Augeas handle and free up any resources used by it.
2002 After calling this, you have to call "aug-init" again before you can
2003 use any other Augeas functions.
2004
2005 aug-defnode
2006 aug-defnode name expr val
2007
2008 Defines a variable "name" whose value is the result of evaluating
2009 "expr".
2010
2011 If "expr" evaluates to an empty nodeset, a node is created, equivalent
2012 to calling "aug-set" "expr", "value". "name" will be the nodeset
2013 containing that single node.
2014
2015 On success this returns a pair containing the number of nodes in the
2016 nodeset, and a boolean flag if a node was created.
2017
2018 aug-defvar
2019 aug-defvar name expr
2020
2021 Defines an Augeas variable "name" whose value is the result of
2022 evaluating "expr". If "expr" is NULL, then "name" is undefined.
2023
2024 On success this returns the number of nodes in "expr", or 0 if "expr"
2025 evaluates to something which is not a nodeset.
2026
2027 aug-get
2028 aug-get augpath
2029
2030 Look up the value associated with "path". If "path" matches exactly
2031 one node, the "value" is returned.
2032
2033 aug-init
2034 aug-init root flags
2035
2036 Create a new Augeas handle for editing configuration files. If there
2037 was any previous Augeas handle associated with this guestfs session,
2038 then it is closed.
2039
2040 You must call this before using any other "aug-*" commands.
2041
2042 "root" is the filesystem root. "root" must not be NULL, use / instead.
2043
2044 The flags are the same as the flags defined in <augeas.h>, the logical
2045 or of the following integers:
2046
2047 "AUG_SAVE_BACKUP" = 1
2048 Keep the original file with a ".augsave" extension.
2049
2050 "AUG_SAVE_NEWFILE" = 2
2051 Save changes into a file with extension ".augnew", and do not
2052 overwrite original. Overrides "AUG_SAVE_BACKUP".
2053
2054 "AUG_TYPE_CHECK" = 4
2055 Typecheck lenses.
2056
2057 This option is only useful when debugging Augeas lenses. Use of
2058 this option may require additional memory for the libguestfs
2059 appliance. You may need to set the "LIBGUESTFS_MEMSIZE"
2060 environment variable or call "set-memsize".
2061
2062 "AUG_NO_STDINC" = 8
2063 Do not use standard load path for modules.
2064
2065 "AUG_SAVE_NOOP" = 16
2066 Make save a no-op, just record what would have been changed.
2067
2068 "AUG_NO_LOAD" = 32
2069 Do not load the tree in "aug-init".
2070
2071 To close the handle, you can call "aug-close".
2072
2073 To find out more about Augeas, see http://augeas.net/.
2074
2075 aug-insert
2076 aug-insert augpath label true|false
2077
2078 Create a new sibling "label" for "path", inserting it into the tree
2079 before or after "path" (depending on the boolean flag "before").
2080
2081 "path" must match exactly one existing node in the tree, and "label"
2082 must be a label, ie. not contain /, "*" or end with a bracketed index
2083 "[N]".
2084
2085 aug-label
2086 aug-label augpath
2087
2088 The label (name of the last element) of the Augeas path expression
2089 "augpath" is returned. "augpath" must match exactly one node, else
2090 this function returns an error.
2091
2092 aug-load
2093 aug-load
2094
2095 Load files into the tree.
2096
2097 See "aug_load" in the Augeas documentation for the full gory details.
2098
2099 aug-ls
2100 aug-ls augpath
2101
2102 This is just a shortcut for listing "aug-match" "path/*" and sorting
2103 the resulting nodes into alphabetical order.
2104
2105 aug-match
2106 aug-match augpath
2107
2108 Returns a list of paths which match the path expression "path". The
2109 returned paths are sufficiently qualified so that they match exactly
2110 one node in the current tree.
2111
2112 aug-mv
2113 aug-mv src dest
2114
2115 Move the node "src" to "dest". "src" must match exactly one node.
2116 "dest" is overwritten if it exists.
2117
2118 aug-rm
2119 aug-rm augpath
2120
2121 Remove "path" and all of its children.
2122
2123 On success this returns the number of entries which were removed.
2124
2125 aug-save
2126 aug-save
2127
2128 This writes all pending changes to disk.
2129
2130 The flags which were passed to "aug-init" affect exactly how files are
2131 saved.
2132
2133 aug-set
2134 aug-set augpath val
2135
2136 Set the value associated with "path" to "val".
2137
2138 In the Augeas API, it is possible to clear a node by setting the value
2139 to NULL. Due to an oversight in the libguestfs API you cannot do that
2140 with this call. Instead you must use the "aug-clear" call.
2141
2142 aug-setm
2143 aug-setm base sub val
2144
2145 Change multiple Augeas nodes in a single operation. "base" is an
2146 expression matching multiple nodes. "sub" is a path expression
2147 relative to "base". All nodes matching "base" are found, and then for
2148 each node, "sub" is changed to "val". "sub" may also be "NULL" in
2149 which case the "base" nodes are modified.
2150
2151 This returns the number of nodes modified.
2152
2153 aug-transform
2154 aug-transform lens file [remove:true|false]
2155
2156 Add an Augeas transformation for the specified "lens" so it can handle
2157 "file".
2158
2159 If "remove" is true ("false" by default), then the transformation is
2160 removed.
2161
2162 This command has one or more optional arguments. See "OPTIONAL
2163 ARGUMENTS".
2164
2165 available
2166 available 'groups ...'
2167
2168 This command is used to check the availability of some groups of
2169 functionality in the appliance, which not all builds of the libguestfs
2170 appliance will be able to provide.
2171
2172 The libguestfs groups, and the functions that those groups correspond
2173 to, are listed in "AVAILABILITY" in guestfs(3). You can also fetch
2174 this list at runtime by calling "available-all-groups".
2175
2176 The argument "groups" is a list of group names, eg: "["inotify",
2177 "augeas"]" would check for the availability of the Linux inotify
2178 functions and Augeas (configuration file editing) functions.
2179
2180 The command returns no error if all requested groups are available.
2181
2182 It fails with an error if one or more of the requested groups is
2183 unavailable in the appliance.
2184
2185 If an unknown group name is included in the list of groups then an
2186 error is always returned.
2187
2188 Notes:
2189
2190 · "feature-available" is the same as this call, but with a slightly
2191 simpler to use API: that call returns a boolean true/false instead
2192 of throwing an error.
2193
2194 · You must call "launch" before calling this function.
2195
2196 The reason is because we don't know what groups are supported by
2197 the appliance/daemon until it is running and can be queried.
2198
2199 · If a group of functions is available, this does not necessarily
2200 mean that they will work. You still have to check for errors when
2201 calling individual API functions even if they are available.
2202
2203 · It is usually the job of distro packagers to build complete
2204 functionality into the libguestfs appliance. Upstream libguestfs,
2205 if built from source with all requirements satisfied, will support
2206 everything.
2207
2208 · This call was added in version 1.0.80. In previous versions of
2209 libguestfs all you could do would be to speculatively execute a
2210 command to find out if the daemon implemented it. See also
2211 "version".
2212
2213 See also "filesystem-available".
2214
2215 available-all-groups
2216 available-all-groups
2217
2218 This command returns a list of all optional groups that this daemon
2219 knows about. Note this returns both supported and unsupported groups.
2220 To find out which ones the daemon can actually support you have to call
2221 "available" / "feature-available" on each member of the returned list.
2222
2223 See also "available", "feature-available" and "AVAILABILITY" in
2224 guestfs(3).
2225
2226 base64-in
2227 base64-in (base64file|-) filename
2228
2229 This command uploads base64-encoded data from "base64file" to filename.
2230
2231 Use "-" instead of a filename to read/write from stdin/stdout.
2232
2233 base64-out
2234 base64-out filename (base64file|-)
2235
2236 This command downloads the contents of filename, writing it out to
2237 local file "base64file" encoded as base64.
2238
2239 Use "-" instead of a filename to read/write from stdin/stdout.
2240
2241 blkdiscard
2242 blkdiscard device
2243
2244 This discards all blocks on the block device "device", giving the free
2245 space back to the host.
2246
2247 This operation requires support in libguestfs, the host filesystem,
2248 qemu and the host kernel. If this support isn't present it may give an
2249 error or even appear to run but do nothing. You must also set the
2250 "discard" attribute on the underlying drive (see "add-drive-opts").
2251
2252 This command depends on the feature "blkdiscard". See also "feature-
2253 available".
2254
2255 blkdiscardzeroes
2256 blkdiscardzeroes device
2257
2258 This call returns true if blocks on "device" that have been discarded
2259 by a call to "blkdiscard" are returned as blocks of zero bytes when
2260 read the next time.
2261
2262 If it returns false, then it may be that discarded blocks are read as
2263 stale or random data.
2264
2265 This command depends on the feature "blkdiscardzeroes". See also
2266 "feature-available".
2267
2268 blkid
2269 blkid device
2270
2271 This command returns block device attributes for "device". The
2272 following fields are usually present in the returned hash. Other fields
2273 may also be present.
2274
2275 "UUID"
2276 The uuid of this device.
2277
2278 "LABEL"
2279 The label of this device.
2280
2281 "VERSION"
2282 The version of blkid command.
2283
2284 "TYPE"
2285 The filesystem type or RAID of this device.
2286
2287 "USAGE"
2288 The usage of this device, for example "filesystem" or "raid".
2289
2290 blockdev-flushbufs
2291 blockdev-flushbufs device
2292
2293 This tells the kernel to flush internal buffers associated with
2294 "device".
2295
2296 This uses the blockdev(8) command.
2297
2298 blockdev-getbsz
2299 blockdev-getbsz device
2300
2301 This returns the block size of a device.
2302
2303 Note: this is different from both size in blocks and filesystem block
2304 size. Also this setting is not really used by anything. You should
2305 probably not use it for anything. Filesystems have their own idea
2306 about what block size to choose.
2307
2308 This uses the blockdev(8) command.
2309
2310 blockdev-getro
2311 blockdev-getro device
2312
2313 Returns a boolean indicating if the block device is read-only (true if
2314 read-only, false if not).
2315
2316 This uses the blockdev(8) command.
2317
2318 blockdev-getsize64
2319 blockdev-getsize64 device
2320
2321 This returns the size of the device in bytes.
2322
2323 See also "blockdev-getsz".
2324
2325 This uses the blockdev(8) command.
2326
2327 blockdev-getss
2328 blockdev-getss device
2329
2330 This returns the size of sectors on a block device. Usually 512, but
2331 can be larger for modern devices.
2332
2333 (Note, this is not the size in sectors, use "blockdev-getsz" for that).
2334
2335 This uses the blockdev(8) command.
2336
2337 blockdev-getsz
2338 blockdev-getsz device
2339
2340 This returns the size of the device in units of 512-byte sectors (even
2341 if the sectorsize isn't 512 bytes ... weird).
2342
2343 See also "blockdev-getss" for the real sector size of the device, and
2344 "blockdev-getsize64" for the more useful size in bytes.
2345
2346 This uses the blockdev(8) command.
2347
2348 blockdev-rereadpt
2349 blockdev-rereadpt device
2350
2351 Reread the partition table on "device".
2352
2353 This uses the blockdev(8) command.
2354
2355 blockdev-setbsz
2356 blockdev-setbsz device blocksize
2357
2358 This call does nothing and has never done anything because of a bug in
2359 blockdev. Do not use it.
2360
2361 If you need to set the filesystem block size, use the "blocksize"
2362 option of "mkfs".
2363
2364 This function is deprecated. There is no replacement. Consult the API
2365 documentation in guestfs(3) for further information.
2366
2367 Deprecated functions will not be removed from the API, but the fact
2368 that they are deprecated indicates that there are problems with correct
2369 use of these functions.
2370
2371 blockdev-setra
2372 blockdev-setra device sectors
2373
2374 Set readahead (in 512-byte sectors) for the device.
2375
2376 This uses the blockdev(8) command.
2377
2378 blockdev-setro
2379 blockdev-setro device
2380
2381 Sets the block device named "device" to read-only.
2382
2383 This uses the blockdev(8) command.
2384
2385 blockdev-setrw
2386 blockdev-setrw device
2387
2388 Sets the block device named "device" to read-write.
2389
2390 This uses the blockdev(8) command.
2391
2392 btrfs-balance-cancel
2393 btrfs-balance-cancel path
2394
2395 Cancel a running balance on a btrfs filesystem.
2396
2397 This command depends on the feature "btrfs". See also "feature-
2398 available".
2399
2400 btrfs-balance-pause
2401 btrfs-balance-pause path
2402
2403 Pause a running balance on a btrfs filesystem.
2404
2405 This command depends on the feature "btrfs". See also "feature-
2406 available".
2407
2408 btrfs-balance-resume
2409 btrfs-balance-resume path
2410
2411 Resume a paused balance on a btrfs filesystem.
2412
2413 This command depends on the feature "btrfs". See also "feature-
2414 available".
2415
2416 btrfs-balance-status
2417 btrfs-balance-status path
2418
2419 Show the status of a running or paused balance on a btrfs filesystem.
2420
2421 This command depends on the feature "btrfs". See also "feature-
2422 available".
2423
2424 btrfs-device-add
2425 btrfs-device-add 'devices ...' fs
2426
2427 Add the list of device(s) in "devices" to the btrfs filesystem mounted
2428 at "fs". If "devices" is an empty list, this does nothing.
2429
2430 This command depends on the feature "btrfs". See also "feature-
2431 available".
2432
2433 btrfs-device-delete
2434 btrfs-device-delete 'devices ...' fs
2435
2436 Remove the "devices" from the btrfs filesystem mounted at "fs". If
2437 "devices" is an empty list, this does nothing.
2438
2439 This command depends on the feature "btrfs". See also "feature-
2440 available".
2441
2442 btrfs-filesystem-balance
2443 btrfs-balance
2444 btrfs-filesystem-balance fs
2445
2446 Balance the chunks in the btrfs filesystem mounted at "fs" across the
2447 underlying devices.
2448
2449 This command depends on the feature "btrfs". See also "feature-
2450 available".
2451
2452 btrfs-filesystem-defragment
2453 btrfs-filesystem-defragment path [flush:true|false] [compress:..]
2454
2455 Defragment a file or directory on a btrfs filesystem. compress is one
2456 of zlib or lzo.
2457
2458 This command has one or more optional arguments. See "OPTIONAL
2459 ARGUMENTS".
2460
2461 This command depends on the feature "btrfs". See also "feature-
2462 available".
2463
2464 btrfs-filesystem-resize
2465 btrfs-filesystem-resize mountpoint [size:N]
2466
2467 This command resizes a btrfs filesystem.
2468
2469 Note that unlike other resize calls, the filesystem has to be mounted
2470 and the parameter is the mountpoint not the device (this is a
2471 requirement of btrfs itself).
2472
2473 The optional parameters are:
2474
2475 "size"
2476 The new size (in bytes) of the filesystem. If omitted, the
2477 filesystem is resized to the maximum size.
2478
2479 See also btrfs(8).
2480
2481 This command has one or more optional arguments. See "OPTIONAL
2482 ARGUMENTS".
2483
2484 This command depends on the feature "btrfs". See also "feature-
2485 available".
2486
2487 btrfs-filesystem-show
2488 btrfs-filesystem-show device
2489
2490 Show all the devices where the filesystems in "device" is spanned over.
2491
2492 If not all the devices for the filesystems are present, then this
2493 function fails and the "errno" is set to "ENODEV".
2494
2495 This command depends on the feature "btrfs". See also "feature-
2496 available".
2497
2498 btrfs-filesystem-sync
2499 btrfs-filesystem-sync fs
2500
2501 Force sync on the btrfs filesystem mounted at "fs".
2502
2503 This command depends on the feature "btrfs". See also "feature-
2504 available".
2505
2506 btrfs-fsck
2507 btrfs-fsck device [superblock:N] [repair:true|false]
2508
2509 Used to check a btrfs filesystem, "device" is the device file where the
2510 filesystem is stored.
2511
2512 This command has one or more optional arguments. See "OPTIONAL
2513 ARGUMENTS".
2514
2515 This command depends on the feature "btrfs". See also "feature-
2516 available".
2517
2518 btrfs-image
2519 btrfs-image 'source ...' image [compresslevel:N]
2520
2521 This is used to create an image of a btrfs filesystem. All data will
2522 be zeroed, but metadata and the like is preserved.
2523
2524 This command has one or more optional arguments. See "OPTIONAL
2525 ARGUMENTS".
2526
2527 This command depends on the feature "btrfs". See also "feature-
2528 available".
2529
2530 btrfs-qgroup-assign
2531 btrfs-qgroup-assign src dst path
2532
2533 Add qgroup "src" to parent qgroup "dst". This command can group several
2534 qgroups into a parent qgroup to share common limit.
2535
2536 This command depends on the feature "btrfs". See also "feature-
2537 available".
2538
2539 btrfs-qgroup-create
2540 btrfs-qgroup-create qgroupid subvolume
2541
2542 Create a quota group (qgroup) for subvolume at "subvolume".
2543
2544 This command depends on the feature "btrfs". See also "feature-
2545 available".
2546
2547 btrfs-qgroup-destroy
2548 btrfs-qgroup-destroy qgroupid subvolume
2549
2550 Destroy a quota group.
2551
2552 This command depends on the feature "btrfs". See also "feature-
2553 available".
2554
2555 btrfs-qgroup-limit
2556 btrfs-qgroup-limit subvolume size
2557
2558 Limit the size of the subvolume with path "subvolume".
2559
2560 This command depends on the feature "btrfs". See also "feature-
2561 available".
2562
2563 btrfs-qgroup-remove
2564 btrfs-qgroup-remove src dst path
2565
2566 Remove qgroup "src" from the parent qgroup "dst".
2567
2568 This command depends on the feature "btrfs". See also "feature-
2569 available".
2570
2571 btrfs-qgroup-show
2572 btrfs-qgroup-show path
2573
2574 Show all subvolume quota groups in a btrfs filesystem, including their
2575 usages.
2576
2577 This command depends on the feature "btrfs". See also "feature-
2578 available".
2579
2580 btrfs-quota-enable
2581 btrfs-quota-enable fs true|false
2582
2583 Enable or disable subvolume quota support for filesystem which contains
2584 "path".
2585
2586 This command depends on the feature "btrfs". See also "feature-
2587 available".
2588
2589 btrfs-quota-rescan
2590 btrfs-quota-rescan fs
2591
2592 Trash all qgroup numbers and scan the metadata again with the current
2593 config.
2594
2595 This command depends on the feature "btrfs". See also "feature-
2596 available".
2597
2598 btrfs-replace
2599 btrfs-replace srcdev targetdev mntpoint
2600
2601 Replace device of a btrfs filesystem. On a live filesystem, duplicate
2602 the data to the target device which is currently stored on the source
2603 device. After completion of the operation, the source device is wiped
2604 out and removed from the filesystem.
2605
2606 The "targetdev" needs to be same size or larger than the "srcdev".
2607 Devices which are currently mounted are never allowed to be used as the
2608 "targetdev".
2609
2610 This command depends on the feature "btrfs". See also "feature-
2611 available".
2612
2613 btrfs-rescue-chunk-recover
2614 btrfs-rescue-chunk-recover device
2615
2616 Recover the chunk tree of btrfs filesystem by scanning the devices one
2617 by one.
2618
2619 This command depends on the feature "btrfs". See also "feature-
2620 available".
2621
2622 btrfs-rescue-super-recover
2623 btrfs-rescue-super-recover device
2624
2625 Recover bad superblocks from good copies.
2626
2627 This command depends on the feature "btrfs". See also "feature-
2628 available".
2629
2630 btrfs-scrub-cancel
2631 btrfs-scrub-cancel path
2632
2633 Cancel a running scrub on a btrfs filesystem.
2634
2635 This command depends on the feature "btrfs". See also "feature-
2636 available".
2637
2638 btrfs-scrub-resume
2639 btrfs-scrub-resume path
2640
2641 Resume a previously canceled or interrupted scrub on a btrfs
2642 filesystem.
2643
2644 This command depends on the feature "btrfs". See also "feature-
2645 available".
2646
2647 btrfs-scrub-start
2648 btrfs-scrub-start path
2649
2650 Reads all the data and metadata on the filesystem, and uses checksums
2651 and the duplicate copies from RAID storage to identify and repair any
2652 corrupt data.
2653
2654 This command depends on the feature "btrfs". See also "feature-
2655 available".
2656
2657 btrfs-scrub-status
2658 btrfs-scrub-status path
2659
2660 Show status of running or finished scrub on a btrfs filesystem.
2661
2662 This command depends on the feature "btrfs". See also "feature-
2663 available".
2664
2665 btrfs-set-seeding
2666 btrfs-set-seeding device true|false
2667
2668 Enable or disable the seeding feature of a device that contains a btrfs
2669 filesystem.
2670
2671 This command depends on the feature "btrfs". See also "feature-
2672 available".
2673
2674 btrfs-subvolume-create
2675 btrfs-subvolume-create-opts
2676 btrfs-subvolume-create dest [qgroupid:..]
2677
2678 Create a btrfs subvolume. The "dest" argument is the destination
2679 directory and the name of the subvolume, in the form
2680 /path/to/dest/name. The optional parameter "qgroupid" represents the
2681 qgroup which the newly created subvolume will be added to.
2682
2683 This command has one or more optional arguments. See "OPTIONAL
2684 ARGUMENTS".
2685
2686 This command depends on the feature "btrfs". See also "feature-
2687 available".
2688
2689 btrfs-subvolume-delete
2690 btrfs-subvolume-delete subvolume
2691
2692 Delete the named btrfs subvolume or snapshot.
2693
2694 This command depends on the feature "btrfs". See also "feature-
2695 available".
2696
2697 btrfs-subvolume-get-default
2698 btrfs-subvolume-get-default fs
2699
2700 Get the default subvolume or snapshot of a filesystem mounted at
2701 "mountpoint".
2702
2703 This command depends on the feature "btrfs". See also "feature-
2704 available".
2705
2706 btrfs-subvolume-list
2707 btrfs-subvolume-list fs
2708
2709 List the btrfs snapshots and subvolumes of the btrfs filesystem which
2710 is mounted at "fs".
2711
2712 This command depends on the feature "btrfs". See also "feature-
2713 available".
2714
2715 btrfs-subvolume-set-default
2716 btrfs-subvolume-set-default id fs
2717
2718 Set the subvolume of the btrfs filesystem "fs" which will be mounted by
2719 default. See "btrfs-subvolume-list" to get a list of subvolumes.
2720
2721 This command depends on the feature "btrfs". See also "feature-
2722 available".
2723
2724 btrfs-subvolume-show
2725 btrfs-subvolume-show subvolume
2726
2727 Return detailed information of the subvolume.
2728
2729 This command depends on the feature "btrfs". See also "feature-
2730 available".
2731
2732 btrfs-subvolume-snapshot
2733 btrfs-subvolume-snapshot-opts
2734 btrfs-subvolume-snapshot source dest [ro:true|false] [qgroupid:..]
2735
2736 Create a snapshot of the btrfs subvolume "source". The "dest" argument
2737 is the destination directory and the name of the snapshot, in the form
2738 /path/to/dest/name. By default the newly created snapshot is writable,
2739 if the value of optional parameter "ro" is true, then a readonly
2740 snapshot is created. The optional parameter "qgroupid" represents the
2741 qgroup which the newly created snapshot will be added to.
2742
2743 This command has one or more optional arguments. See "OPTIONAL
2744 ARGUMENTS".
2745
2746 This command depends on the feature "btrfs". See also "feature-
2747 available".
2748
2749 btrfstune-enable-extended-inode-refs
2750 btrfstune-enable-extended-inode-refs device
2751
2752 This will Enable extended inode refs.
2753
2754 This command depends on the feature "btrfs". See also "feature-
2755 available".
2756
2757 btrfstune-enable-skinny-metadata-extent-refs
2758 btrfstune-enable-skinny-metadata-extent-refs device
2759
2760 This enable skinny metadata extent refs.
2761
2762 This command depends on the feature "btrfs". See also "feature-
2763 available".
2764
2765 btrfstune-seeding
2766 btrfstune-seeding device true|false
2767
2768 Enable seeding of a btrfs device, this will force a fs readonly so that
2769 you can use it to build other filesystems.
2770
2771 This command depends on the feature "btrfs". See also "feature-
2772 available".
2773
2774 c-pointer
2775 c-pointer
2776
2777 In non-C language bindings, this allows you to retrieve the underlying
2778 C pointer to the handle (ie. "h *"). The purpose of this is to allow
2779 other libraries to interwork with libguestfs.
2780
2781 canonical-device-name
2782 canonical-device-name device
2783
2784 This utility function is useful when displaying device names to the
2785 user. It takes a number of irregular device names and returns them in
2786 a consistent format:
2787
2788 /dev/hdX
2789 /dev/vdX
2790 These are returned as /dev/sdX. Note this works for device names
2791 and partition names. This is approximately the reverse of the
2792 algorithm described in "BLOCK DEVICE NAMING" in guestfs(3).
2793
2794 /dev/mapper/VG-LV
2795 /dev/dm-N
2796 Converted to /dev/VG/LV form using "lvm-canonical-lv-name".
2797
2798 Other strings are returned unmodified.
2799
2800 cap-get-file
2801 cap-get-file path
2802
2803 This function returns the Linux capabilities attached to "path". The
2804 capabilities set is returned in text form (see cap_to_text(3)).
2805
2806 If no capabilities are attached to a file, an empty string is returned.
2807
2808 This command depends on the feature "linuxcaps". See also "feature-
2809 available".
2810
2811 cap-set-file
2812 cap-set-file path cap
2813
2814 This function sets the Linux capabilities attached to "path". The
2815 capabilities set "cap" should be passed in text form (see
2816 cap_from_text(3)).
2817
2818 This command depends on the feature "linuxcaps". See also "feature-
2819 available".
2820
2821 case-sensitive-path
2822 case-sensitive-path path
2823
2824 This can be used to resolve case insensitive paths on a filesystem
2825 which is case sensitive. The use case is to resolve paths which you
2826 have read from Windows configuration files or the Windows Registry, to
2827 the true path.
2828
2829 The command handles a peculiarity of the Linux ntfs-3g filesystem
2830 driver (and probably others), which is that although the underlying
2831 filesystem is case-insensitive, the driver exports the filesystem to
2832 Linux as case-sensitive.
2833
2834 One consequence of this is that special directories such as C:\windows
2835 may appear as /WINDOWS or /windows (or other things) depending on the
2836 precise details of how they were created. In Windows itself this would
2837 not be a problem.
2838
2839 Bug or feature? You decide:
2840 http://www.tuxera.com/community/ntfs-3g-faq/#posixfilenames1
2841
2842 "case-sensitive-path" attempts to resolve the true case of each element
2843 in the path. It will return a resolved path if either the full path or
2844 its parent directory exists. If the parent directory exists but the
2845 full path does not, the case of the parent directory will be correctly
2846 resolved, and the remainder appended unmodified. For example, if the
2847 file "/Windows/System32/netkvm.sys" exists:
2848
2849 "case-sensitive-path" ("/windows/system32/netkvm.sys")
2850 "Windows/System32/netkvm.sys"
2851
2852 "case-sensitive-path" ("/windows/system32/NoSuchFile")
2853 "Windows/System32/NoSuchFile"
2854
2855 "case-sensitive-path" ("/windows/system33/netkvm.sys")
2856 ERROR
2857
2858 Note: Because of the above behaviour, "case-sensitive-path" cannot be
2859 used to check for the existence of a file.
2860
2861 Note: This function does not handle drive names, backslashes etc.
2862
2863 See also "realpath".
2864
2865 cat
2866 cat path
2867
2868 Return the contents of the file named "path".
2869
2870 Because, in C, this function returns a "char *", there is no way to
2871 differentiate between a "\0" character in a file and end of string. To
2872 handle binary files, use the "read-file" or "download" functions.
2873
2874 checksum
2875 checksum csumtype path
2876
2877 This call computes the MD5, SHAx or CRC checksum of the file named
2878 "path".
2879
2880 The type of checksum to compute is given by the "csumtype" parameter
2881 which must have one of the following values:
2882
2883 "crc"
2884 Compute the cyclic redundancy check (CRC) specified by POSIX for
2885 the "cksum" command.
2886
2887 "md5"
2888 Compute the MD5 hash (using the "md5sum" program).
2889
2890 "sha1"
2891 Compute the SHA1 hash (using the "sha1sum" program).
2892
2893 "sha224"
2894 Compute the SHA224 hash (using the "sha224sum" program).
2895
2896 "sha256"
2897 Compute the SHA256 hash (using the "sha256sum" program).
2898
2899 "sha384"
2900 Compute the SHA384 hash (using the "sha384sum" program).
2901
2902 "sha512"
2903 Compute the SHA512 hash (using the "sha512sum" program).
2904
2905 The checksum is returned as a printable string.
2906
2907 To get the checksum for a device, use "checksum-device".
2908
2909 To get the checksums for many files, use "checksums-out".
2910
2911 checksum-device
2912 checksum-device csumtype device
2913
2914 This call computes the MD5, SHAx or CRC checksum of the contents of the
2915 device named "device". For the types of checksums supported see the
2916 "checksum" command.
2917
2918 checksums-out
2919 checksums-out csumtype directory (sumsfile|-)
2920
2921 This command computes the checksums of all regular files in directory
2922 and then emits a list of those checksums to the local output file
2923 "sumsfile".
2924
2925 This can be used for verifying the integrity of a virtual machine.
2926 However to be properly secure you should pay attention to the output of
2927 the checksum command (it uses the ones from GNU coreutils). In
2928 particular when the filename is not printable, coreutils uses a special
2929 backslash syntax. For more information, see the GNU coreutils info
2930 file.
2931
2932 Use "-" instead of a filename to read/write from stdin/stdout.
2933
2934 chmod
2935 chmod mode path
2936
2937 Change the mode (permissions) of "path" to "mode". Only numeric modes
2938 are supported.
2939
2940 Note: When using this command from guestfish, "mode" by default would
2941 be decimal, unless you prefix it with 0 to get octal, ie. use 0700 not
2942 700.
2943
2944 The mode actually set is affected by the umask.
2945
2946 chown
2947 chown owner group path
2948
2949 Change the file owner to "owner" and group to "group".
2950
2951 Only numeric uid and gid are supported. If you want to use names, you
2952 will need to locate and parse the password file yourself (Augeas
2953 support makes this relatively easy).
2954
2955 clear-backend-setting
2956 clear-backend-setting name
2957
2958 If there is a backend setting string matching "name" or beginning with
2959 "name=", then that string is removed from the backend settings.
2960
2961 This call returns the number of strings which were removed (which may
2962 be 0, 1 or greater than 1).
2963
2964 See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
2965
2966 command
2967 command 'arguments ...'
2968
2969 This call runs a command from the guest filesystem. The filesystem
2970 must be mounted, and must contain a compatible operating system (ie.
2971 something Linux, with the same or compatible processor architecture).
2972
2973 The single parameter is an argv-style list of arguments. The first
2974 element is the name of the program to run. Subsequent elements are
2975 parameters. The list must be non-empty (ie. must contain a program
2976 name). Note that the command runs directly, and is not invoked via the
2977 shell (see "sh").
2978
2979 The return value is anything printed to stdout by the command.
2980
2981 If the command returns a non-zero exit status, then this function
2982 returns an error message. The error message string is the content of
2983 stderr from the command.
2984
2985 The $PATH environment variable will contain at least /usr/bin and /bin.
2986 If you require a program from another location, you should provide the
2987 full path in the first parameter.
2988
2989 Shared libraries and data files required by the program must be
2990 available on filesystems which are mounted in the correct places. It
2991 is the caller’s responsibility to ensure all filesystems that are
2992 needed are mounted at the right locations.
2993
2994 Because of the message protocol, there is a transfer limit of somewhere
2995 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
2996
2997 command-lines
2998 command-lines 'arguments ...'
2999
3000 This is the same as "command", but splits the result into a list of
3001 lines.
3002
3003 See also: "sh-lines"
3004
3005 Because of the message protocol, there is a transfer limit of somewhere
3006 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
3007
3008 compress-device-out
3009 compress-device-out ctype device (zdevice|-) [level:N]
3010
3011 This command compresses "device" and writes it out to the local file
3012 "zdevice".
3013
3014 The "ctype" and optional "level" parameters have the same meaning as in
3015 "compress-out".
3016
3017 Use "-" instead of a filename to read/write from stdin/stdout.
3018
3019 This command has one or more optional arguments. See "OPTIONAL
3020 ARGUMENTS".
3021
3022 compress-out
3023 compress-out ctype file (zfile|-) [level:N]
3024
3025 This command compresses file and writes it out to the local file zfile.
3026
3027 The compression program used is controlled by the "ctype" parameter.
3028 Currently this includes: "compress", "gzip", "bzip2", "xz" or "lzop".
3029 Some compression types may not be supported by particular builds of
3030 libguestfs, in which case you will get an error containing the
3031 substring "not supported".
3032
3033 The optional "level" parameter controls compression level. The meaning
3034 and default for this parameter depends on the compression program being
3035 used.
3036
3037 Use "-" instead of a filename to read/write from stdin/stdout.
3038
3039 This command has one or more optional arguments. See "OPTIONAL
3040 ARGUMENTS".
3041
3042 config
3043 config hvparam hvvalue
3044
3045 This can be used to add arbitrary hypervisor parameters of the form
3046 -param value. Actually it’s not quite arbitrary - we prevent you from
3047 setting some parameters which would interfere with parameters that we
3048 use.
3049
3050 The first character of "hvparam" string must be a "-" (dash).
3051
3052 "hvvalue" can be NULL.
3053
3054 copy-attributes
3055 copy-attributes src dest [all:true|false] [mode:true|false] [xattributes:true|false] [ownership:true|false]
3056
3057 Copy the attributes of a path (which can be a file or a directory) to
3058 another path.
3059
3060 By default "no" attribute is copied, so make sure to specify any (or
3061 "all" to copy everything).
3062
3063 The optional arguments specify which attributes can be copied:
3064
3065 "mode"
3066 Copy part of the file mode from "source" to "destination". Only the
3067 UNIX permissions and the sticky/setuid/setgid bits can be copied.
3068
3069 "xattributes"
3070 Copy the Linux extended attributes (xattrs) from "source" to
3071 "destination". This flag does nothing if the linuxxattrs feature
3072 is not available (see "feature-available").
3073
3074 "ownership"
3075 Copy the owner uid and the group gid of "source" to "destination".
3076
3077 "all"
3078 Copy all the attributes from "source" to "destination". Enabling it
3079 enables all the other flags, if they are not specified already.
3080
3081 This command has one or more optional arguments. See "OPTIONAL
3082 ARGUMENTS".
3083
3084 copy-device-to-device
3085 copy-device-to-device src dest [srcoffset:N] [destoffset:N] [size:N] [sparse:true|false] [append:true|false]
3086
3087 The four calls "copy-device-to-device", "copy-device-to-file", "copy-
3088 file-to-device", and "copy-file-to-file" let you copy from a source
3089 (device|file) to a destination (device|file).
3090
3091 Partial copies can be made since you can specify optionally the source
3092 offset, destination offset and size to copy. These values are all
3093 specified in bytes. If not given, the offsets both default to zero,
3094 and the size defaults to copying as much as possible until we hit the
3095 end of the source.
3096
3097 The source and destination may be the same object. However overlapping
3098 regions may not be copied correctly.
3099
3100 If the destination is a file, it is created if required. If the
3101 destination file is not large enough, it is extended.
3102
3103 If the destination is a file and the "append" flag is not set, then the
3104 destination file is truncated. If the "append" flag is set, then the
3105 copy appends to the destination file. The "append" flag currently
3106 cannot be set for devices.
3107
3108 If the "sparse" flag is true then the call avoids writing blocks that
3109 contain only zeroes, which can help in some situations where the
3110 backing disk is thin-provisioned. Note that unless the target is
3111 already zeroed, using this option will result in incorrect copying.
3112
3113 This command has one or more optional arguments. See "OPTIONAL
3114 ARGUMENTS".
3115
3116 copy-device-to-file
3117 copy-device-to-file src dest [srcoffset:N] [destoffset:N] [size:N] [sparse:true|false] [append:true|false]
3118
3119 See "copy-device-to-device" for a general overview of this call.
3120
3121 This command has one or more optional arguments. See "OPTIONAL
3122 ARGUMENTS".
3123
3124 copy-file-to-device
3125 copy-file-to-device src dest [srcoffset:N] [destoffset:N] [size:N] [sparse:true|false] [append:true|false]
3126
3127 See "copy-device-to-device" for a general overview of this call.
3128
3129 This command has one or more optional arguments. See "OPTIONAL
3130 ARGUMENTS".
3131
3132 copy-file-to-file
3133 copy-file-to-file src dest [srcoffset:N] [destoffset:N] [size:N] [sparse:true|false] [append:true|false]
3134
3135 See "copy-device-to-device" for a general overview of this call.
3136
3137 This is not the function you want for copying files. This is for
3138 copying blocks within existing files. See "cp", "cp-a" and "mv" for
3139 general file copying and moving functions.
3140
3141 This command has one or more optional arguments. See "OPTIONAL
3142 ARGUMENTS".
3143
3144 copy-size
3145 copy-size src dest size
3146
3147 This command copies exactly "size" bytes from one source device or file
3148 "src" to another destination device or file "dest".
3149
3150 Note this will fail if the source is too short or if the destination is
3151 not large enough.
3152
3153 This function is deprecated. In new code, use the "copy-device-to-
3154 device" call instead.
3155
3156 Deprecated functions will not be removed from the API, but the fact
3157 that they are deprecated indicates that there are problems with correct
3158 use of these functions.
3159
3160 cp
3161 cp src dest
3162
3163 This copies a file from "src" to "dest" where "dest" is either a
3164 destination filename or destination directory.
3165
3166 cp-a
3167 cp-a src dest
3168
3169 This copies a file or directory from "src" to "dest" recursively using
3170 the "cp -a" command.
3171
3172 cp-r
3173 cp-r src dest
3174
3175 This copies a file or directory from "src" to "dest" recursively using
3176 the "cp -rP" command.
3177
3178 Most users should use "cp-a" instead. This command is useful when you
3179 don't want to preserve permissions, because the target filesystem does
3180 not support it (primarily when writing to DOS FAT filesystems).
3181
3182 cpio-out
3183 cpio-out directory (cpiofile|-) [format:..]
3184
3185 This command packs the contents of directory and downloads it to local
3186 file "cpiofile".
3187
3188 The optional "format" parameter can be used to select the format. Only
3189 the following formats are currently permitted:
3190
3191 "newc"
3192 New (SVR4) portable format. This format happens to be compatible
3193 with the cpio-like format used by the Linux kernel for initramfs.
3194
3195 This is the default format.
3196
3197 "crc"
3198 New (SVR4) portable format with a checksum.
3199
3200 Use "-" instead of a filename to read/write from stdin/stdout.
3201
3202 This command has one or more optional arguments. See "OPTIONAL
3203 ARGUMENTS".
3204
3205 dd
3206 dd src dest
3207
3208 This command copies from one source device or file "src" to another
3209 destination device or file "dest". Normally you would use this to copy
3210 to or from a device or partition, for example to duplicate a
3211 filesystem.
3212
3213 If the destination is a device, it must be as large or larger than the
3214 source file or device, otherwise the copy will fail. This command
3215 cannot do partial copies (see "copy-device-to-device").
3216
3217 This function is deprecated. In new code, use the "copy-device-to-
3218 device" call instead.
3219
3220 Deprecated functions will not be removed from the API, but the fact
3221 that they are deprecated indicates that there are problems with correct
3222 use of these functions.
3223
3224 device-index
3225 device-index device
3226
3227 This function takes a device name (eg. "/dev/sdb") and returns the
3228 index of the device in the list of devices.
3229
3230 Index numbers start from 0. The named device must exist, for example
3231 as a string returned from "list-devices".
3232
3233 See also "list-devices", "part-to-dev".
3234
3235 df
3236 df
3237
3238 This command runs the "df" command to report disk space used.
3239
3240 This command is mostly useful for interactive sessions. It is not
3241 intended that you try to parse the output string. Use "statvfs" from
3242 programs.
3243
3244 df-h
3245 df-h
3246
3247 This command runs the "df -h" command to report disk space used in
3248 human-readable format.
3249
3250 This command is mostly useful for interactive sessions. It is not
3251 intended that you try to parse the output string. Use "statvfs" from
3252 programs.
3253
3254 disk-create
3255 disk-create filename format size [backingfile:..] [backingformat:..] [preallocation:..] [compat:..] [clustersize:N]
3256
3257 Create a blank disk image called filename (a host file) with format
3258 "format" (usually "raw" or "qcow2"). The size is "size" bytes.
3259
3260 If used with the optional "backingfile" parameter, then a snapshot is
3261 created on top of the backing file. In this case, "size" must be
3262 passed as "-1". The size of the snapshot is the same as the size of
3263 the backing file, which is discovered automatically. You are
3264 encouraged to also pass "backingformat" to describe the format of
3265 "backingfile".
3266
3267 If filename refers to a block device, then the device is formatted.
3268 The "size" is ignored since block devices have an intrinsic size.
3269
3270 The other optional parameters are:
3271
3272 "preallocation"
3273 If format is "raw", then this can be either "off" (or "sparse") or
3274 "full" to create a sparse or fully allocated file respectively.
3275 The default is "off".
3276
3277 If format is "qcow2", then this can be "off" (or "sparse"),
3278 "metadata" or "full". Preallocating metadata can be faster when
3279 doing lots of writes, but uses more space. The default is "off".
3280
3281 "compat"
3282 "qcow2" only: Pass the string 1.1 to use the advanced qcow2 format
3283 supported by qemu ≥ 1.1.
3284
3285 "clustersize"
3286 "qcow2" only: Change the qcow2 cluster size. The default is 65536
3287 (bytes) and this setting may be any power of two between 512 and
3288 2097152.
3289
3290 Note that this call does not add the new disk to the handle. You may
3291 need to call "add-drive-opts" separately.
3292
3293 This command has one or more optional arguments. See "OPTIONAL
3294 ARGUMENTS".
3295
3296 disk-format
3297 disk-format filename
3298
3299 Detect and return the format of the disk image called filename.
3300 filename can also be a host device, etc. If the format of the image
3301 could not be detected, then "unknown" is returned.
3302
3303 Note that detecting the disk format can be insecure under some
3304 circumstances. See "CVE-2010-3851" in guestfs(3).
3305
3306 See also: "DISK IMAGE FORMATS" in guestfs(3)
3307
3308 disk-has-backing-file
3309 disk-has-backing-file filename
3310
3311 Detect and return whether the disk image filename has a backing file.
3312
3313 Note that detecting disk features can be insecure under some
3314 circumstances. See "CVE-2010-3851" in guestfs(3).
3315
3316 disk-virtual-size
3317 disk-virtual-size filename
3318
3319 Detect and return the virtual size in bytes of the disk image called
3320 filename.
3321
3322 Note that detecting disk features can be insecure under some
3323 circumstances. See "CVE-2010-3851" in guestfs(3).
3324
3325 dmesg
3326 dmesg
3327
3328 This returns the kernel messages ("dmesg" output) from the guest
3329 kernel. This is sometimes useful for extended debugging of problems.
3330
3331 Another way to get the same information is to enable verbose messages
3332 with "set-verbose" or by setting the environment variable
3333 "LIBGUESTFS_DEBUG=1" before running the program.
3334
3335 download
3336 download remotefilename (filename|-)
3337
3338 Download file remotefilename and save it as filename on the local
3339 machine.
3340
3341 filename can also be a named pipe.
3342
3343 See also "upload", "cat".
3344
3345 Use "-" instead of a filename to read/write from stdin/stdout.
3346
3347 download-blocks
3348 download-blocks device start stop (filename|-) [unallocated:true|false]
3349
3350 Download the data units from start address to stop from the disk
3351 partition (eg. /dev/sda1) and save them as filename on the local
3352 machine.
3353
3354 The use of this API on sparse disk image formats such as QCOW, may
3355 result in large zero-filled files downloaded on the host.
3356
3357 The size of a data unit varies across filesystem implementations. On
3358 NTFS filesystems data units are referred as clusters while on ExtX ones
3359 they are referred as fragments.
3360
3361 If the optional "unallocated" flag is true (default is false), only the
3362 unallocated blocks will be extracted. This is useful to detect hidden
3363 data or to retrieve deleted files which data units have not been
3364 overwritten yet.
3365
3366 Use "-" instead of a filename to read/write from stdin/stdout.
3367
3368 This command has one or more optional arguments. See "OPTIONAL
3369 ARGUMENTS".
3370
3371 This command depends on the feature "sleuthkit". See also "feature-
3372 available".
3373
3374 download-inode
3375 download-inode device inode (filename|-)
3376
3377 Download a file given its inode from the disk partition (eg. /dev/sda1)
3378 and save it as filename on the local machine.
3379
3380 It is not required to mount the disk to run this command.
3381
3382 The command is capable of downloading deleted or inaccessible files.
3383
3384 Use "-" instead of a filename to read/write from stdin/stdout.
3385
3386 This command depends on the feature "sleuthkit". See also "feature-
3387 available".
3388
3389 download-offset
3390 download-offset remotefilename (filename|-) offset size
3391
3392 Download file remotefilename and save it as filename on the local
3393 machine.
3394
3395 remotefilename is read for "size" bytes starting at "offset" (this
3396 region must be within the file or device).
3397
3398 Note that there is no limit on the amount of data that can be
3399 downloaded with this call, unlike with "pread", and this call always
3400 reads the full amount unless an error occurs.
3401
3402 See also "download", "pread".
3403
3404 Use "-" instead of a filename to read/write from stdin/stdout.
3405
3406 drop-caches
3407 drop-caches whattodrop
3408
3409 This instructs the guest kernel to drop its page cache, and/or dentries
3410 and inode caches. The parameter "whattodrop" tells the kernel what
3411 precisely to drop, see http://linux-mm.org/Drop_Caches
3412
3413 Setting "whattodrop" to 3 should drop everything.
3414
3415 This automatically calls sync(2) before the operation, so that the
3416 maximum guest memory is freed.
3417
3418 du
3419 du path
3420
3421 This command runs the "du -s" command to estimate file space usage for
3422 "path".
3423
3424 "path" can be a file or a directory. If "path" is a directory then the
3425 estimate includes the contents of the directory and all subdirectories
3426 (recursively).
3427
3428 The result is the estimated size in kilobytes (ie. units of 1024
3429 bytes).
3430
3431 e2fsck
3432 e2fsck device [correct:true|false] [forceall:true|false]
3433
3434 This runs the ext2/ext3 filesystem checker on "device". It can take
3435 the following optional arguments:
3436
3437 "correct"
3438 Automatically repair the file system. This option will cause e2fsck
3439 to automatically fix any filesystem problems that can be safely
3440 fixed without human intervention.
3441
3442 This option may not be specified at the same time as the "forceall"
3443 option.
3444
3445 "forceall"
3446 Assume an answer of ‘yes’ to all questions; allows e2fsck to be
3447 used non-interactively.
3448
3449 This option may not be specified at the same time as the "correct"
3450 option.
3451
3452 This command has one or more optional arguments. See "OPTIONAL
3453 ARGUMENTS".
3454
3455 e2fsck-f
3456 e2fsck-f device
3457
3458 This runs "e2fsck -p -f device", ie. runs the ext2/ext3 filesystem
3459 checker on "device", noninteractively (-p), even if the filesystem
3460 appears to be clean (-f).
3461
3462 This function is deprecated. In new code, use the "e2fsck" call
3463 instead.
3464
3465 Deprecated functions will not be removed from the API, but the fact
3466 that they are deprecated indicates that there are problems with correct
3467 use of these functions.
3468
3469 echo-daemon
3470 echo-daemon 'words ...'
3471
3472 This command concatenates the list of "words" passed with single spaces
3473 between them and returns the resulting string.
3474
3475 You can use this command to test the connection through to the daemon.
3476
3477 See also "ping-daemon".
3478
3479 egrep
3480 egrep regex path
3481
3482 This calls the external "egrep" program and returns the matching lines.
3483
3484 Because of the message protocol, there is a transfer limit of somewhere
3485 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
3486
3487 This function is deprecated. In new code, use the "grep" call instead.
3488
3489 Deprecated functions will not be removed from the API, but the fact
3490 that they are deprecated indicates that there are problems with correct
3491 use of these functions.
3492
3493 egrepi
3494 egrepi regex path
3495
3496 This calls the external "egrep -i" program and returns the matching
3497 lines.
3498
3499 Because of the message protocol, there is a transfer limit of somewhere
3500 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
3501
3502 This function is deprecated. In new code, use the "grep" call instead.
3503
3504 Deprecated functions will not be removed from the API, but the fact
3505 that they are deprecated indicates that there are problems with correct
3506 use of these functions.
3507
3508 equal
3509 equal file1 file2
3510
3511 This compares the two files file1 and file2 and returns true if their
3512 content is exactly equal, or false otherwise.
3513
3514 The external cmp(1) program is used for the comparison.
3515
3516 exists
3517 exists path
3518
3519 This returns "true" if and only if there is a file, directory (or
3520 anything) with the given "path" name.
3521
3522 See also "is-file", "is-dir", "stat".
3523
3524 extlinux
3525 extlinux directory
3526
3527 Install the SYSLINUX bootloader on the device mounted at directory.
3528 Unlike "syslinux" which requires a FAT filesystem, this can be used on
3529 an ext2/3/4 or btrfs filesystem.
3530
3531 The directory parameter can be either a mountpoint, or a directory
3532 within the mountpoint.
3533
3534 You also have to mark the partition as "active" ("part-set-bootable")
3535 and a Master Boot Record must be installed (eg. using "pwrite-device")
3536 on the first sector of the whole disk. The SYSLINUX package comes with
3537 some suitable Master Boot Records. See the extlinux(1) man page for
3538 further information.
3539
3540 Additional configuration can be supplied to SYSLINUX by placing a file
3541 called extlinux.conf on the filesystem under directory. For further
3542 information about the contents of this file, see extlinux(1).
3543
3544 See also "syslinux".
3545
3546 This command depends on the feature "extlinux". See also "feature-
3547 available".
3548
3549 f2fs-expand
3550 f2fs-expand device
3551
3552 This expands a f2fs filesystem to match the size of the underlying
3553 device.
3554
3555 This command depends on the feature "f2fs". See also "feature-
3556 available".
3557
3558 fallocate
3559 fallocate path len
3560
3561 This command preallocates a file (containing zero bytes) named "path"
3562 of size "len" bytes. If the file exists already, it is overwritten.
3563
3564 Do not confuse this with the guestfish-specific "alloc" command which
3565 allocates a file in the host and attaches it as a device.
3566
3567 This function is deprecated. In new code, use the "fallocate64" call
3568 instead.
3569
3570 Deprecated functions will not be removed from the API, but the fact
3571 that they are deprecated indicates that there are problems with correct
3572 use of these functions.
3573
3574 fallocate64
3575 fallocate64 path len
3576
3577 This command preallocates a file (containing zero bytes) named "path"
3578 of size "len" bytes. If the file exists already, it is overwritten.
3579
3580 Note that this call allocates disk blocks for the file. To create a
3581 sparse file use "truncate-size" instead.
3582
3583 The deprecated call "fallocate" does the same, but owing to an
3584 oversight it only allowed 30 bit lengths to be specified, effectively
3585 limiting the maximum size of files created through that call to 1GB.
3586
3587 Do not confuse this with the guestfish-specific "alloc" and "sparse"
3588 commands which create a file in the host and attach it as a device.
3589
3590 feature-available
3591 feature-available 'groups ...'
3592
3593 This is the same as "available", but unlike that call it returns a
3594 simple true/false boolean result, instead of throwing an exception if a
3595 feature is not found. For other documentation see "available".
3596
3597 fgrep
3598 fgrep pattern path
3599
3600 This calls the external "fgrep" program and returns the matching lines.
3601
3602 Because of the message protocol, there is a transfer limit of somewhere
3603 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
3604
3605 This function is deprecated. In new code, use the "grep" call instead.
3606
3607 Deprecated functions will not be removed from the API, but the fact
3608 that they are deprecated indicates that there are problems with correct
3609 use of these functions.
3610
3611 fgrepi
3612 fgrepi pattern path
3613
3614 This calls the external "fgrep -i" program and returns the matching
3615 lines.
3616
3617 Because of the message protocol, there is a transfer limit of somewhere
3618 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
3619
3620 This function is deprecated. In new code, use the "grep" call instead.
3621
3622 Deprecated functions will not be removed from the API, but the fact
3623 that they are deprecated indicates that there are problems with correct
3624 use of these functions.
3625
3626 file
3627 file path
3628
3629 This call uses the standard file(1) command to determine the type or
3630 contents of the file.
3631
3632 This call will also transparently look inside various types of
3633 compressed file.
3634
3635 The exact command which runs is "file -zb path". Note in particular
3636 that the filename is not prepended to the output (the -b option).
3637
3638 The output depends on the output of the underlying file(1) command and
3639 it can change in future in ways beyond our control. In other words,
3640 the output is not guaranteed by the ABI.
3641
3642 See also: file(1), "vfs-type", "lstat", "is-file", "is-blockdev" (etc),
3643 "is-zero".
3644
3645 file-architecture
3646 file-architecture filename
3647
3648 This detects the architecture of the binary filename, and returns it if
3649 known.
3650
3651 Currently defined architectures are:
3652
3653 "aarch64"
3654 64 bit ARM.
3655
3656 "arm"
3657 32 bit ARM.
3658
3659 "i386"
3660 This string is returned for all 32 bit i386, i486, i586, i686
3661 binaries irrespective of the precise processor requirements of the
3662 binary.
3663
3664 "ia64"
3665 Intel Itanium.
3666
3667 "ppc"
3668 32 bit Power PC.
3669
3670 "ppc64"
3671 64 bit Power PC (big endian).
3672
3673 "ppc64le"
3674 64 bit Power PC (little endian).
3675
3676 "riscv32"
3677 "riscv64"
3678 "riscv128"
3679 RISC-V 32-, 64- or 128-bit variants.
3680
3681 "s390"
3682 31 bit IBM S/390.
3683
3684 "s390x"
3685 64 bit IBM S/390.
3686
3687 "sparc"
3688 32 bit SPARC.
3689
3690 "sparc64"
3691 64 bit SPARC V9 and above.
3692
3693 "x86_64"
3694 64 bit x86-64.
3695
3696 Libguestfs may return other architecture strings in future.
3697
3698 The function works on at least the following types of files:
3699
3700 · many types of Un*x and Linux binary
3701
3702 · many types of Un*x and Linux shared library
3703
3704 · Windows Win32 and Win64 binaries
3705
3706 · Windows Win32 and Win64 DLLs
3707
3708 Win32 binaries and DLLs return "i386".
3709
3710 Win64 binaries and DLLs return "x86_64".
3711
3712 · Linux kernel modules
3713
3714 · Linux new-style initrd images
3715
3716 · some non-x86 Linux vmlinuz kernels
3717
3718 What it can't do currently:
3719
3720 · static libraries (libfoo.a)
3721
3722 · Linux old-style initrd as compressed ext2 filesystem (RHEL 3)
3723
3724 · x86 Linux vmlinuz kernels
3725
3726 x86 vmlinuz images (bzImage format) consist of a mix of 16-, 32-
3727 and compressed code, and are horribly hard to unpack. If you want
3728 to find the architecture of a kernel, use the architecture of the
3729 associated initrd or kernel module(s) instead.
3730
3731 filesize
3732 filesize file
3733
3734 This command returns the size of file in bytes.
3735
3736 To get other stats about a file, use "stat", "lstat", "is-dir", "is-
3737 file" etc. To get the size of block devices, use "blockdev-getsize64".
3738
3739 filesystem-available
3740 filesystem-available filesystem
3741
3742 Check whether libguestfs supports the named filesystem. The argument
3743 "filesystem" is a filesystem name, such as "ext3".
3744
3745 You must call "launch" before using this command.
3746
3747 This is mainly useful as a negative test. If this returns true, it
3748 doesn't mean that a particular filesystem can be created or mounted,
3749 since filesystems can fail for other reasons such as it being a later
3750 version of the filesystem, or having incompatible features, or lacking
3751 the right mkfs.<fs> tool.
3752
3753 See also "available", "feature-available", "AVAILABILITY" in
3754 guestfs(3).
3755
3756 filesystem-walk
3757 filesystem-walk device
3758
3759 Walk through the internal structures of a disk partition (eg.
3760 /dev/sda1) in order to return a list of all the files and directories
3761 stored within.
3762
3763 It is not necessary to mount the disk partition to run this command.
3764
3765 All entries in the filesystem are returned. This function can list
3766 deleted or unaccessible files. The entries are not sorted.
3767
3768 The "tsk_dirent" structure contains the following fields.
3769
3770 "tsk_inode"
3771 Filesystem reference number of the node. It might be 0 if the node
3772 has been deleted.
3773
3774 "tsk_type"
3775 Basic file type information. See below for a detailed list of
3776 values.
3777
3778 "tsk_size"
3779 File size in bytes. It might be "-1" if the node has been deleted.
3780
3781 "tsk_name"
3782 The file path relative to its directory.
3783
3784 "tsk_flags"
3785 Bitfield containing extra information regarding the entry. It
3786 contains the logical OR of the following values:
3787
3788 0x0001
3789 If set to 1, the file is allocated and visible within the
3790 filesystem. Otherwise, the file has been deleted. Under
3791 certain circumstances, the function "download_inode" can be
3792 used to recover deleted files.
3793
3794 0x0002
3795 Filesystem such as NTFS and Ext2 or greater, separate the file
3796 name from the metadata structure. The bit is set to 1 when the
3797 file name is in an unallocated state and the metadata structure
3798 is in an allocated one. This generally implies the metadata
3799 has been reallocated to a new file. Therefore, information
3800 such as file type, file size, timestamps, number of links and
3801 symlink target might not correspond with the ones of the
3802 original deleted entry.
3803
3804 0x0004
3805 The bit is set to 1 when the file is compressed using
3806 filesystem native compression support (NTFS). The API is not
3807 able to detect application level compression.
3808
3809 "tsk_atime_sec"
3810 "tsk_atime_nsec"
3811 "tsk_mtime_sec"
3812 "tsk_mtime_nsec"
3813 "tsk_ctime_sec"
3814 "tsk_ctime_nsec"
3815 "tsk_crtime_sec"
3816 "tsk_crtime_nsec"
3817 Respectively, access, modification, last status change and creation
3818 time in Unix format in seconds and nanoseconds.
3819
3820 "tsk_nlink"
3821 Number of file names pointing to this entry.
3822
3823 "tsk_link"
3824 If the entry is a symbolic link, this field will contain the path
3825 to the target file.
3826
3827 The "tsk_type" field will contain one of the following characters:
3828
3829 'b' Block special
3830
3831 'c' Char special
3832
3833 'd' Directory
3834
3835 'f' FIFO (named pipe)
3836
3837 'l' Symbolic link
3838
3839 'r' Regular file
3840
3841 's' Socket
3842
3843 'h' Shadow inode (Solaris)
3844
3845 'w' Whiteout inode (BSD)
3846
3847 'u' Unknown file type
3848
3849 This command depends on the feature "libtsk". See also "feature-
3850 available".
3851
3852 fill
3853 fill c len path
3854
3855 This command creates a new file called "path". The initial content of
3856 the file is "len" octets of "c", where "c" must be a number in the
3857 range "[0..255]".
3858
3859 To fill a file with zero bytes (sparsely), it is much more efficient to
3860 use "truncate-size". To create a file with a pattern of repeating
3861 bytes use "fill-pattern".
3862
3863 fill-dir
3864 fill-dir dir nr
3865
3866 This function, useful for testing filesystems, creates "nr" empty files
3867 in the directory "dir" with names 00000000 through "nr-1" (ie. each
3868 file name is 8 digits long padded with zeroes).
3869
3870 fill-pattern
3871 fill-pattern pattern len path
3872
3873 This function is like "fill" except that it creates a new file of
3874 length "len" containing the repeating pattern of bytes in "pattern".
3875 The pattern is truncated if necessary to ensure the length of the file
3876 is exactly "len" bytes.
3877
3878 find
3879 find directory
3880
3881 This command lists out all files and directories, recursively, starting
3882 at directory. It is essentially equivalent to running the shell
3883 command "find directory -print" but some post-processing happens on the
3884 output, described below.
3885
3886 This returns a list of strings without any prefix. Thus if the
3887 directory structure was:
3888
3889 /tmp/a
3890 /tmp/b
3891 /tmp/c/d
3892
3893 then the returned list from "find" /tmp would be 4 elements:
3894
3895 a
3896 b
3897 c
3898 c/d
3899
3900 If directory is not a directory, then this command returns an error.
3901
3902 The returned list is sorted.
3903
3904 find0
3905 find0 directory (files|-)
3906
3907 This command lists out all files and directories, recursively, starting
3908 at directory, placing the resulting list in the external file called
3909 files.
3910
3911 This command works the same way as "find" with the following
3912 exceptions:
3913
3914 · The resulting list is written to an external file.
3915
3916 · Items (filenames) in the result are separated by "\0" characters.
3917 See find(1) option -print0.
3918
3919 · The result list is not sorted.
3920
3921 Use "-" instead of a filename to read/write from stdin/stdout.
3922
3923 find-inode
3924 find-inode device inode
3925
3926 Searches all the entries associated with the given inode.
3927
3928 For each entry, a "tsk_dirent" structure is returned. See
3929 "filesystem_walk" for more information about "tsk_dirent" structures.
3930
3931 This command depends on the feature "libtsk". See also "feature-
3932 available".
3933
3934 findfs-label
3935 findfs-label label
3936
3937 This command searches the filesystems and returns the one which has the
3938 given label. An error is returned if no such filesystem can be found.
3939
3940 To find the label of a filesystem, use "vfs-label".
3941
3942 findfs-uuid
3943 findfs-uuid uuid
3944
3945 This command searches the filesystems and returns the one which has the
3946 given UUID. An error is returned if no such filesystem can be found.
3947
3948 To find the UUID of a filesystem, use "vfs-uuid".
3949
3950 fsck
3951 fsck fstype device
3952
3953 This runs the filesystem checker (fsck) on "device" which should have
3954 filesystem type "fstype".
3955
3956 The returned integer is the status. See fsck(8) for the list of status
3957 codes from "fsck".
3958
3959 Notes:
3960
3961 · Multiple status codes can be summed together.
3962
3963 · A non-zero return code can mean "success", for example if errors
3964 have been corrected on the filesystem.
3965
3966 · Checking or repairing NTFS volumes is not supported (by linux-
3967 ntfs).
3968
3969 This command is entirely equivalent to running "fsck -a -t fstype
3970 device".
3971
3972 fstrim
3973 fstrim mountpoint [offset:N] [length:N] [minimumfreeextent:N]
3974
3975 Trim the free space in the filesystem mounted on "mountpoint". The
3976 filesystem must be mounted read-write.
3977
3978 The filesystem contents are not affected, but any free space in the
3979 filesystem is "trimmed", that is, given back to the host device, thus
3980 making disk images more sparse, allowing unused space in qcow2 files to
3981 be reused, etc.
3982
3983 This operation requires support in libguestfs, the mounted filesystem,
3984 the host filesystem, qemu and the host kernel. If this support isn't
3985 present it may give an error or even appear to run but do nothing.
3986
3987 In the case where the kernel vfs driver does not support trimming, this
3988 call will fail with errno set to "ENOTSUP". Currently this happens
3989 when trying to trim FAT filesystems.
3990
3991 See also "zero-free-space". That is a slightly different operation
3992 that turns free space in the filesystem into zeroes. It is valid to
3993 call "fstrim" either instead of, or after calling "zero-free-space".
3994
3995 This command has one or more optional arguments. See "OPTIONAL
3996 ARGUMENTS".
3997
3998 This command depends on the feature "fstrim". See also "feature-
3999 available".
4000
4001 get-append
4002 get-append
4003
4004 Return the additional kernel options which are added to the libguestfs
4005 appliance kernel command line.
4006
4007 If "NULL" then no options are added.
4008
4009 get-attach-method
4010 get-attach-method
4011
4012 Return the current backend.
4013
4014 See "set-backend" and "BACKEND" in guestfs(3).
4015
4016 This function is deprecated. In new code, use the "get-backend" call
4017 instead.
4018
4019 Deprecated functions will not be removed from the API, but the fact
4020 that they are deprecated indicates that there are problems with correct
4021 use of these functions.
4022
4023 get-autosync
4024 get-autosync
4025
4026 Get the autosync flag.
4027
4028 get-backend
4029 get-backend
4030
4031 Return the current backend.
4032
4033 This handle property was previously called the "attach method".
4034
4035 See "set-backend" and "BACKEND" in guestfs(3).
4036
4037 get-backend-setting
4038 get-backend-setting name
4039
4040 Find a backend setting string which is either "name" or begins with
4041 "name=". If "name", this returns the string "1". If "name=", this
4042 returns the part after the equals sign (which may be an empty string).
4043
4044 If no such setting is found, this function throws an error. The errno
4045 (see "last-errno") will be "ESRCH" in this case.
4046
4047 See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
4048
4049 get-backend-settings
4050 get-backend-settings
4051
4052 Return the current backend settings.
4053
4054 This call returns all backend settings strings. If you want to find a
4055 single backend setting, see "get-backend-setting".
4056
4057 See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
4058
4059 get-cachedir
4060 get-cachedir
4061
4062 Get the directory used by the handle to store the appliance cache.
4063
4064 get-direct
4065 get-direct
4066
4067 Return the direct appliance mode flag.
4068
4069 This function is deprecated. In new code, use the "internal-get-
4070 console-socket" call instead.
4071
4072 Deprecated functions will not be removed from the API, but the fact
4073 that they are deprecated indicates that there are problems with correct
4074 use of these functions.
4075
4076 get-e2attrs
4077 get-e2attrs file
4078
4079 This returns the file attributes associated with file.
4080
4081 The attributes are a set of bits associated with each inode which
4082 affect the behaviour of the file. The attributes are returned as a
4083 string of letters (described below). The string may be empty,
4084 indicating that no file attributes are set for this file.
4085
4086 These attributes are only present when the file is located on an
4087 ext2/3/4 filesystem. Using this call on other filesystem types will
4088 result in an error.
4089
4090 The characters (file attributes) in the returned string are currently:
4091
4092 'A' When the file is accessed, its atime is not modified.
4093
4094 'a' The file is append-only.
4095
4096 'c' The file is compressed on-disk.
4097
4098 'D' (Directories only.) Changes to this directory are written
4099 synchronously to disk.
4100
4101 'd' The file is not a candidate for backup (see dump(8)).
4102
4103 'E' The file has compression errors.
4104
4105 'e' The file is using extents.
4106
4107 'h' The file is storing its blocks in units of the filesystem blocksize
4108 instead of sectors.
4109
4110 'I' (Directories only.) The directory is using hashed trees.
4111
4112 'i' The file is immutable. It cannot be modified, deleted or renamed.
4113 No link can be created to this file.
4114
4115 'j' The file is data-journaled.
4116
4117 's' When the file is deleted, all its blocks will be zeroed.
4118
4119 'S' Changes to this file are written synchronously to disk.
4120
4121 'T' (Directories only.) This is a hint to the block allocator that
4122 subdirectories contained in this directory should be spread across
4123 blocks. If not present, the block allocator will try to group
4124 subdirectories together.
4125
4126 't' For a file, this disables tail-merging. (Not used by upstream
4127 implementations of ext2.)
4128
4129 'u' When the file is deleted, its blocks will be saved, allowing the
4130 file to be undeleted.
4131
4132 'X' The raw contents of the compressed file may be accessed.
4133
4134 'Z' The compressed file is dirty.
4135
4136 More file attributes may be added to this list later. Not all file
4137 attributes may be set for all kinds of files. For detailed
4138 information, consult the chattr(1) man page.
4139
4140 See also "set-e2attrs".
4141
4142 Don't confuse these attributes with extended attributes (see
4143 "getxattr").
4144
4145 get-e2generation
4146 get-e2generation file
4147
4148 This returns the ext2 file generation of a file. The generation (which
4149 used to be called the "version") is a number associated with an inode.
4150 This is most commonly used by NFS servers.
4151
4152 The generation is only present when the file is located on an ext2/3/4
4153 filesystem. Using this call on other filesystem types will result in
4154 an error.
4155
4156 See "set-e2generation".
4157
4158 get-e2label
4159 get-e2label device
4160
4161 This returns the ext2/3/4 filesystem label of the filesystem on
4162 "device".
4163
4164 This function is deprecated. In new code, use the "vfs-label" call
4165 instead.
4166
4167 Deprecated functions will not be removed from the API, but the fact
4168 that they are deprecated indicates that there are problems with correct
4169 use of these functions.
4170
4171 get-e2uuid
4172 get-e2uuid device
4173
4174 This returns the ext2/3/4 filesystem UUID of the filesystem on
4175 "device".
4176
4177 This function is deprecated. In new code, use the "vfs-uuid" call
4178 instead.
4179
4180 Deprecated functions will not be removed from the API, but the fact
4181 that they are deprecated indicates that there are problems with correct
4182 use of these functions.
4183
4184 get-hv
4185 get-hv
4186
4187 Return the current hypervisor binary.
4188
4189 This is always non-NULL. If it wasn't set already, then this will
4190 return the default qemu binary name.
4191
4192 get-identifier
4193 get-identifier
4194
4195 Get the handle identifier. See "set-identifier".
4196
4197 get-libvirt-requested-credential-challenge
4198 get-libvirt-requested-credential-challenge index
4199
4200 Get the challenge (provided by libvirt) for the "index"'th requested
4201 credential. If libvirt did not provide a challenge, this returns the
4202 empty string "".
4203
4204 See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
4205 example code.
4206
4207 get-libvirt-requested-credential-defresult
4208 get-libvirt-requested-credential-defresult index
4209
4210 Get the default result (provided by libvirt) for the "index"'th
4211 requested credential. If libvirt did not provide a default result,
4212 this returns the empty string "".
4213
4214 See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
4215 example code.
4216
4217 get-libvirt-requested-credential-prompt
4218 get-libvirt-requested-credential-prompt index
4219
4220 Get the prompt (provided by libvirt) for the "index"'th requested
4221 credential. If libvirt did not provide a prompt, this returns the
4222 empty string "".
4223
4224 See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
4225 example code.
4226
4227 get-libvirt-requested-credentials
4228 get-libvirt-requested-credentials
4229
4230 This should only be called during the event callback for events of type
4231 "GUESTFS_EVENT_LIBVIRT_AUTH".
4232
4233 Return the list of credentials requested by libvirt. Possible values
4234 are a subset of the strings provided when you called "set-libvirt-
4235 supported-credentials".
4236
4237 See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
4238 example code.
4239
4240 get-memsize
4241 get-memsize
4242
4243 This gets the memory size in megabytes allocated to the hypervisor.
4244
4245 If "set-memsize" was not called on this handle, and if
4246 "LIBGUESTFS_MEMSIZE" was not set, then this returns the compiled-in
4247 default value for memsize.
4248
4249 For more information on the architecture of libguestfs, see guestfs(3).
4250
4251 get-network
4252 get-network
4253
4254 This returns the enable network flag.
4255
4256 get-path
4257 get-path
4258
4259 Return the current search path.
4260
4261 This is always non-NULL. If it wasn't set already, then this will
4262 return the default path.
4263
4264 get-pgroup
4265 get-pgroup
4266
4267 This returns the process group flag.
4268
4269 get-pid
4270 pid
4271 get-pid
4272
4273 Return the process ID of the hypervisor. If there is no hypervisor
4274 running, then this will return an error.
4275
4276 This is an internal call used for debugging and testing.
4277
4278 get-program
4279 get-program
4280
4281 Get the program name. See "set-program".
4282
4283 get-qemu
4284 get-qemu
4285
4286 Return the current hypervisor binary (usually qemu).
4287
4288 This is always non-NULL. If it wasn't set already, then this will
4289 return the default qemu binary name.
4290
4291 This function is deprecated. In new code, use the "get-hv" call
4292 instead.
4293
4294 Deprecated functions will not be removed from the API, but the fact
4295 that they are deprecated indicates that there are problems with correct
4296 use of these functions.
4297
4298 get-recovery-proc
4299 get-recovery-proc
4300
4301 Return the recovery process enabled flag.
4302
4303 get-selinux
4304 get-selinux
4305
4306 This returns the current setting of the selinux flag which is passed to
4307 the appliance at boot time. See "set-selinux".
4308
4309 For more information on the architecture of libguestfs, see guestfs(3).
4310
4311 This function is deprecated. In new code, use the "selinux-relabel"
4312 call instead.
4313
4314 Deprecated functions will not be removed from the API, but the fact
4315 that they are deprecated indicates that there are problems with correct
4316 use of these functions.
4317
4318 get-smp
4319 get-smp
4320
4321 This returns the number of virtual CPUs assigned to the appliance.
4322
4323 get-sockdir
4324 get-sockdir
4325
4326 Get the directory used by the handle to store temporary socket files.
4327
4328 This is different from "tmpdir", as we need shorter paths for sockets
4329 (due to the limited buffers of filenames for UNIX sockets), and
4330 "tmpdir" may be too long for them.
4331
4332 The environment variable "XDG_RUNTIME_DIR" controls the default value:
4333 If "XDG_RUNTIME_DIR" is set, then that is the default. Else /tmp is
4334 the default.
4335
4336 get-tmpdir
4337 get-tmpdir
4338
4339 Get the directory used by the handle to store temporary files.
4340
4341 get-trace
4342 get-trace
4343
4344 Return the command trace flag.
4345
4346 get-umask
4347 get-umask
4348
4349 Return the current umask. By default the umask is 022 unless it has
4350 been set by calling "umask".
4351
4352 get-verbose
4353 get-verbose
4354
4355 This returns the verbose messages flag.
4356
4357 getcon
4358 getcon
4359
4360 This gets the SELinux security context of the daemon.
4361
4362 See the documentation about SELINUX in guestfs(3), and "setcon"
4363
4364 This function is deprecated. In new code, use the "selinux-relabel"
4365 call instead.
4366
4367 Deprecated functions will not be removed from the API, but the fact
4368 that they are deprecated indicates that there are problems with correct
4369 use of these functions.
4370
4371 This command depends on the feature "selinux". See also "feature-
4372 available".
4373
4374 getxattr
4375 getxattr path name
4376
4377 Get a single extended attribute from file "path" named "name". This
4378 call follows symlinks. If you want to lookup an extended attribute for
4379 the symlink itself, use "lgetxattr".
4380
4381 Normally it is better to get all extended attributes from a file in one
4382 go by calling "getxattrs". However some Linux filesystem
4383 implementations are buggy and do not provide a way to list out
4384 attributes. For these filesystems (notably ntfs-3g) you have to know
4385 the names of the extended attributes you want in advance and call this
4386 function.
4387
4388 Extended attribute values are blobs of binary data. If there is no
4389 extended attribute named "name", this returns an error.
4390
4391 See also: "getxattrs", "lgetxattr", attr(5).
4392
4393 This command depends on the feature "linuxxattrs". See also "feature-
4394 available".
4395
4396 getxattrs
4397 getxattrs path
4398
4399 This call lists the extended attributes of the file or directory
4400 "path".
4401
4402 At the system call level, this is a combination of the listxattr(2) and
4403 getxattr(2) calls.
4404
4405 See also: "lgetxattrs", attr(5).
4406
4407 This command depends on the feature "linuxxattrs". See also "feature-
4408 available".
4409
4410 glob-expand
4411 glob-expand-opts
4412 glob-expand pattern [directoryslash:true|false]
4413
4414 This command searches for all the pathnames matching "pattern"
4415 according to the wildcard expansion rules used by the shell.
4416
4417 If no paths match, then this returns an empty list (note: not an
4418 error).
4419
4420 It is just a wrapper around the C glob(3) function with flags
4421 "GLOB_MARK|GLOB_BRACE". See that manual page for more details.
4422
4423 "directoryslash" controls whether use the "GLOB_MARK" flag for glob(3),
4424 and it defaults to true. It can be explicitly set as off to return no
4425 trailing slashes in filenames of directories.
4426
4427 Notice that there is no equivalent command for expanding a device name
4428 (eg. /dev/sd*). Use "list-devices", "list-partitions" etc functions
4429 instead.
4430
4431 This command has one or more optional arguments. See "OPTIONAL
4432 ARGUMENTS".
4433
4434 grep
4435 grep-opts
4436 grep regex path [extended:true|false] [fixed:true|false] [insensitive:true|false] [compressed:true|false]
4437
4438 This calls the external "grep" program and returns the matching lines.
4439
4440 The optional flags are:
4441
4442 "extended"
4443 Use extended regular expressions. This is the same as using the -E
4444 flag.
4445
4446 "fixed"
4447 Match fixed (don't use regular expressions). This is the same as
4448 using the -F flag.
4449
4450 "insensitive"
4451 Match case-insensitive. This is the same as using the -i flag.
4452
4453 "compressed"
4454 Use "zgrep" instead of "grep". This allows the input to be
4455 compress- or gzip-compressed.
4456
4457 This command has one or more optional arguments. See "OPTIONAL
4458 ARGUMENTS".
4459
4460 Because of the message protocol, there is a transfer limit of somewhere
4461 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
4462
4463 grepi
4464 grepi regex path
4465
4466 This calls the external "grep -i" program and returns the matching
4467 lines.
4468
4469 Because of the message protocol, there is a transfer limit of somewhere
4470 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
4471
4472 This function is deprecated. In new code, use the "grep" call instead.
4473
4474 Deprecated functions will not be removed from the API, but the fact
4475 that they are deprecated indicates that there are problems with correct
4476 use of these functions.
4477
4478 grub-install
4479 grub-install root device
4480
4481 This command installs GRUB 1 (the Grand Unified Bootloader) on
4482 "device", with the root directory being "root".
4483
4484 Notes:
4485
4486 · There is currently no way in the API to install grub2, which is
4487 used by most modern Linux guests. It is possible to run the grub2
4488 command from the guest, although see the caveats in "RUNNING
4489 COMMANDS" in guestfs(3).
4490
4491 · This uses "grub-install" from the host. Unfortunately grub is not
4492 always compatible with itself, so this only works in rather narrow
4493 circumstances. Careful testing with each guest version is
4494 advisable.
4495
4496 · If grub-install reports the error "No suitable drive was found in
4497 the generated device map." it may be that you need to create a
4498 /boot/grub/device.map file first that contains the mapping between
4499 grub device names and Linux device names. It is usually sufficient
4500 to create a file containing:
4501
4502 (hd0) /dev/vda
4503
4504 replacing /dev/vda with the name of the installation device.
4505
4506 This command depends on the feature "grub". See also "feature-
4507 available".
4508
4509 head
4510 head path
4511
4512 This command returns up to the first 10 lines of a file as a list of
4513 strings.
4514
4515 Because of the message protocol, there is a transfer limit of somewhere
4516 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
4517
4518 head-n
4519 head-n nrlines path
4520
4521 If the parameter "nrlines" is a positive number, this returns the first
4522 "nrlines" lines of the file "path".
4523
4524 If the parameter "nrlines" is a negative number, this returns lines
4525 from the file "path", excluding the last "nrlines" lines.
4526
4527 If the parameter "nrlines" is zero, this returns an empty list.
4528
4529 Because of the message protocol, there is a transfer limit of somewhere
4530 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
4531
4532 hexdump
4533 hexdump path
4534
4535 This runs "hexdump -C" on the given "path". The result is the human-
4536 readable, canonical hex dump of the file.
4537
4538 Because of the message protocol, there is a transfer limit of somewhere
4539 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
4540
4541 hivex-close
4542 hivex-close
4543
4544 Close the current hivex handle.
4545
4546 This is a wrapper around the hivex(3) call of the same name.
4547
4548 This command depends on the feature "hivex". See also "feature-
4549 available".
4550
4551 hivex-commit
4552 hivex-commit filename
4553
4554 Commit (write) changes to the hive.
4555
4556 If the optional filename parameter is null, then the changes are
4557 written back to the same hive that was opened. If this is not null
4558 then they are written to the alternate filename given and the original
4559 hive is left untouched.
4560
4561 This is a wrapper around the hivex(3) call of the same name.
4562
4563 This command depends on the feature "hivex". See also "feature-
4564 available".
4565
4566 hivex-node-add-child
4567 hivex-node-add-child parent name
4568
4569 Add a child node to "parent" named "name".
4570
4571 This is a wrapper around the hivex(3) call of the same name.
4572
4573 This command depends on the feature "hivex". See also "feature-
4574 available".
4575
4576 hivex-node-children
4577 hivex-node-children nodeh
4578
4579 Return the list of nodes which are subkeys of "nodeh".
4580
4581 This is a wrapper around the hivex(3) call of the same name.
4582
4583 This command depends on the feature "hivex". See also "feature-
4584 available".
4585
4586 hivex-node-delete-child
4587 hivex-node-delete-child nodeh
4588
4589 Delete "nodeh", recursively if necessary.
4590
4591 This is a wrapper around the hivex(3) call of the same name.
4592
4593 This command depends on the feature "hivex". See also "feature-
4594 available".
4595
4596 hivex-node-get-child
4597 hivex-node-get-child nodeh name
4598
4599 Return the child of "nodeh" with the name "name", if it exists. This
4600 can return 0 meaning the name was not found.
4601
4602 This is a wrapper around the hivex(3) call of the same name.
4603
4604 This command depends on the feature "hivex". See also "feature-
4605 available".
4606
4607 hivex-node-get-value
4608 hivex-node-get-value nodeh key
4609
4610 Return the value attached to "nodeh" which has the name "key", if it
4611 exists. This can return 0 meaning the key was not found.
4612
4613 This is a wrapper around the hivex(3) call of the same name.
4614
4615 This command depends on the feature "hivex". See also "feature-
4616 available".
4617
4618 hivex-node-name
4619 hivex-node-name nodeh
4620
4621 Return the name of "nodeh".
4622
4623 This is a wrapper around the hivex(3) call of the same name.
4624
4625 This command depends on the feature "hivex". See also "feature-
4626 available".
4627
4628 hivex-node-parent
4629 hivex-node-parent nodeh
4630
4631 Return the parent node of "nodeh".
4632
4633 This is a wrapper around the hivex(3) call of the same name.
4634
4635 This command depends on the feature "hivex". See also "feature-
4636 available".
4637
4638 hivex-node-set-value
4639 hivex-node-set-value nodeh key t val
4640
4641 Set or replace a single value under the node "nodeh". The "key" is the
4642 name, "t" is the type, and "val" is the data.
4643
4644 This is a wrapper around the hivex(3) call of the same name.
4645
4646 This command depends on the feature "hivex". See also "feature-
4647 available".
4648
4649 hivex-node-values
4650 hivex-node-values nodeh
4651
4652 Return the array of (key, datatype, data) tuples attached to "nodeh".
4653
4654 This is a wrapper around the hivex(3) call of the same name.
4655
4656 This command depends on the feature "hivex". See also "feature-
4657 available".
4658
4659 hivex-open
4660 hivex-open filename [verbose:true|false] [debug:true|false] [write:true|false] [unsafe:true|false]
4661
4662 Open the Windows Registry hive file named filename. If there was any
4663 previous hivex handle associated with this guestfs session, then it is
4664 closed.
4665
4666 This is a wrapper around the hivex(3) call of the same name.
4667
4668 This command has one or more optional arguments. See "OPTIONAL
4669 ARGUMENTS".
4670
4671 This command depends on the feature "hivex". See also "feature-
4672 available".
4673
4674 hivex-root
4675 hivex-root
4676
4677 Return the root node of the hive.
4678
4679 This is a wrapper around the hivex(3) call of the same name.
4680
4681 This command depends on the feature "hivex". See also "feature-
4682 available".
4683
4684 hivex-value-key
4685 hivex-value-key valueh
4686
4687 Return the key (name) field of a (key, datatype, data) tuple.
4688
4689 This is a wrapper around the hivex(3) call of the same name.
4690
4691 This command depends on the feature "hivex". See also "feature-
4692 available".
4693
4694 hivex-value-string
4695 hivex-value-string valueh
4696
4697 This calls "hivex-value-value" (which returns the data field from a
4698 hivex value tuple). It then assumes that the field is a UTF-16LE
4699 string and converts the result to UTF-8 (or if this is not possible, it
4700 returns an error).
4701
4702 This is useful for reading strings out of the Windows registry.
4703 However it is not foolproof because the registry is not strongly-typed
4704 and fields can contain arbitrary or unexpected data.
4705
4706 This command depends on the feature "hivex". See also "feature-
4707 available".
4708
4709 hivex-value-type
4710 hivex-value-type valueh
4711
4712 Return the data type field from a (key, datatype, data) tuple.
4713
4714 This is a wrapper around the hivex(3) call of the same name.
4715
4716 This command depends on the feature "hivex". See also "feature-
4717 available".
4718
4719 hivex-value-utf8
4720 hivex-value-utf8 valueh
4721
4722 This calls "hivex-value-value" (which returns the data field from a
4723 hivex value tuple). It then assumes that the field is a UTF-16LE
4724 string and converts the result to UTF-8 (or if this is not possible, it
4725 returns an error).
4726
4727 This is useful for reading strings out of the Windows registry.
4728 However it is not foolproof because the registry is not strongly-typed
4729 and fields can contain arbitrary or unexpected data.
4730
4731 This function is deprecated. In new code, use the "hivex-value-string"
4732 call instead.
4733
4734 Deprecated functions will not be removed from the API, but the fact
4735 that they are deprecated indicates that there are problems with correct
4736 use of these functions.
4737
4738 This command depends on the feature "hivex". See also "feature-
4739 available".
4740
4741 hivex-value-value
4742 hivex-value-value valueh
4743
4744 Return the data field of a (key, datatype, data) tuple.
4745
4746 This is a wrapper around the hivex(3) call of the same name.
4747
4748 See also: "hivex-value-utf8".
4749
4750 This command depends on the feature "hivex". See also "feature-
4751 available".
4752
4753 initrd-cat
4754 initrd-cat initrdpath filename
4755
4756 This command unpacks the file filename from the initrd file called
4757 initrdpath. The filename must be given without the initial /
4758 character.
4759
4760 For example, in guestfish you could use the following command to
4761 examine the boot script (usually called /init) contained in a Linux
4762 initrd or initramfs image:
4763
4764 initrd-cat /boot/initrd-<version>.img init
4765
4766 See also "initrd-list".
4767
4768 Because of the message protocol, there is a transfer limit of somewhere
4769 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
4770
4771 initrd-list
4772 initrd-list path
4773
4774 This command lists out files contained in an initrd.
4775
4776 The files are listed without any initial / character. The files are
4777 listed in the order they appear (not necessarily alphabetical).
4778 Directory names are listed as separate items.
4779
4780 Old Linux kernels (2.4 and earlier) used a compressed ext2 filesystem
4781 as initrd. We only support the newer initramfs format (compressed cpio
4782 files).
4783
4784 inotify-add-watch
4785 inotify-add-watch path mask
4786
4787 Watch "path" for the events listed in "mask".
4788
4789 Note that if "path" is a directory then events within that directory
4790 are watched, but this does not happen recursively (in subdirectories).
4791
4792 Note for non-C or non-Linux callers: the inotify events are defined by
4793 the Linux kernel ABI and are listed in /usr/include/sys/inotify.h.
4794
4795 This command depends on the feature "inotify". See also "feature-
4796 available".
4797
4798 inotify-close
4799 inotify-close
4800
4801 This closes the inotify handle which was previously opened by
4802 inotify_init. It removes all watches, throws away any pending events,
4803 and deallocates all resources.
4804
4805 This command depends on the feature "inotify". See also "feature-
4806 available".
4807
4808 inotify-files
4809 inotify-files
4810
4811 This function is a helpful wrapper around "inotify-read" which just
4812 returns a list of pathnames of objects that were touched. The returned
4813 pathnames are sorted and deduplicated.
4814
4815 This command depends on the feature "inotify". See also "feature-
4816 available".
4817
4818 inotify-init
4819 inotify-init maxevents
4820
4821 This command creates a new inotify handle. The inotify subsystem can
4822 be used to notify events which happen to objects in the guest
4823 filesystem.
4824
4825 "maxevents" is the maximum number of events which will be queued up
4826 between calls to "inotify-read" or "inotify-files". If this is passed
4827 as 0, then the kernel (or previously set) default is used. For Linux
4828 2.6.29 the default was 16384 events. Beyond this limit, the kernel
4829 throws away events, but records the fact that it threw them away by
4830 setting a flag "IN_Q_OVERFLOW" in the returned structure list (see
4831 "inotify-read").
4832
4833 Before any events are generated, you have to add some watches to the
4834 internal watch list. See: "inotify-add-watch" and "inotify-rm-watch".
4835
4836 Queued up events should be read periodically by calling "inotify-read"
4837 (or "inotify-files" which is just a helpful wrapper around "inotify-
4838 read"). If you don't read the events out often enough then you risk
4839 the internal queue overflowing.
4840
4841 The handle should be closed after use by calling "inotify-close". This
4842 also removes any watches automatically.
4843
4844 See also inotify(7) for an overview of the inotify interface as exposed
4845 by the Linux kernel, which is roughly what we expose via libguestfs.
4846 Note that there is one global inotify handle per libguestfs instance.
4847
4848 This command depends on the feature "inotify". See also "feature-
4849 available".
4850
4851 inotify-read
4852 inotify-read
4853
4854 Return the complete queue of events that have happened since the
4855 previous read call.
4856
4857 If no events have happened, this returns an empty list.
4858
4859 Note: In order to make sure that all events have been read, you must
4860 call this function repeatedly until it returns an empty list. The
4861 reason is that the call will read events up to the maximum appliance-
4862 to-host message size and leave remaining events in the queue.
4863
4864 This command depends on the feature "inotify". See also "feature-
4865 available".
4866
4867 inotify-rm-watch
4868 inotify-rm-watch wd
4869
4870 Remove a previously defined inotify watch. See "inotify-add-watch".
4871
4872 This command depends on the feature "inotify". See also "feature-
4873 available".
4874
4875 inspect-get-arch
4876 inspect-get-arch root
4877
4878 This returns the architecture of the inspected operating system. The
4879 possible return values are listed under "file-architecture".
4880
4881 If the architecture could not be determined, then the string "unknown"
4882 is returned.
4883
4884 Please read "INSPECTION" in guestfs(3) for more details.
4885
4886 inspect-get-distro
4887 inspect-get-distro root
4888
4889 This returns the distro (distribution) of the inspected operating
4890 system.
4891
4892 Currently defined distros are:
4893
4894 "alpinelinux"
4895 Alpine Linux.
4896
4897 "altlinux"
4898 ALT Linux.
4899
4900 "archlinux"
4901 Arch Linux.
4902
4903 "buildroot"
4904 Buildroot-derived distro, but not one we specifically recognize.
4905
4906 "centos"
4907 CentOS.
4908
4909 "cirros"
4910 Cirros.
4911
4912 "coreos"
4913 CoreOS.
4914
4915 "debian"
4916 Debian.
4917
4918 "fedora"
4919 Fedora.
4920
4921 "freebsd"
4922 FreeBSD.
4923
4924 "freedos"
4925 FreeDOS.
4926
4927 "frugalware"
4928 Frugalware.
4929
4930 "gentoo"
4931 Gentoo.
4932
4933 "kalilinux"
4934 Kali Linux.
4935
4936 "linuxmint"
4937 Linux Mint.
4938
4939 "mageia"
4940 Mageia.
4941
4942 "mandriva"
4943 Mandriva.
4944
4945 "meego"
4946 MeeGo.
4947
4948 "msdos"
4949 Microsoft DOS.
4950
4951 "neokylin"
4952 NeoKylin.
4953
4954 "netbsd"
4955 NetBSD.
4956
4957 "openbsd"
4958 OpenBSD.
4959
4960 "opensuse"
4961 OpenSUSE.
4962
4963 "oraclelinux"
4964 Oracle Linux.
4965
4966 "pardus"
4967 Pardus.
4968
4969 "pldlinux"
4970 PLD Linux.
4971
4972 "redhat-based"
4973 Some Red Hat-derived distro.
4974
4975 "rhel"
4976 Red Hat Enterprise Linux.
4977
4978 "scientificlinux"
4979 Scientific Linux.
4980
4981 "slackware"
4982 Slackware.
4983
4984 "sles"
4985 SuSE Linux Enterprise Server or Desktop.
4986
4987 "suse-based"
4988 Some openSuSE-derived distro.
4989
4990 "ttylinux"
4991 ttylinux.
4992
4993 "ubuntu"
4994 Ubuntu.
4995
4996 "unknown"
4997 The distro could not be determined.
4998
4999 "voidlinux"
5000 Void Linux.
5001
5002 "windows"
5003 Windows does not have distributions. This string is returned if
5004 the OS type is Windows.
5005
5006 Future versions of libguestfs may return other strings here. The
5007 caller should be prepared to handle any string.
5008
5009 Please read "INSPECTION" in guestfs(3) for more details.
5010
5011 inspect-get-drive-mappings
5012 inspect-get-drive-mappings root
5013
5014 This call is useful for Windows which uses a primitive system of
5015 assigning drive letters (like C:\) to partitions. This inspection API
5016 examines the Windows Registry to find out how disks/partitions are
5017 mapped to drive letters, and returns a hash table as in the example
5018 below:
5019
5020 C => /dev/vda2
5021 E => /dev/vdb1
5022 F => /dev/vdc1
5023
5024 Note that keys are drive letters. For Windows, the key is case
5025 insensitive and just contains the drive letter, without the customary
5026 colon separator character.
5027
5028 In future we may support other operating systems that also used drive
5029 letters, but the keys for those might not be case insensitive and might
5030 be longer than 1 character. For example in OS-9, hard drives were
5031 named "h0", "h1" etc.
5032
5033 For Windows guests, currently only hard drive mappings are returned.
5034 Removable disks (eg. DVD-ROMs) are ignored.
5035
5036 For guests that do not use drive mappings, or if the drive mappings
5037 could not be determined, this returns an empty hash table.
5038
5039 Please read "INSPECTION" in guestfs(3) for more details. See also
5040 "inspect-get-mountpoints", "inspect-get-filesystems".
5041
5042 inspect-get-filesystems
5043 inspect-get-filesystems root
5044
5045 This returns a list of all the filesystems that we think are associated
5046 with this operating system. This includes the root filesystem, other
5047 ordinary filesystems, and non-mounted devices like swap partitions.
5048
5049 In the case of a multi-boot virtual machine, it is possible for a
5050 filesystem to be shared between operating systems.
5051
5052 Please read "INSPECTION" in guestfs(3) for more details. See also
5053 "inspect-get-mountpoints".
5054
5055 inspect-get-format
5056 inspect-get-format root
5057
5058 Before libguestfs 1.38, there was some unreliable support for detecting
5059 installer CDs. This API would return:
5060
5061 "installed"
5062 This is an installed operating system.
5063
5064 "installer"
5065 The disk image being inspected is not an installed operating
5066 system, but a bootable install disk, live CD, or similar.
5067
5068 "unknown"
5069 The format of this disk image is not known.
5070
5071 In libguestfs ≥ 1.38, this only returns "installed". Use libosinfo
5072 directly to detect installer CDs.
5073
5074 Please read "INSPECTION" in guestfs(3) for more details.
5075
5076 This function is deprecated. There is no replacement. Consult the API
5077 documentation in guestfs(3) for further information.
5078
5079 Deprecated functions will not be removed from the API, but the fact
5080 that they are deprecated indicates that there are problems with correct
5081 use of these functions.
5082
5083 inspect-get-hostname
5084 inspect-get-hostname root
5085
5086 This function returns the hostname of the operating system as found by
5087 inspection of the guest’s configuration files.
5088
5089 If the hostname could not be determined, then the string "unknown" is
5090 returned.
5091
5092 Please read "INSPECTION" in guestfs(3) for more details.
5093
5094 inspect-get-icon
5095 inspect-get-icon root [favicon:true|false] [highquality:true|false]
5096
5097 This function returns an icon corresponding to the inspected operating
5098 system. The icon is returned as a buffer containing a PNG image (re-
5099 encoded to PNG if necessary).
5100
5101 If it was not possible to get an icon this function returns a zero-
5102 length (non-NULL) buffer. Callers must check for this case.
5103
5104 Libguestfs will start by looking for a file called /etc/favicon.png or
5105 C:\etc\favicon.png and if it has the correct format, the contents of
5106 this file will be returned. You can disable favicons by passing the
5107 optional "favicon" boolean as false (default is true).
5108
5109 If finding the favicon fails, then we look in other places in the guest
5110 for a suitable icon.
5111
5112 If the optional "highquality" boolean is true then only high quality
5113 icons are returned, which means only icons of high resolution with an
5114 alpha channel. The default (false) is to return any icon we can, even
5115 if it is of substandard quality.
5116
5117 Notes:
5118
5119 · Unlike most other inspection API calls, the guest’s disks must be
5120 mounted up before you call this, since it needs to read information
5121 from the guest filesystem during the call.
5122
5123 · Security: The icon data comes from the untrusted guest, and should
5124 be treated with caution. PNG files have been known to contain
5125 exploits. Ensure that libpng (or other relevant libraries) are
5126 fully up to date before trying to process or display the icon.
5127
5128 · The PNG image returned can be any size. It might not be square.
5129 Libguestfs tries to return the largest, highest quality icon
5130 available. The application must scale the icon to the required
5131 size.
5132
5133 · Extracting icons from Windows guests requires the external
5134 "wrestool" program from the "icoutils" package, and several
5135 programs ("bmptopnm", "pnmtopng", "pamcut") from the "netpbm"
5136 package. These must be installed separately.
5137
5138 · Operating system icons are usually trademarks. Seek legal advice
5139 before using trademarks in applications.
5140
5141 This command has one or more optional arguments. See "OPTIONAL
5142 ARGUMENTS".
5143
5144 inspect-get-major-version
5145 inspect-get-major-version root
5146
5147 This returns the major version number of the inspected operating
5148 system.
5149
5150 Windows uses a consistent versioning scheme which is not reflected in
5151 the popular public names used by the operating system. Notably the
5152 operating system known as "Windows 7" is really version 6.1 (ie. major
5153 = 6, minor = 1). You can find out the real versions corresponding to
5154 releases of Windows by consulting Wikipedia or MSDN.
5155
5156 If the version could not be determined, then 0 is returned.
5157
5158 Please read "INSPECTION" in guestfs(3) for more details.
5159
5160 inspect-get-minor-version
5161 inspect-get-minor-version root
5162
5163 This returns the minor version number of the inspected operating
5164 system.
5165
5166 If the version could not be determined, then 0 is returned.
5167
5168 Please read "INSPECTION" in guestfs(3) for more details. See also
5169 "inspect-get-major-version".
5170
5171 inspect-get-mountpoints
5172 inspect-get-mountpoints root
5173
5174 This returns a hash of where we think the filesystems associated with
5175 this operating system should be mounted. Callers should note that this
5176 is at best an educated guess made by reading configuration files such
5177 as /etc/fstab. In particular note that this may return filesystems
5178 which are non-existent or not mountable and callers should be prepared
5179 to handle or ignore failures if they try to mount them.
5180
5181 Each element in the returned hashtable has a key which is the path of
5182 the mountpoint (eg. /boot) and a value which is the filesystem that
5183 would be mounted there (eg. /dev/sda1).
5184
5185 Non-mounted devices such as swap devices are not returned in this list.
5186
5187 For operating systems like Windows which still use drive letters, this
5188 call will only return an entry for the first drive "mounted on" /. For
5189 information about the mapping of drive letters to partitions, see
5190 "inspect-get-drive-mappings".
5191
5192 Please read "INSPECTION" in guestfs(3) for more details. See also
5193 "inspect-get-filesystems".
5194
5195 inspect-get-osinfo
5196 inspect-get-osinfo root
5197
5198 This function returns a possible short ID for libosinfo corresponding
5199 to the guest.
5200
5201 Note: The returned ID is only a guess by libguestfs, and nothing
5202 ensures that it actually exists in osinfo-db.
5203
5204 If no ID could not be determined, then the string "unknown" is
5205 returned.
5206
5207 inspect-get-package-format
5208 inspect-get-package-format root
5209
5210 This function and "inspect-get-package-management" return the package
5211 format and package management tool used by the inspected operating
5212 system. For example for Fedora these functions would return "rpm"
5213 (package format), and "yum" or "dnf" (package management).
5214
5215 This returns the string "unknown" if we could not determine the package
5216 format or if the operating system does not have a real packaging system
5217 (eg. Windows).
5218
5219 Possible strings include: "rpm", "deb", "ebuild", "pisi", "pacman",
5220 "pkgsrc", "apk", "xbps". Future versions of libguestfs may return
5221 other strings.
5222
5223 Please read "INSPECTION" in guestfs(3) for more details.
5224
5225 inspect-get-package-management
5226 inspect-get-package-management root
5227
5228 "inspect-get-package-format" and this function return the package
5229 format and package management tool used by the inspected operating
5230 system. For example for Fedora these functions would return "rpm"
5231 (package format), and "yum" or "dnf" (package management).
5232
5233 This returns the string "unknown" if we could not determine the package
5234 management tool or if the operating system does not have a real
5235 packaging system (eg. Windows).
5236
5237 Possible strings include: "yum", "dnf", "up2date", "apt" (for all
5238 Debian derivatives), "portage", "pisi", "pacman", "urpmi", "zypper",
5239 "apk", "xbps". Future versions of libguestfs may return other strings.
5240
5241 Please read "INSPECTION" in guestfs(3) for more details.
5242
5243 inspect-get-product-name
5244 inspect-get-product-name root
5245
5246 This returns the product name of the inspected operating system. The
5247 product name is generally some freeform string which can be displayed
5248 to the user, but should not be parsed by programs.
5249
5250 If the product name could not be determined, then the string "unknown"
5251 is returned.
5252
5253 Please read "INSPECTION" in guestfs(3) for more details.
5254
5255 inspect-get-product-variant
5256 inspect-get-product-variant root
5257
5258 This returns the product variant of the inspected operating system.
5259
5260 For Windows guests, this returns the contents of the Registry key
5261 "HKLM\Software\Microsoft\Windows NT\CurrentVersion" "InstallationType"
5262 which is usually a string such as "Client" or "Server" (other values
5263 are possible). This can be used to distinguish consumer and enterprise
5264 versions of Windows that have the same version number (for example,
5265 Windows 7 and Windows 2008 Server are both version 6.1, but the former
5266 is "Client" and the latter is "Server").
5267
5268 For enterprise Linux guests, in future we intend this to return the
5269 product variant such as "Desktop", "Server" and so on. But this is not
5270 implemented at present.
5271
5272 If the product variant could not be determined, then the string
5273 "unknown" is returned.
5274
5275 Please read "INSPECTION" in guestfs(3) for more details. See also
5276 "inspect-get-product-name", "inspect-get-major-version".
5277
5278 inspect-get-roots
5279 inspect-get-roots
5280
5281 This function is a convenient way to get the list of root devices, as
5282 returned from a previous call to "inspect-os", but without redoing the
5283 whole inspection process.
5284
5285 This returns an empty list if either no root devices were found or the
5286 caller has not called "inspect-os".
5287
5288 Please read "INSPECTION" in guestfs(3) for more details.
5289
5290 inspect-get-type
5291 inspect-get-type root
5292
5293 This returns the type of the inspected operating system. Currently
5294 defined types are:
5295
5296 "linux"
5297 Any Linux-based operating system.
5298
5299 "windows"
5300 Any Microsoft Windows operating system.
5301
5302 "freebsd"
5303 FreeBSD.
5304
5305 "netbsd"
5306 NetBSD.
5307
5308 "openbsd"
5309 OpenBSD.
5310
5311 "hurd"
5312 GNU/Hurd.
5313
5314 "dos"
5315 MS-DOS, FreeDOS and others.
5316
5317 "minix"
5318 MINIX.
5319
5320 "unknown"
5321 The operating system type could not be determined.
5322
5323 Future versions of libguestfs may return other strings here. The
5324 caller should be prepared to handle any string.
5325
5326 Please read "INSPECTION" in guestfs(3) for more details.
5327
5328 inspect-get-windows-current-control-set
5329 inspect-get-windows-current-control-set root
5330
5331 This returns the Windows CurrentControlSet of the inspected guest. The
5332 CurrentControlSet is a registry key name such as "ControlSet001".
5333
5334 This call assumes that the guest is Windows and that the Registry could
5335 be examined by inspection. If this is not the case then an error is
5336 returned.
5337
5338 Please read "INSPECTION" in guestfs(3) for more details.
5339
5340 inspect-get-windows-software-hive
5341 inspect-get-windows-software-hive root
5342
5343 This returns the path to the hive (binary Windows Registry file)
5344 corresponding to HKLM\SOFTWARE.
5345
5346 This call assumes that the guest is Windows and that the guest has a
5347 software hive file with the right name. If this is not the case then
5348 an error is returned. This call does not check that the hive is a
5349 valid Windows Registry hive.
5350
5351 You can use "hivex-open" to read or write to the hive.
5352
5353 Please read "INSPECTION" in guestfs(3) for more details.
5354
5355 inspect-get-windows-system-hive
5356 inspect-get-windows-system-hive root
5357
5358 This returns the path to the hive (binary Windows Registry file)
5359 corresponding to HKLM\SYSTEM.
5360
5361 This call assumes that the guest is Windows and that the guest has a
5362 system hive file with the right name. If this is not the case then an
5363 error is returned. This call does not check that the hive is a valid
5364 Windows Registry hive.
5365
5366 You can use "hivex-open" to read or write to the hive.
5367
5368 Please read "INSPECTION" in guestfs(3) for more details.
5369
5370 inspect-get-windows-systemroot
5371 inspect-get-windows-systemroot root
5372
5373 This returns the Windows systemroot of the inspected guest. The
5374 systemroot is a directory path such as /WINDOWS.
5375
5376 This call assumes that the guest is Windows and that the systemroot
5377 could be determined by inspection. If this is not the case then an
5378 error is returned.
5379
5380 Please read "INSPECTION" in guestfs(3) for more details.
5381
5382 inspect-is-live
5383 inspect-is-live root
5384
5385 This is deprecated and always returns "false".
5386
5387 Please read "INSPECTION" in guestfs(3) for more details.
5388
5389 This function is deprecated. There is no replacement. Consult the API
5390 documentation in guestfs(3) for further information.
5391
5392 Deprecated functions will not be removed from the API, but the fact
5393 that they are deprecated indicates that there are problems with correct
5394 use of these functions.
5395
5396 inspect-is-multipart
5397 inspect-is-multipart root
5398
5399 This is deprecated and always returns "false".
5400
5401 Please read "INSPECTION" in guestfs(3) for more details.
5402
5403 This function is deprecated. There is no replacement. Consult the API
5404 documentation in guestfs(3) for further information.
5405
5406 Deprecated functions will not be removed from the API, but the fact
5407 that they are deprecated indicates that there are problems with correct
5408 use of these functions.
5409
5410 inspect-is-netinst
5411 inspect-is-netinst root
5412
5413 This is deprecated and always returns "false".
5414
5415 Please read "INSPECTION" in guestfs(3) for more details.
5416
5417 This function is deprecated. There is no replacement. Consult the API
5418 documentation in guestfs(3) for further information.
5419
5420 Deprecated functions will not be removed from the API, but the fact
5421 that they are deprecated indicates that there are problems with correct
5422 use of these functions.
5423
5424 inspect-list-applications
5425 inspect-list-applications root
5426
5427 Return the list of applications installed in the operating system.
5428
5429 Note: This call works differently from other parts of the inspection
5430 API. You have to call "inspect-os", then "inspect-get-mountpoints",
5431 then mount up the disks, before calling this. Listing applications is
5432 a significantly more difficult operation which requires access to the
5433 full filesystem. Also note that unlike the other "inspect-get-*" calls
5434 which are just returning data cached in the libguestfs handle, this
5435 call actually reads parts of the mounted filesystems during the call.
5436
5437 This returns an empty list if the inspection code was not able to
5438 determine the list of applications.
5439
5440 The application structure contains the following fields:
5441
5442 "app_name"
5443 The name of the application. For Red Hat-derived and Debian-
5444 derived Linux guests, this is the package name.
5445
5446 "app_display_name"
5447 The display name of the application, sometimes localized to the
5448 install language of the guest operating system.
5449
5450 If unavailable this is returned as an empty string "". Callers
5451 needing to display something can use "app_name" instead.
5452
5453 "app_epoch"
5454 For package managers which use epochs, this contains the epoch of
5455 the package (an integer). If unavailable, this is returned as 0.
5456
5457 "app_version"
5458 The version string of the application or package. If unavailable
5459 this is returned as an empty string "".
5460
5461 "app_release"
5462 The release string of the application or package, for package
5463 managers that use this. If unavailable this is returned as an
5464 empty string "".
5465
5466 "app_install_path"
5467 The installation path of the application (on operating systems such
5468 as Windows which use installation paths). This path is in the
5469 format used by the guest operating system, it is not a libguestfs
5470 path.
5471
5472 If unavailable this is returned as an empty string "".
5473
5474 "app_trans_path"
5475 The install path translated into a libguestfs path. If unavailable
5476 this is returned as an empty string "".
5477
5478 "app_publisher"
5479 The name of the publisher of the application, for package managers
5480 that use this. If unavailable this is returned as an empty string
5481 "".
5482
5483 "app_url"
5484 The URL (eg. upstream URL) of the application. If unavailable this
5485 is returned as an empty string "".
5486
5487 "app_source_package"
5488 For packaging systems which support this, the name of the source
5489 package. If unavailable this is returned as an empty string "".
5490
5491 "app_summary"
5492 A short (usually one line) description of the application or
5493 package. If unavailable this is returned as an empty string "".
5494
5495 "app_description"
5496 A longer description of the application or package. If unavailable
5497 this is returned as an empty string "".
5498
5499 Please read "INSPECTION" in guestfs(3) for more details.
5500
5501 This function is deprecated. In new code, use the
5502 "inspect-list-applications2" call instead.
5503
5504 Deprecated functions will not be removed from the API, but the fact
5505 that they are deprecated indicates that there are problems with correct
5506 use of these functions.
5507
5508 inspect-list-applications2
5509 inspect-list-applications2 root
5510
5511 Return the list of applications installed in the operating system.
5512
5513 Note: This call works differently from other parts of the inspection
5514 API. You have to call "inspect-os", then "inspect-get-mountpoints",
5515 then mount up the disks, before calling this. Listing applications is
5516 a significantly more difficult operation which requires access to the
5517 full filesystem. Also note that unlike the other "inspect-get-*" calls
5518 which are just returning data cached in the libguestfs handle, this
5519 call actually reads parts of the mounted filesystems during the call.
5520
5521 This returns an empty list if the inspection code was not able to
5522 determine the list of applications.
5523
5524 The application structure contains the following fields:
5525
5526 "app2_name"
5527 The name of the application. For Red Hat-derived and Debian-
5528 derived Linux guests, this is the package name.
5529
5530 "app2_display_name"
5531 The display name of the application, sometimes localized to the
5532 install language of the guest operating system.
5533
5534 If unavailable this is returned as an empty string "". Callers
5535 needing to display something can use "app2_name" instead.
5536
5537 "app2_epoch"
5538 For package managers which use epochs, this contains the epoch of
5539 the package (an integer). If unavailable, this is returned as 0.
5540
5541 "app2_version"
5542 The version string of the application or package. If unavailable
5543 this is returned as an empty string "".
5544
5545 "app2_release"
5546 The release string of the application or package, for package
5547 managers that use this. If unavailable this is returned as an
5548 empty string "".
5549
5550 "app2_arch"
5551 The architecture string of the application or package, for package
5552 managers that use this. If unavailable this is returned as an
5553 empty string "".
5554
5555 "app2_install_path"
5556 The installation path of the application (on operating systems such
5557 as Windows which use installation paths). This path is in the
5558 format used by the guest operating system, it is not a libguestfs
5559 path.
5560
5561 If unavailable this is returned as an empty string "".
5562
5563 "app2_trans_path"
5564 The install path translated into a libguestfs path. If unavailable
5565 this is returned as an empty string "".
5566
5567 "app2_publisher"
5568 The name of the publisher of the application, for package managers
5569 that use this. If unavailable this is returned as an empty string
5570 "".
5571
5572 "app2_url"
5573 The URL (eg. upstream URL) of the application. If unavailable this
5574 is returned as an empty string "".
5575
5576 "app2_source_package"
5577 For packaging systems which support this, the name of the source
5578 package. If unavailable this is returned as an empty string "".
5579
5580 "app2_summary"
5581 A short (usually one line) description of the application or
5582 package. If unavailable this is returned as an empty string "".
5583
5584 "app2_description"
5585 A longer description of the application or package. If unavailable
5586 this is returned as an empty string "".
5587
5588 Please read "INSPECTION" in guestfs(3) for more details.
5589
5590 inspect-os
5591 inspect-os
5592
5593 This function uses other libguestfs functions and certain heuristics to
5594 inspect the disk(s) (usually disks belonging to a virtual machine),
5595 looking for operating systems.
5596
5597 The list returned is empty if no operating systems were found.
5598
5599 If one operating system was found, then this returns a list with a
5600 single element, which is the name of the root filesystem of this
5601 operating system. It is also possible for this function to return a
5602 list containing more than one element, indicating a dual-boot or multi-
5603 boot virtual machine, with each element being the root filesystem of
5604 one of the operating systems.
5605
5606 You can pass the root string(s) returned to other "inspect-get-*"
5607 functions in order to query further information about each operating
5608 system, such as the name and version.
5609
5610 This function uses other libguestfs features such as "mount-ro" and
5611 "umount-all" in order to mount and unmount filesystems and look at the
5612 contents. This should be called with no disks currently mounted. The
5613 function may also use Augeas, so any existing Augeas handle will be
5614 closed.
5615
5616 This function cannot decrypt encrypted disks. The caller must do that
5617 first (supplying the necessary keys) if the disk is encrypted.
5618
5619 Please read "INSPECTION" in guestfs(3) for more details.
5620
5621 See also "list-filesystems".
5622
5623 is-blockdev
5624 is-blockdev-opts
5625 is-blockdev path [followsymlinks:true|false]
5626
5627 This returns "true" if and only if there is a block device with the
5628 given "path" name.
5629
5630 If the optional flag "followsymlinks" is true, then a symlink (or chain
5631 of symlinks) that ends with a block device also causes the function to
5632 return true.
5633
5634 This call only looks at files within the guest filesystem. Libguestfs
5635 partitions and block devices (eg. /dev/sda) cannot be used as the
5636 "path" parameter of this call.
5637
5638 See also "stat".
5639
5640 This command has one or more optional arguments. See "OPTIONAL
5641 ARGUMENTS".
5642
5643 is-chardev
5644 is-chardev-opts
5645 is-chardev path [followsymlinks:true|false]
5646
5647 This returns "true" if and only if there is a character device with the
5648 given "path" name.
5649
5650 If the optional flag "followsymlinks" is true, then a symlink (or chain
5651 of symlinks) that ends with a chardev also causes the function to
5652 return true.
5653
5654 See also "stat".
5655
5656 This command has one or more optional arguments. See "OPTIONAL
5657 ARGUMENTS".
5658
5659 is-config
5660 is-config
5661
5662 This returns true iff this handle is being configured (in the "CONFIG"
5663 state).
5664
5665 For more information on states, see guestfs(3).
5666
5667 is-dir
5668 is-dir-opts
5669 is-dir path [followsymlinks:true|false]
5670
5671 This returns "true" if and only if there is a directory with the given
5672 "path" name. Note that it returns false for other objects like files.
5673
5674 If the optional flag "followsymlinks" is true, then a symlink (or chain
5675 of symlinks) that ends with a directory also causes the function to
5676 return true.
5677
5678 See also "stat".
5679
5680 This command has one or more optional arguments. See "OPTIONAL
5681 ARGUMENTS".
5682
5683 is-fifo
5684 is-fifo-opts
5685 is-fifo path [followsymlinks:true|false]
5686
5687 This returns "true" if and only if there is a FIFO (named pipe) with
5688 the given "path" name.
5689
5690 If the optional flag "followsymlinks" is true, then a symlink (or chain
5691 of symlinks) that ends with a FIFO also causes the function to return
5692 true.
5693
5694 See also "stat".
5695
5696 This command has one or more optional arguments. See "OPTIONAL
5697 ARGUMENTS".
5698
5699 is-file
5700 is-file-opts
5701 is-file path [followsymlinks:true|false]
5702
5703 This returns "true" if and only if there is a regular file with the
5704 given "path" name. Note that it returns false for other objects like
5705 directories.
5706
5707 If the optional flag "followsymlinks" is true, then a symlink (or chain
5708 of symlinks) that ends with a file also causes the function to return
5709 true.
5710
5711 See also "stat".
5712
5713 This command has one or more optional arguments. See "OPTIONAL
5714 ARGUMENTS".
5715
5716 is-lv
5717 is-lv mountable
5718
5719 This command tests whether "mountable" is a logical volume, and returns
5720 true iff this is the case.
5721
5722 is-socket
5723 is-socket-opts
5724 is-socket path [followsymlinks:true|false]
5725
5726 This returns "true" if and only if there is a Unix domain socket with
5727 the given "path" name.
5728
5729 If the optional flag "followsymlinks" is true, then a symlink (or chain
5730 of symlinks) that ends with a socket also causes the function to return
5731 true.
5732
5733 See also "stat".
5734
5735 This command has one or more optional arguments. See "OPTIONAL
5736 ARGUMENTS".
5737
5738 is-symlink
5739 is-symlink path
5740
5741 This returns "true" if and only if there is a symbolic link with the
5742 given "path" name.
5743
5744 See also "stat".
5745
5746 is-whole-device
5747 is-whole-device device
5748
5749 This returns "true" if and only if "device" refers to a whole block
5750 device. That is, not a partition or a logical device.
5751
5752 is-zero
5753 is-zero path
5754
5755 This returns true iff the file exists and the file is empty or it
5756 contains all zero bytes.
5757
5758 is-zero-device
5759 is-zero-device device
5760
5761 This returns true iff the device exists and contains all zero bytes.
5762
5763 Note that for large devices this can take a long time to run.
5764
5765 isoinfo
5766 isoinfo isofile
5767
5768 This is the same as "isoinfo-device" except that it works for an ISO
5769 file located inside some other mounted filesystem. Note that in the
5770 common case where you have added an ISO file as a libguestfs device,
5771 you would not call this. Instead you would call "isoinfo-device".
5772
5773 isoinfo-device
5774 isoinfo-device device
5775
5776 "device" is an ISO device. This returns a struct of information read
5777 from the primary volume descriptor (the ISO equivalent of the
5778 superblock) of the device.
5779
5780 Usually it is more efficient to use the isoinfo(1) command with the -d
5781 option on the host to analyze ISO files, instead of going through
5782 libguestfs.
5783
5784 For information on the primary volume descriptor fields, see
5785 http://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor
5786
5787 journal-close
5788 journal-close
5789
5790 Close the journal handle.
5791
5792 This command depends on the feature "journal". See also "feature-
5793 available".
5794
5795 journal-get
5796 journal-get
5797
5798 Read the current journal entry. This returns all the fields in the
5799 journal as a set of "(attrname, attrval)" pairs. The "attrname" is the
5800 field name (a string).
5801
5802 The "attrval" is the field value (a binary blob, often but not always a
5803 string). Please note that "attrval" is a byte array, not a
5804 \0-terminated C string.
5805
5806 The length of data may be truncated to the data threshold (see:
5807 "journal-set-data-threshold", "journal-get-data-threshold").
5808
5809 If you set the data threshold to unlimited (0) then this call can read
5810 a journal entry of any size, ie. it is not limited by the libguestfs
5811 protocol.
5812
5813 This command depends on the feature "journal". See also "feature-
5814 available".
5815
5816 journal-get-data-threshold
5817 journal-get-data-threshold
5818
5819 Get the current data threshold for reading journal entries. This is a
5820 hint to the journal that it may truncate data fields to this size when
5821 reading them (note also that it may not truncate them). If this
5822 returns 0, then the threshold is unlimited.
5823
5824 See also "journal-set-data-threshold".
5825
5826 This command depends on the feature "journal". See also "feature-
5827 available".
5828
5829 journal-get-realtime-usec
5830 journal-get-realtime-usec
5831
5832 Get the realtime (wallclock) timestamp of the current journal entry.
5833
5834 This command depends on the feature "journal". See also "feature-
5835 available".
5836
5837 journal-next
5838 journal-next
5839
5840 Move to the next journal entry. You have to call this at least once
5841 after opening the handle before you are able to read data.
5842
5843 The returned boolean tells you if there are any more journal records to
5844 read. "true" means you can read the next record (eg. using "journal-
5845 get"), and "false" means you have reached the end of the journal.
5846
5847 This command depends on the feature "journal". See also "feature-
5848 available".
5849
5850 journal-open
5851 journal-open directory
5852
5853 Open the systemd journal located in directory. Any previously opened
5854 journal handle is closed.
5855
5856 The contents of the journal can be read using "journal-next" and
5857 "journal-get".
5858
5859 After you have finished using the journal, you should close the handle
5860 by calling "journal-close".
5861
5862 This command depends on the feature "journal". See also "feature-
5863 available".
5864
5865 journal-set-data-threshold
5866 journal-set-data-threshold threshold
5867
5868 Set the data threshold for reading journal entries. This is a hint to
5869 the journal that it may truncate data fields to this size when reading
5870 them (note also that it may not truncate them). If you set this to 0,
5871 then the threshold is unlimited.
5872
5873 See also "journal-get-data-threshold".
5874
5875 This command depends on the feature "journal". See also "feature-
5876 available".
5877
5878 journal-skip
5879 journal-skip skip
5880
5881 Skip forwards ("skip ≥ 0") or backwards ("skip < 0") in the journal.
5882
5883 The number of entries actually skipped is returned (note "rskip ≥ 0").
5884 If this is not the same as the absolute value of the skip parameter
5885 ("|skip|") you passed in then it means you have reached the end or the
5886 start of the journal.
5887
5888 This command depends on the feature "journal". See also "feature-
5889 available".
5890
5891 kill-subprocess
5892 kill-subprocess
5893
5894 This kills the hypervisor.
5895
5896 Do not call this. See: "shutdown" instead.
5897
5898 This function is deprecated. In new code, use the "shutdown" call
5899 instead.
5900
5901 Deprecated functions will not be removed from the API, but the fact
5902 that they are deprecated indicates that there are problems with correct
5903 use of these functions.
5904
5905 launch
5906 run
5907 launch
5908
5909 You should call this after configuring the handle (eg. adding drives)
5910 but before performing any actions.
5911
5912 Do not call "launch" twice on the same handle. Although it will not
5913 give an error (for historical reasons), the precise behaviour when you
5914 do this is not well defined. Handles are very cheap to create, so
5915 create a new one for each launch.
5916
5917 lchown
5918 lchown owner group path
5919
5920 Change the file owner to "owner" and group to "group". This is like
5921 "chown" but if "path" is a symlink then the link itself is changed, not
5922 the target.
5923
5924 Only numeric uid and gid are supported. If you want to use names, you
5925 will need to locate and parse the password file yourself (Augeas
5926 support makes this relatively easy).
5927
5928 ldmtool-create-all
5929 ldmtool-create-all
5930
5931 This function scans all block devices looking for Windows dynamic disk
5932 volumes and partitions, and creates devices for any that were found.
5933
5934 Call "list-ldm-volumes" and "list-ldm-partitions" to return all
5935 devices.
5936
5937 Note that you don't normally need to call this explicitly, since it is
5938 done automatically at "launch" time. However you might want to call
5939 this function if you have hotplugged disks or have just created a
5940 Windows dynamic disk.
5941
5942 This command depends on the feature "ldm". See also "feature-
5943 available".
5944
5945 ldmtool-diskgroup-disks
5946 ldmtool-diskgroup-disks diskgroup
5947
5948 Return the disks in a Windows dynamic disk group. The "diskgroup"
5949 parameter should be the GUID of a disk group, one element from the list
5950 returned by "ldmtool-scan".
5951
5952 This command depends on the feature "ldm". See also "feature-
5953 available".
5954
5955 ldmtool-diskgroup-name
5956 ldmtool-diskgroup-name diskgroup
5957
5958 Return the name of a Windows dynamic disk group. The "diskgroup"
5959 parameter should be the GUID of a disk group, one element from the list
5960 returned by "ldmtool-scan".
5961
5962 This command depends on the feature "ldm". See also "feature-
5963 available".
5964
5965 ldmtool-diskgroup-volumes
5966 ldmtool-diskgroup-volumes diskgroup
5967
5968 Return the volumes in a Windows dynamic disk group. The "diskgroup"
5969 parameter should be the GUID of a disk group, one element from the list
5970 returned by "ldmtool-scan".
5971
5972 This command depends on the feature "ldm". See also "feature-
5973 available".
5974
5975 ldmtool-remove-all
5976 ldmtool-remove-all
5977
5978 This is essentially the opposite of "ldmtool-create-all". It removes
5979 the device mapper mappings for all Windows dynamic disk volumes
5980
5981 This command depends on the feature "ldm". See also "feature-
5982 available".
5983
5984 ldmtool-scan
5985 ldmtool-scan
5986
5987 This function scans for Windows dynamic disks. It returns a list of
5988 identifiers (GUIDs) for all disk groups that were found. These
5989 identifiers can be passed to other "ldmtool-*" functions.
5990
5991 This function scans all block devices. To scan a subset of block
5992 devices, call "ldmtool-scan-devices" instead.
5993
5994 This command depends on the feature "ldm". See also "feature-
5995 available".
5996
5997 ldmtool-scan-devices
5998 ldmtool-scan-devices 'devices ...'
5999
6000 This function scans for Windows dynamic disks. It returns a list of
6001 identifiers (GUIDs) for all disk groups that were found. These
6002 identifiers can be passed to other "ldmtool-*" functions.
6003
6004 The parameter "devices" is a list of block devices which are scanned.
6005 If this list is empty, all block devices are scanned.
6006
6007 This command depends on the feature "ldm". See also "feature-
6008 available".
6009
6010 ldmtool-volume-hint
6011 ldmtool-volume-hint diskgroup volume
6012
6013 Return the hint field of the volume named "volume" in the disk group
6014 with GUID "diskgroup". This may not be defined, in which case the
6015 empty string is returned. The hint field is often, though not always,
6016 the name of a Windows drive, eg. "E:".
6017
6018 This command depends on the feature "ldm". See also "feature-
6019 available".
6020
6021 ldmtool-volume-partitions
6022 ldmtool-volume-partitions diskgroup volume
6023
6024 Return the list of partitions in the volume named "volume" in the disk
6025 group with GUID "diskgroup".
6026
6027 This command depends on the feature "ldm". See also "feature-
6028 available".
6029
6030 ldmtool-volume-type
6031 ldmtool-volume-type diskgroup volume
6032
6033 Return the type of the volume named "volume" in the disk group with
6034 GUID "diskgroup".
6035
6036 Possible volume types that can be returned here include: "simple",
6037 "spanned", "striped", "mirrored", "raid5". Other types may also be
6038 returned.
6039
6040 This command depends on the feature "ldm". See also "feature-
6041 available".
6042
6043 lgetxattr
6044 lgetxattr path name
6045
6046 Get a single extended attribute from file "path" named "name". If
6047 "path" is a symlink, then this call returns an extended attribute from
6048 the symlink.
6049
6050 Normally it is better to get all extended attributes from a file in one
6051 go by calling "getxattrs". However some Linux filesystem
6052 implementations are buggy and do not provide a way to list out
6053 attributes. For these filesystems (notably ntfs-3g) you have to know
6054 the names of the extended attributes you want in advance and call this
6055 function.
6056
6057 Extended attribute values are blobs of binary data. If there is no
6058 extended attribute named "name", this returns an error.
6059
6060 See also: "lgetxattrs", "getxattr", attr(5).
6061
6062 This command depends on the feature "linuxxattrs". See also "feature-
6063 available".
6064
6065 lgetxattrs
6066 lgetxattrs path
6067
6068 This is the same as "getxattrs", but if "path" is a symbolic link, then
6069 it returns the extended attributes of the link itself.
6070
6071 This command depends on the feature "linuxxattrs". See also "feature-
6072 available".
6073
6074 list-9p
6075 list-9p
6076
6077 List all 9p filesystems attached to the guest. A list of mount tags is
6078 returned.
6079
6080 list-devices
6081 list-devices
6082
6083 List all the block devices.
6084
6085 The full block device names are returned, eg. /dev/sda.
6086
6087 See also "list-filesystems".
6088
6089 list-disk-labels
6090 list-disk-labels
6091
6092 If you add drives using the optional "label" parameter of "add-drive-
6093 opts", you can use this call to map between disk labels, and raw block
6094 device and partition names (like /dev/sda and /dev/sda1).
6095
6096 This returns a hashtable, where keys are the disk labels (without the
6097 /dev/disk/guestfs prefix), and the values are the full raw block device
6098 and partition names (eg. /dev/sda and /dev/sda1).
6099
6100 list-dm-devices
6101 list-dm-devices
6102
6103 List all device mapper devices.
6104
6105 The returned list contains /dev/mapper/* devices, eg. ones created by a
6106 previous call to "luks-open".
6107
6108 Device mapper devices which correspond to logical volumes are not
6109 returned in this list. Call "lvs" if you want to list logical volumes.
6110
6111 list-filesystems
6112 list-filesystems
6113
6114 This inspection command looks for filesystems on partitions, block
6115 devices and logical volumes, returning a list of "mountables"
6116 containing filesystems and their type.
6117
6118 The return value is a hash, where the keys are the devices containing
6119 filesystems, and the values are the filesystem types. For example:
6120
6121 "/dev/sda1" => "ntfs"
6122 "/dev/sda2" => "ext2"
6123 "/dev/vg_guest/lv_root" => "ext4"
6124 "/dev/vg_guest/lv_swap" => "swap"
6125
6126 The key is not necessarily a block device. It may also be an opaque
6127 ‘mountable’ string which can be passed to "mount".
6128
6129 The value can have the special value "unknown", meaning the content of
6130 the device is undetermined or empty. "swap" means a Linux swap
6131 partition.
6132
6133 In libguestfs ≤ 1.36 this command ran other libguestfs commands, which
6134 might have included "mount" and "umount", and therefore you had to use
6135 this soon after launch and only when nothing else was mounted. This
6136 restriction is removed in libguestfs ≥ 1.38.
6137
6138 Not all of the filesystems returned will be mountable. In particular,
6139 swap partitions are returned in the list. Also this command does not
6140 check that each filesystem found is valid and mountable, and some
6141 filesystems might be mountable but require special options.
6142 Filesystems may not all belong to a single logical operating system
6143 (use "inspect-os" to look for OSes).
6144
6145 list-ldm-partitions
6146 list-ldm-partitions
6147
6148 This function returns all Windows dynamic disk partitions that were
6149 found at launch time. It returns a list of device names.
6150
6151 This command depends on the feature "ldm". See also "feature-
6152 available".
6153
6154 list-ldm-volumes
6155 list-ldm-volumes
6156
6157 This function returns all Windows dynamic disk volumes that were found
6158 at launch time. It returns a list of device names.
6159
6160 This command depends on the feature "ldm". See also "feature-
6161 available".
6162
6163 list-md-devices
6164 list-md-devices
6165
6166 List all Linux md devices.
6167
6168 list-partitions
6169 list-partitions
6170
6171 List all the partitions detected on all block devices.
6172
6173 The full partition device names are returned, eg. /dev/sda1
6174
6175 This does not return logical volumes. For that you will need to call
6176 "lvs".
6177
6178 See also "list-filesystems".
6179
6180 ll
6181 ll directory
6182
6183 List the files in directory (relative to the root directory, there is
6184 no cwd) in the format of 'ls -la'.
6185
6186 This command is mostly useful for interactive sessions. It is not
6187 intended that you try to parse the output string.
6188
6189 llz
6190 llz directory
6191
6192 List the files in directory in the format of 'ls -laZ'.
6193
6194 This command is mostly useful for interactive sessions. It is not
6195 intended that you try to parse the output string.
6196
6197 This function is deprecated. In new code, use the "lgetxattrs" call
6198 instead.
6199
6200 Deprecated functions will not be removed from the API, but the fact
6201 that they are deprecated indicates that there are problems with correct
6202 use of these functions.
6203
6204 ln
6205 ln target linkname
6206
6207 This command creates a hard link using the "ln" command.
6208
6209 ln-f
6210 ln-f target linkname
6211
6212 This command creates a hard link using the "ln -f" command. The -f
6213 option removes the link ("linkname") if it exists already.
6214
6215 ln-s
6216 ln-s target linkname
6217
6218 This command creates a symbolic link using the "ln -s" command.
6219
6220 ln-sf
6221 ln-sf target linkname
6222
6223 This command creates a symbolic link using the "ln -sf" command, The -f
6224 option removes the link ("linkname") if it exists already.
6225
6226 lremovexattr
6227 lremovexattr xattr path
6228
6229 This is the same as "removexattr", but if "path" is a symbolic link,
6230 then it removes an extended attribute of the link itself.
6231
6232 This command depends on the feature "linuxxattrs". See also "feature-
6233 available".
6234
6235 ls
6236 ls directory
6237
6238 List the files in directory (relative to the root directory, there is
6239 no cwd). The '.' and '..' entries are not returned, but hidden files
6240 are shown.
6241
6242 ls0
6243 ls0 dir (filenames|-)
6244
6245 This specialized command is used to get a listing of the filenames in
6246 the directory "dir". The list of filenames is written to the local
6247 file filenames (on the host).
6248
6249 In the output file, the filenames are separated by "\0" characters.
6250
6251 "." and ".." are not returned. The filenames are not sorted.
6252
6253 Use "-" instead of a filename to read/write from stdin/stdout.
6254
6255 lsetxattr
6256 lsetxattr xattr val vallen path
6257
6258 This is the same as "setxattr", but if "path" is a symbolic link, then
6259 it sets an extended attribute of the link itself.
6260
6261 This command depends on the feature "linuxxattrs". See also "feature-
6262 available".
6263
6264 lstat
6265 lstat path
6266
6267 Returns file information for the given "path".
6268
6269 This is the same as "stat" except that if "path" is a symbolic link,
6270 then the link is stat-ed, not the file it refers to.
6271
6272 This is the same as the lstat(2) system call.
6273
6274 This function is deprecated. In new code, use the "lstatns" call
6275 instead.
6276
6277 Deprecated functions will not be removed from the API, but the fact
6278 that they are deprecated indicates that there are problems with correct
6279 use of these functions.
6280
6281 lstatlist
6282 lstatlist path 'names ...'
6283
6284 This call allows you to perform the "lstat" operation on multiple
6285 files, where all files are in the directory "path". "names" is the
6286 list of files from this directory.
6287
6288 On return you get a list of stat structs, with a one-to-one
6289 correspondence to the "names" list. If any name did not exist or could
6290 not be lstat'd, then the "st_ino" field of that structure is set to
6291 "-1".
6292
6293 This call is intended for programs that want to efficiently list a
6294 directory contents without making many round-trips. See also
6295 "lxattrlist" for a similarly efficient call for getting extended
6296 attributes.
6297
6298 This function is deprecated. In new code, use the "lstatnslist" call
6299 instead.
6300
6301 Deprecated functions will not be removed from the API, but the fact
6302 that they are deprecated indicates that there are problems with correct
6303 use of these functions.
6304
6305 lstatns
6306 lstatns path
6307
6308 Returns file information for the given "path".
6309
6310 This is the same as "statns" except that if "path" is a symbolic link,
6311 then the link is stat-ed, not the file it refers to.
6312
6313 This is the same as the lstat(2) system call.
6314
6315 lstatnslist
6316 lstatnslist path 'names ...'
6317
6318 This call allows you to perform the "lstatns" operation on multiple
6319 files, where all files are in the directory "path". "names" is the
6320 list of files from this directory.
6321
6322 On return you get a list of stat structs, with a one-to-one
6323 correspondence to the "names" list. If any name did not exist or could
6324 not be lstat'd, then the "st_ino" field of that structure is set to
6325 "-1".
6326
6327 This call is intended for programs that want to efficiently list a
6328 directory contents without making many round-trips. See also
6329 "lxattrlist" for a similarly efficient call for getting extended
6330 attributes.
6331
6332 luks-add-key
6333 luks-add-key device keyslot
6334
6335 This command adds a new key on LUKS device "device". "key" is any
6336 existing key, and is used to access the device. "newkey" is the new
6337 key to add. "keyslot" is the key slot that will be replaced.
6338
6339 Note that if "keyslot" already contains a key, then this command will
6340 fail. You have to use "luks-kill-slot" first to remove that key.
6341
6342 This command has one or more key or passphrase parameters. Guestfish
6343 will prompt for these separately.
6344
6345 This command depends on the feature "luks". See also "feature-
6346 available".
6347
6348 luks-close
6349 luks-close device
6350
6351 This closes a LUKS device that was created earlier by "luks-open" or
6352 "luks-open-ro". The "device" parameter must be the name of the LUKS
6353 mapping device (ie. /dev/mapper/mapname) and not the name of the
6354 underlying block device.
6355
6356 This command depends on the feature "luks". See also "feature-
6357 available".
6358
6359 luks-format
6360 luks-format device keyslot
6361
6362 This command erases existing data on "device" and formats the device as
6363 a LUKS encrypted device. "key" is the initial key, which is added to
6364 key slot "slot". (LUKS supports 8 key slots, numbered 0-7).
6365
6366 This command has one or more key or passphrase parameters. Guestfish
6367 will prompt for these separately.
6368
6369 This command depends on the feature "luks". See also "feature-
6370 available".
6371
6372 luks-format-cipher
6373 luks-format-cipher device keyslot cipher
6374
6375 This command is the same as "luks-format" but it also allows you to set
6376 the "cipher" used.
6377
6378 This command has one or more key or passphrase parameters. Guestfish
6379 will prompt for these separately.
6380
6381 This command depends on the feature "luks". See also "feature-
6382 available".
6383
6384 luks-kill-slot
6385 luks-kill-slot device keyslot
6386
6387 This command deletes the key in key slot "keyslot" from the encrypted
6388 LUKS device "device". "key" must be one of the other keys.
6389
6390 This command has one or more key or passphrase parameters. Guestfish
6391 will prompt for these separately.
6392
6393 This command depends on the feature "luks". See also "feature-
6394 available".
6395
6396 luks-open
6397 luks-open device mapname
6398
6399 This command opens a block device which has been encrypted according to
6400 the Linux Unified Key Setup (LUKS) standard.
6401
6402 "device" is the encrypted block device or partition.
6403
6404 The caller must supply one of the keys associated with the LUKS block
6405 device, in the "key" parameter.
6406
6407 This creates a new block device called /dev/mapper/mapname. Reads and
6408 writes to this block device are decrypted from and encrypted to the
6409 underlying "device" respectively.
6410
6411 If this block device contains LVM volume groups, then calling "lvm-
6412 scan" with the "activate" parameter "true" will make them visible.
6413
6414 Use "list-dm-devices" to list all device mapper devices.
6415
6416 This command has one or more key or passphrase parameters. Guestfish
6417 will prompt for these separately.
6418
6419 This command depends on the feature "luks". See also "feature-
6420 available".
6421
6422 luks-open-ro
6423 luks-open-ro device mapname
6424
6425 This is the same as "luks-open" except that a read-only mapping is
6426 created.
6427
6428 This command has one or more key or passphrase parameters. Guestfish
6429 will prompt for these separately.
6430
6431 This command depends on the feature "luks". See also "feature-
6432 available".
6433
6434 lvcreate
6435 lvcreate logvol volgroup mbytes
6436
6437 This creates an LVM logical volume called "logvol" on the volume group
6438 "volgroup", with "size" megabytes.
6439
6440 This command depends on the feature "lvm2". See also "feature-
6441 available".
6442
6443 lvcreate-free
6444 lvcreate-free logvol volgroup percent
6445
6446 Create an LVM logical volume called /dev/volgroup/logvol, using
6447 approximately "percent" % of the free space remaining in the volume
6448 group. Most usefully, when "percent" is 100 this will create the
6449 largest possible LV.
6450
6451 This command depends on the feature "lvm2". See also "feature-
6452 available".
6453
6454 lvm-canonical-lv-name
6455 lvm-canonical-lv-name lvname
6456
6457 This converts alternative naming schemes for LVs that you might find to
6458 the canonical name. For example, /dev/mapper/VG-LV is converted to
6459 /dev/VG/LV.
6460
6461 This command returns an error if the "lvname" parameter does not refer
6462 to a logical volume.
6463
6464 See also "is-lv", "canonical-device-name".
6465
6466 lvm-clear-filter
6467 lvm-clear-filter
6468
6469 This undoes the effect of "lvm-set-filter". LVM will be able to see
6470 every block device.
6471
6472 This command also clears the LVM cache and performs a volume group
6473 scan.
6474
6475 lvm-remove-all
6476 lvm-remove-all
6477
6478 This command removes all LVM logical volumes, volume groups and
6479 physical volumes.
6480
6481 This command depends on the feature "lvm2". See also "feature-
6482 available".
6483
6484 lvm-scan
6485 lvm-scan true|false
6486
6487 This scans all block devices and rebuilds the list of LVM physical
6488 volumes, volume groups and logical volumes.
6489
6490 If the "activate" parameter is "true" then newly found volume groups
6491 and logical volumes are activated, meaning the LV /dev/VG/LV devices
6492 become visible.
6493
6494 When a libguestfs handle is launched it scans for existing devices, so
6495 you do not normally need to use this API. However it is useful when
6496 you have added a new device or deleted an existing device (such as when
6497 the "luks-open" API is used).
6498
6499 lvm-set-filter
6500 lvm-set-filter 'devices ...'
6501
6502 This sets the LVM device filter so that LVM will only be able to "see"
6503 the block devices in the list "devices", and will ignore all other
6504 attached block devices.
6505
6506 Where disk image(s) contain duplicate PVs or VGs, this command is
6507 useful to get LVM to ignore the duplicates, otherwise LVM can get
6508 confused. Note also there are two types of duplication possible:
6509 either cloned PVs/VGs which have identical UUIDs; or VGs that are not
6510 cloned but just happen to have the same name. In normal operation you
6511 cannot create this situation, but you can do it outside LVM, eg. by
6512 cloning disk images or by bit twiddling inside the LVM metadata.
6513
6514 This command also clears the LVM cache and performs a volume group
6515 scan.
6516
6517 You can filter whole block devices or individual partitions.
6518
6519 You cannot use this if any VG is currently in use (eg. contains a
6520 mounted filesystem), even if you are not filtering out that VG.
6521
6522 This command depends on the feature "lvm2". See also "feature-
6523 available".
6524
6525 lvremove
6526 lvremove device
6527
6528 Remove an LVM logical volume "device", where "device" is the path to
6529 the LV, such as /dev/VG/LV.
6530
6531 You can also remove all LVs in a volume group by specifying the VG
6532 name, /dev/VG.
6533
6534 This command depends on the feature "lvm2". See also "feature-
6535 available".
6536
6537 lvrename
6538 lvrename logvol newlogvol
6539
6540 Rename a logical volume "logvol" with the new name "newlogvol".
6541
6542 lvresize
6543 lvresize device mbytes
6544
6545 This resizes (expands or shrinks) an existing LVM logical volume to
6546 "mbytes". When reducing, data in the reduced part is lost.
6547
6548 This command depends on the feature "lvm2". See also "feature-
6549 available".
6550
6551 lvresize-free
6552 lvresize-free lv percent
6553
6554 This expands an existing logical volume "lv" so that it fills "pc"% of
6555 the remaining free space in the volume group. Commonly you would call
6556 this with pc = 100 which expands the logical volume as much as
6557 possible, using all remaining free space in the volume group.
6558
6559 This command depends on the feature "lvm2". See also "feature-
6560 available".
6561
6562 lvs
6563 lvs
6564
6565 List all the logical volumes detected. This is the equivalent of the
6566 lvs(8) command.
6567
6568 This returns a list of the logical volume device names (eg.
6569 /dev/VolGroup00/LogVol00).
6570
6571 See also "lvs-full", "list-filesystems".
6572
6573 This command depends on the feature "lvm2". See also "feature-
6574 available".
6575
6576 lvs-full
6577 lvs-full
6578
6579 List all the logical volumes detected. This is the equivalent of the
6580 lvs(8) command. The "full" version includes all fields.
6581
6582 This command depends on the feature "lvm2". See also "feature-
6583 available".
6584
6585 lvuuid
6586 lvuuid device
6587
6588 This command returns the UUID of the LVM LV "device".
6589
6590 lxattrlist
6591 lxattrlist path 'names ...'
6592
6593 This call allows you to get the extended attributes of multiple files,
6594 where all files are in the directory "path". "names" is the list of
6595 files from this directory.
6596
6597 On return you get a flat list of xattr structs which must be
6598 interpreted sequentially. The first xattr struct always has a zero-
6599 length "attrname". "attrval" in this struct is zero-length to indicate
6600 there was an error doing "lgetxattr" for this file, or is a C string
6601 which is a decimal number (the number of following attributes for this
6602 file, which could be "0"). Then after the first xattr struct are the
6603 zero or more attributes for the first named file. This repeats for the
6604 second and subsequent files.
6605
6606 This call is intended for programs that want to efficiently list a
6607 directory contents without making many round-trips. See also
6608 "lstatlist" for a similarly efficient call for getting standard stats.
6609
6610 This command depends on the feature "linuxxattrs". See also "feature-
6611 available".
6612
6613 max-disks
6614 max-disks
6615
6616 Return the maximum number of disks that may be added to a handle (eg.
6617 by "add-drive-opts" and similar calls).
6618
6619 This function was added in libguestfs 1.19.7. In previous versions of
6620 libguestfs the limit was 25.
6621
6622 See "MAXIMUM NUMBER OF DISKS" in guestfs(3) for additional information
6623 on this topic.
6624
6625 md-create
6626 md-create name 'devices ...' [missingbitmap:N] [nrdevices:N] [spare:N] [chunk:N] [level:..]
6627
6628 Create a Linux md (RAID) device named "name" on the devices in the list
6629 "devices".
6630
6631 The optional parameters are:
6632
6633 "missingbitmap"
6634 A bitmap of missing devices. If a bit is set it means that a
6635 missing device is added to the array. The least significant bit
6636 corresponds to the first device in the array.
6637
6638 As examples:
6639
6640 If "devices = ["/dev/sda"]" and "missingbitmap = 0x1" then the
6641 resulting array would be "[<missing>, "/dev/sda"]".
6642
6643 If "devices = ["/dev/sda"]" and "missingbitmap = 0x2" then the
6644 resulting array would be "["/dev/sda", <missing>]".
6645
6646 This defaults to 0 (no missing devices).
6647
6648 The length of "devices" + the number of bits set in "missingbitmap"
6649 must equal "nrdevices" + "spare".
6650
6651 "nrdevices"
6652 The number of active RAID devices.
6653
6654 If not set, this defaults to the length of "devices" plus the
6655 number of bits set in "missingbitmap".
6656
6657 "spare"
6658 The number of spare devices.
6659
6660 If not set, this defaults to 0.
6661
6662 "chunk"
6663 The chunk size in bytes.
6664
6665 "level"
6666 The RAID level, which can be one of: linear, raid0, 0, stripe,
6667 raid1, 1, mirror, raid4, 4, raid5, 5, raid6, 6, raid10, 10. Some
6668 of these are synonymous, and more levels may be added in future.
6669
6670 If not set, this defaults to "raid1".
6671
6672 This command has one or more optional arguments. See "OPTIONAL
6673 ARGUMENTS".
6674
6675 This command depends on the feature "mdadm". See also "feature-
6676 available".
6677
6678 md-detail
6679 md-detail md
6680
6681 This command exposes the output of 'mdadm -DY <md>'. The following
6682 fields are usually present in the returned hash. Other fields may also
6683 be present.
6684
6685 "level"
6686 The raid level of the MD device.
6687
6688 "devices"
6689 The number of underlying devices in the MD device.
6690
6691 "metadata"
6692 The metadata version used.
6693
6694 "uuid"
6695 The UUID of the MD device.
6696
6697 "name"
6698 The name of the MD device.
6699
6700 This command depends on the feature "mdadm". See also "feature-
6701 available".
6702
6703 md-stat
6704 md-stat md
6705
6706 This call returns a list of the underlying devices which make up the
6707 single software RAID array device "md".
6708
6709 To get a list of software RAID devices, call "list-md-devices".
6710
6711 Each structure returned corresponds to one device along with additional
6712 status information:
6713
6714 "mdstat_device"
6715 The name of the underlying device.
6716
6717 "mdstat_index"
6718 The index of this device within the array.
6719
6720 "mdstat_flags"
6721 Flags associated with this device. This is a string containing (in
6722 no specific order) zero or more of the following flags:
6723
6724 "W" write-mostly
6725
6726 "F" device is faulty
6727
6728 "S" device is a RAID spare
6729
6730 "R" replacement
6731
6732 This command depends on the feature "mdadm". See also "feature-
6733 available".
6734
6735 md-stop
6736 md-stop md
6737
6738 This command deactivates the MD array named "md". The device is
6739 stopped, but it is not destroyed or zeroed.
6740
6741 This command depends on the feature "mdadm". See also "feature-
6742 available".
6743
6744 mkdir
6745 mkdir path
6746
6747 Create a directory named "path".
6748
6749 mkdir-mode
6750 mkdir-mode path mode
6751
6752 This command creates a directory, setting the initial permissions of
6753 the directory to "mode".
6754
6755 For common Linux filesystems, the actual mode which is set will be
6756 "mode & ~umask & 01777". Non-native-Linux filesystems may interpret
6757 the mode in other ways.
6758
6759 See also "mkdir", "umask"
6760
6761 mkdir-p
6762 mkdir-p path
6763
6764 Create a directory named "path", creating any parent directories as
6765 necessary. This is like the "mkdir -p" shell command.
6766
6767 mkdtemp
6768 mkdtemp tmpl
6769
6770 This command creates a temporary directory. The "tmpl" parameter
6771 should be a full pathname for the temporary directory name with the
6772 final six characters being "XXXXXX".
6773
6774 For example: "/tmp/myprogXXXXXX" or "/Temp/myprogXXXXXX", the second
6775 one being suitable for Windows filesystems.
6776
6777 The name of the temporary directory that was created is returned.
6778
6779 The temporary directory is created with mode 0700 and is owned by root.
6780
6781 The caller is responsible for deleting the temporary directory and its
6782 contents after use.
6783
6784 See also: mkdtemp(3)
6785
6786 mke2fs
6787 mke2fs device [blockscount:N] [blocksize:N] [fragsize:N] [blockspergroup:N] [numberofgroups:N] [bytesperinode:N] [inodesize:N] [journalsize:N] [numberofinodes:N] [stridesize:N] [stripewidth:N] [maxonlineresize:N] [reservedblockspercentage:N] [mmpupdateinterval:N] [journaldevice:..] [label:..] [lastmounteddir:..] [creatoros:..] [fstype:..] [usagetype:..] [uuid:..] [forcecreate:true|false] [writesbandgrouponly:true|false] [lazyitableinit:true|false] [lazyjournalinit:true|false] [testfs:true|false] [discard:true|false] [quotatype:true|false] [extent:true|false] [filetype:true|false] [flexbg:true|false] [hasjournal:true|false] [journaldev:true|false] [largefile:true|false] [quota:true|false] [resizeinode:true|false] [sparsesuper:true|false] [uninitbg:true|false]
6788
6789 "mke2fs" is used to create an ext2, ext3, or ext4 filesystem on
6790 "device".
6791
6792 The optional "blockscount" is the size of the filesystem in blocks. If
6793 omitted it defaults to the size of "device". Note if the filesystem is
6794 too small to contain a journal, "mke2fs" will silently create an ext2
6795 filesystem instead.
6796
6797 This command has one or more optional arguments. See "OPTIONAL
6798 ARGUMENTS".
6799
6800 mke2fs-J
6801 mke2fs-J fstype blocksize device journal
6802
6803 This creates an ext2/3/4 filesystem on "device" with an external
6804 journal on "journal". It is equivalent to the command:
6805
6806 mke2fs -t fstype -b blocksize -J device=<journal> <device>
6807
6808 See also "mke2journal".
6809
6810 This function is deprecated. In new code, use the "mke2fs" call
6811 instead.
6812
6813 Deprecated functions will not be removed from the API, but the fact
6814 that they are deprecated indicates that there are problems with correct
6815 use of these functions.
6816
6817 mke2fs-JL
6818 mke2fs-JL fstype blocksize device label
6819
6820 This creates an ext2/3/4 filesystem on "device" with an external
6821 journal on the journal labeled "label".
6822
6823 See also "mke2journal-L".
6824
6825 This function is deprecated. In new code, use the "mke2fs" call
6826 instead.
6827
6828 Deprecated functions will not be removed from the API, but the fact
6829 that they are deprecated indicates that there are problems with correct
6830 use of these functions.
6831
6832 mke2fs-JU
6833 mke2fs-JU fstype blocksize device uuid
6834
6835 This creates an ext2/3/4 filesystem on "device" with an external
6836 journal on the journal with UUID "uuid".
6837
6838 See also "mke2journal-U".
6839
6840 This function is deprecated. In new code, use the "mke2fs" call
6841 instead.
6842
6843 Deprecated functions will not be removed from the API, but the fact
6844 that they are deprecated indicates that there are problems with correct
6845 use of these functions.
6846
6847 This command depends on the feature "linuxfsuuid". See also "feature-
6848 available".
6849
6850 mke2journal
6851 mke2journal blocksize device
6852
6853 This creates an ext2 external journal on "device". It is equivalent to
6854 the command:
6855
6856 mke2fs -O journal_dev -b blocksize device
6857
6858 This function is deprecated. In new code, use the "mke2fs" call
6859 instead.
6860
6861 Deprecated functions will not be removed from the API, but the fact
6862 that they are deprecated indicates that there are problems with correct
6863 use of these functions.
6864
6865 mke2journal-L
6866 mke2journal-L blocksize label device
6867
6868 This creates an ext2 external journal on "device" with label "label".
6869
6870 This function is deprecated. In new code, use the "mke2fs" call
6871 instead.
6872
6873 Deprecated functions will not be removed from the API, but the fact
6874 that they are deprecated indicates that there are problems with correct
6875 use of these functions.
6876
6877 mke2journal-U
6878 mke2journal-U blocksize uuid device
6879
6880 This creates an ext2 external journal on "device" with UUID "uuid".
6881
6882 This function is deprecated. In new code, use the "mke2fs" call
6883 instead.
6884
6885 Deprecated functions will not be removed from the API, but the fact
6886 that they are deprecated indicates that there are problems with correct
6887 use of these functions.
6888
6889 This command depends on the feature "linuxfsuuid". See also "feature-
6890 available".
6891
6892 mkfifo
6893 mkfifo mode path
6894
6895 This call creates a FIFO (named pipe) called "path" with mode "mode".
6896 It is just a convenient wrapper around "mknod".
6897
6898 Unlike with "mknod", "mode" must contain only permissions bits.
6899
6900 The mode actually set is affected by the umask.
6901
6902 This command depends on the feature "mknod". See also "feature-
6903 available".
6904
6905 mkfs
6906 mkfs-opts
6907 mkfs fstype device [blocksize:N] [features:..] [inode:N] [sectorsize:N] [label:..]
6908
6909 This function creates a filesystem on "device". The filesystem type is
6910 "fstype", for example "ext3".
6911
6912 The optional arguments are:
6913
6914 "blocksize"
6915 The filesystem block size. Supported block sizes depend on the
6916 filesystem type, but typically they are 1024, 2048 or 4096 for
6917 Linux ext2/3 filesystems.
6918
6919 For VFAT and NTFS the "blocksize" parameter is treated as the
6920 requested cluster size.
6921
6922 For UFS block sizes, please see mkfs.ufs(8).
6923
6924 "features"
6925 This passes the -O parameter to the external mkfs program.
6926
6927 For certain filesystem types, this allows extra filesystem features
6928 to be selected. See mke2fs(8) and mkfs.ufs(8) for more details.
6929
6930 You cannot use this optional parameter with the "gfs" or "gfs2"
6931 filesystem type.
6932
6933 "inode"
6934 This passes the -I parameter to the external mke2fs(8) program
6935 which sets the inode size (only for ext2/3/4 filesystems at
6936 present).
6937
6938 "sectorsize"
6939 This passes the -S parameter to external mkfs.ufs(8) program, which
6940 sets sector size for ufs filesystem.
6941
6942 This command has one or more optional arguments. See "OPTIONAL
6943 ARGUMENTS".
6944
6945 mkfs-b
6946 mkfs-b fstype blocksize device
6947
6948 This call is similar to "mkfs", but it allows you to control the block
6949 size of the resulting filesystem. Supported block sizes depend on the
6950 filesystem type, but typically they are 1024, 2048 or 4096 only.
6951
6952 For VFAT and NTFS the "blocksize" parameter is treated as the requested
6953 cluster size.
6954
6955 This function is deprecated. In new code, use the "mkfs" call instead.
6956
6957 Deprecated functions will not be removed from the API, but the fact
6958 that they are deprecated indicates that there are problems with correct
6959 use of these functions.
6960
6961 mkfs-btrfs
6962 mkfs-btrfs 'devices ...' [allocstart:N] [bytecount:N] [datatype:..] [leafsize:N] [label:..] [metadata:..] [nodesize:N] [sectorsize:N]
6963
6964 Create a btrfs filesystem, allowing all configurables to be set. For
6965 more information on the optional arguments, see mkfs.btrfs(8).
6966
6967 Since btrfs filesystems can span multiple devices, this takes a non-
6968 empty list of devices.
6969
6970 To create general filesystems, use "mkfs".
6971
6972 This command has one or more optional arguments. See "OPTIONAL
6973 ARGUMENTS".
6974
6975 This command depends on the feature "btrfs". See also "feature-
6976 available".
6977
6978 mklost-and-found
6979 mklost-and-found mountpoint
6980
6981 Make the "lost+found" directory, normally in the root directory of an
6982 ext2/3/4 filesystem. "mountpoint" is the directory under which we try
6983 to create the "lost+found" directory.
6984
6985 mkmountpoint
6986 mkmountpoint exemptpath
6987
6988 "mkmountpoint" and "rmmountpoint" are specialized calls that can be
6989 used to create extra mountpoints before mounting the first filesystem.
6990
6991 These calls are only necessary in some very limited circumstances,
6992 mainly the case where you want to mount a mix of unrelated and/or read-
6993 only filesystems together.
6994
6995 For example, live CDs often contain a "Russian doll" nest of
6996 filesystems, an ISO outer layer, with a squashfs image inside, with an
6997 ext2/3 image inside that. You can unpack this as follows in guestfish:
6998
6999 add-ro Fedora-11-i686-Live.iso
7000 run
7001 mkmountpoint /cd
7002 mkmountpoint /sqsh
7003 mkmountpoint /ext3fs
7004 mount /dev/sda /cd
7005 mount-loop /cd/LiveOS/squashfs.img /sqsh
7006 mount-loop /sqsh/LiveOS/ext3fs.img /ext3fs
7007
7008 The inner filesystem is now unpacked under the /ext3fs mountpoint.
7009
7010 "mkmountpoint" is not compatible with "umount-all". You may get
7011 unexpected errors if you try to mix these calls. It is safest to
7012 manually unmount filesystems and remove mountpoints after use.
7013
7014 "umount-all" unmounts filesystems by sorting the paths longest first,
7015 so for this to work for manual mountpoints, you must ensure that the
7016 innermost mountpoints have the longest pathnames, as in the example
7017 code above.
7018
7019 For more details see https://bugzilla.redhat.com/show_bug.cgi?id=599503
7020
7021 Autosync [see "set-autosync", this is set by default on handles] can
7022 cause "umount-all" to be called when the handle is closed which can
7023 also trigger these issues.
7024
7025 mknod
7026 mknod mode devmajor devminor path
7027
7028 This call creates block or character special devices, or named pipes
7029 (FIFOs).
7030
7031 The "mode" parameter should be the mode, using the standard constants.
7032 "devmajor" and "devminor" are the device major and minor numbers, only
7033 used when creating block and character special devices.
7034
7035 Note that, just like mknod(2), the mode must be bitwise OR'd with
7036 S_IFBLK, S_IFCHR, S_IFIFO or S_IFSOCK (otherwise this call just creates
7037 a regular file). These constants are available in the standard Linux
7038 header files, or you can use "mknod-b", "mknod-c" or "mkfifo" which are
7039 wrappers around this command which bitwise OR in the appropriate
7040 constant for you.
7041
7042 The mode actually set is affected by the umask.
7043
7044 This command depends on the feature "mknod". See also "feature-
7045 available".
7046
7047 mknod-b
7048 mknod-b mode devmajor devminor path
7049
7050 This call creates a block device node called "path" with mode "mode"
7051 and device major/minor "devmajor" and "devminor". It is just a
7052 convenient wrapper around "mknod".
7053
7054 Unlike with "mknod", "mode" must contain only permissions bits.
7055
7056 The mode actually set is affected by the umask.
7057
7058 This command depends on the feature "mknod". See also "feature-
7059 available".
7060
7061 mknod-c
7062 mknod-c mode devmajor devminor path
7063
7064 This call creates a char device node called "path" with mode "mode" and
7065 device major/minor "devmajor" and "devminor". It is just a convenient
7066 wrapper around "mknod".
7067
7068 Unlike with "mknod", "mode" must contain only permissions bits.
7069
7070 The mode actually set is affected by the umask.
7071
7072 This command depends on the feature "mknod". See also "feature-
7073 available".
7074
7075 mksquashfs
7076 mksquashfs path (filename|-) [compress:..] [excludes:..]
7077
7078 Create a squashfs filesystem for the specified "path".
7079
7080 The optional "compress" flag controls compression. If not given, then
7081 the output compressed using "gzip". Otherwise one of the following
7082 strings may be given to select the compression type of the squashfs:
7083 "gzip", "lzma", "lzo", "lz4", "xz".
7084
7085 The other optional arguments are:
7086
7087 "excludes"
7088 A list of wildcards. Files are excluded if they match any of the
7089 wildcards.
7090
7091 Please note that this API may fail when used to compress directories
7092 with large files, such as the resulting squashfs will be over 3GB big.
7093
7094 Use "-" instead of a filename to read/write from stdin/stdout.
7095
7096 This command has one or more optional arguments. See "OPTIONAL
7097 ARGUMENTS".
7098
7099 This command depends on the feature "squashfs". See also "feature-
7100 available".
7101
7102 mkswap
7103 mkswap-opts
7104 mkswap device [label:..] [uuid:..]
7105
7106 Create a Linux swap partition on "device".
7107
7108 The option arguments "label" and "uuid" allow you to set the label
7109 and/or UUID of the new swap partition.
7110
7111 This command has one or more optional arguments. See "OPTIONAL
7112 ARGUMENTS".
7113
7114 mkswap-L
7115 mkswap-L label device
7116
7117 Create a swap partition on "device" with label "label".
7118
7119 Note that you cannot attach a swap label to a block device (eg.
7120 /dev/sda), just to a partition. This appears to be a limitation of the
7121 kernel or swap tools.
7122
7123 This function is deprecated. In new code, use the "mkswap" call
7124 instead.
7125
7126 Deprecated functions will not be removed from the API, but the fact
7127 that they are deprecated indicates that there are problems with correct
7128 use of these functions.
7129
7130 mkswap-U
7131 mkswap-U uuid device
7132
7133 Create a swap partition on "device" with UUID "uuid".
7134
7135 This function is deprecated. In new code, use the "mkswap" call
7136 instead.
7137
7138 Deprecated functions will not be removed from the API, but the fact
7139 that they are deprecated indicates that there are problems with correct
7140 use of these functions.
7141
7142 This command depends on the feature "linuxfsuuid". See also "feature-
7143 available".
7144
7145 mkswap-file
7146 mkswap-file path
7147
7148 Create a swap file.
7149
7150 This command just writes a swap file signature to an existing file. To
7151 create the file itself, use something like "fallocate".
7152
7153 mktemp
7154 mktemp tmpl [suffix:..]
7155
7156 This command creates a temporary file. The "tmpl" parameter should be
7157 a full pathname for the temporary directory name with the final six
7158 characters being "XXXXXX".
7159
7160 For example: "/tmp/myprogXXXXXX" or "/Temp/myprogXXXXXX", the second
7161 one being suitable for Windows filesystems.
7162
7163 The name of the temporary file that was created is returned.
7164
7165 The temporary file is created with mode 0600 and is owned by root.
7166
7167 The caller is responsible for deleting the temporary file after use.
7168
7169 If the optional "suffix" parameter is given, then the suffix (eg.
7170 ".txt") is appended to the temporary name.
7171
7172 See also: "mkdtemp".
7173
7174 This command has one or more optional arguments. See "OPTIONAL
7175 ARGUMENTS".
7176
7177 modprobe
7178 modprobe modulename
7179
7180 This loads a kernel module in the appliance.
7181
7182 This command depends on the feature "linuxmodules". See also
7183 "feature-available".
7184
7185 mount
7186 mount mountable mountpoint
7187
7188 Mount a guest disk at a position in the filesystem. Block devices are
7189 named /dev/sda, /dev/sdb and so on, as they were added to the guest.
7190 If those block devices contain partitions, they will have the usual
7191 names (eg. /dev/sda1). Also LVM /dev/VG/LV-style names can be used, or
7192 ‘mountable’ strings returned by "list-filesystems" or "inspect-get-
7193 mountpoints".
7194
7195 The rules are the same as for mount(2): A filesystem must first be
7196 mounted on / before others can be mounted. Other filesystems can only
7197 be mounted on directories which already exist.
7198
7199 The mounted filesystem is writable, if we have sufficient permissions
7200 on the underlying device.
7201
7202 Before libguestfs 1.13.16, this call implicitly added the options
7203 "sync" and "noatime". The "sync" option greatly slowed writes and
7204 caused many problems for users. If your program might need to work
7205 with older versions of libguestfs, use "mount-options" instead (using
7206 an empty string for the first parameter if you don't want any options).
7207
7208 mount-9p
7209 mount-9p mounttag mountpoint [options:..]
7210
7211 Mount the virtio-9p filesystem with the tag "mounttag" on the directory
7212 "mountpoint".
7213
7214 If required, "trans=virtio" will be automatically added to the options.
7215 Any other options required can be passed in the optional "options"
7216 parameter.
7217
7218 This command has one or more optional arguments. See "OPTIONAL
7219 ARGUMENTS".
7220
7221 mount-local
7222 mount-local localmountpoint [readonly:true|false] [options:..] [cachetimeout:N] [debugcalls:true|false]
7223
7224 This call exports the libguestfs-accessible filesystem to a local
7225 mountpoint (directory) called "localmountpoint". Ordinary reads and
7226 writes to files and directories under "localmountpoint" are redirected
7227 through libguestfs.
7228
7229 If the optional "readonly" flag is set to true, then writes to the
7230 filesystem return error "EROFS".
7231
7232 "options" is a comma-separated list of mount options. See
7233 guestmount(1) for some useful options.
7234
7235 "cachetimeout" sets the timeout (in seconds) for cached directory
7236 entries. The default is 60 seconds. See guestmount(1) for further
7237 information.
7238
7239 If "debugcalls" is set to true, then additional debugging information
7240 is generated for every FUSE call.
7241
7242 When "mount-local" returns, the filesystem is ready, but is not
7243 processing requests (access to it will block). You have to call
7244 "mount-local-run" to run the main loop.
7245
7246 See "MOUNT LOCAL" in guestfs(3) for full documentation.
7247
7248 This command has one or more optional arguments. See "OPTIONAL
7249 ARGUMENTS".
7250
7251 mount-local-run
7252 mount-local-run
7253
7254 Run the main loop which translates kernel calls to libguestfs calls.
7255
7256 This should only be called after "mount-local" returns successfully.
7257 The call will not return until the filesystem is unmounted.
7258
7259 Note you must not make concurrent libguestfs calls on the same handle
7260 from another thread.
7261
7262 You may call this from a different thread than the one which called
7263 "mount-local", subject to the usual rules for threads and libguestfs
7264 (see "MULTIPLE HANDLES AND MULTIPLE THREADS" in guestfs(3)).
7265
7266 See "MOUNT LOCAL" in guestfs(3) for full documentation.
7267
7268 mount-loop
7269 mount-loop file mountpoint
7270
7271 This command lets you mount file (a filesystem image in a file) on a
7272 mount point. It is entirely equivalent to the command "mount -o loop
7273 file mountpoint".
7274
7275 mount-options
7276 mount-options options mountable mountpoint
7277
7278 This is the same as the "mount" command, but it allows you to set the
7279 mount options as for the mount(8) -o flag.
7280
7281 If the "options" parameter is an empty string, then no options are
7282 passed (all options default to whatever the filesystem uses).
7283
7284 mount-ro
7285 mount-ro mountable mountpoint
7286
7287 This is the same as the "mount" command, but it mounts the filesystem
7288 with the read-only (-o ro) flag.
7289
7290 mount-vfs
7291 mount-vfs options vfstype mountable mountpoint
7292
7293 This is the same as the "mount" command, but it allows you to set both
7294 the mount options and the vfstype as for the mount(8) -o and -t flags.
7295
7296 mountable-device
7297 mountable-device mountable
7298
7299 Returns the device name of a mountable. In quite a lot of cases, the
7300 mountable is the device name.
7301
7302 However this doesn't apply for btrfs subvolumes, where the mountable is
7303 a combination of both the device name and the subvolume path (see also
7304 "mountable-subvolume" to extract the subvolume path of the mountable if
7305 any).
7306
7307 mountable-subvolume
7308 mountable-subvolume mountable
7309
7310 Returns the subvolume path of a mountable. Btrfs subvolumes mountables
7311 are a combination of both the device name and the subvolume path (see
7312 also "mountable-device" to extract the device of the mountable).
7313
7314 If the mountable does not represent a btrfs subvolume, then this
7315 function fails and the "errno" is set to "EINVAL".
7316
7317 mountpoints
7318 mountpoints
7319
7320 This call is similar to "mounts". That call returns a list of devices.
7321 This one returns a hash table (map) of device name to directory where
7322 the device is mounted.
7323
7324 mounts
7325 mounts
7326
7327 This returns the list of currently mounted filesystems. It returns the
7328 list of devices (eg. /dev/sda1, /dev/VG/LV).
7329
7330 Some internal mounts are not shown.
7331
7332 See also: "mountpoints"
7333
7334 mv
7335 mv src dest
7336
7337 This moves a file from "src" to "dest" where "dest" is either a
7338 destination filename or destination directory.
7339
7340 See also: "rename".
7341
7342 nr-devices
7343 nr-devices
7344
7345 This returns the number of whole block devices that were added. This
7346 is the same as the number of devices that would be returned if you
7347 called "list-devices".
7348
7349 To find out the maximum number of devices that could be added, call
7350 "max-disks".
7351
7352 ntfs-3g-probe
7353 ntfs-3g-probe true|false device
7354
7355 This command runs the ntfs-3g.probe(8) command which probes an NTFS
7356 "device" for mountability. (Not all NTFS volumes can be mounted read-
7357 write, and some cannot be mounted at all).
7358
7359 "rw" is a boolean flag. Set it to true if you want to test if the
7360 volume can be mounted read-write. Set it to false if you want to test
7361 if the volume can be mounted read-only.
7362
7363 The return value is an integer which 0 if the operation would succeed,
7364 or some non-zero value documented in the ntfs-3g.probe(8) manual page.
7365
7366 This command depends on the feature "ntfs3g". See also "feature-
7367 available".
7368
7369 ntfscat-i
7370 ntfscat-i device inode (filename|-)
7371
7372 Download a file given its inode from a NTFS filesystem and save it as
7373 filename on the local machine.
7374
7375 This allows to download some otherwise inaccessible files such as the
7376 ones within the $Extend folder.
7377
7378 The filesystem from which to extract the file must be unmounted,
7379 otherwise the call will fail.
7380
7381 Use "-" instead of a filename to read/write from stdin/stdout.
7382
7383 ntfsclone-in
7384 ntfsclone-in (backupfile|-) device
7385
7386 Restore the "backupfile" (from a previous call to "ntfsclone-out") to
7387 "device", overwriting any existing contents of this device.
7388
7389 Use "-" instead of a filename to read/write from stdin/stdout.
7390
7391 This command depends on the feature "ntfs3g". See also "feature-
7392 available".
7393
7394 ntfsclone-out
7395 ntfsclone-out device (backupfile|-) [metadataonly:true|false] [rescue:true|false] [ignorefscheck:true|false] [preservetimestamps:true|false] [force:true|false]
7396
7397 Stream the NTFS filesystem "device" to the local file "backupfile".
7398 The format used for the backup file is a special format used by the
7399 ntfsclone(8) tool.
7400
7401 If the optional "metadataonly" flag is true, then only the metadata is
7402 saved, losing all the user data (this is useful for diagnosing some
7403 filesystem problems).
7404
7405 The optional "rescue", "ignorefscheck", "preservetimestamps" and
7406 "force" flags have precise meanings detailed in the ntfsclone(8) man
7407 page.
7408
7409 Use "ntfsclone-in" to restore the file back to a libguestfs device.
7410
7411 Use "-" instead of a filename to read/write from stdin/stdout.
7412
7413 This command has one or more optional arguments. See "OPTIONAL
7414 ARGUMENTS".
7415
7416 This command depends on the feature "ntfs3g". See also "feature-
7417 available".
7418
7419 ntfsfix
7420 ntfsfix device [clearbadsectors:true|false]
7421
7422 This command repairs some fundamental NTFS inconsistencies, resets the
7423 NTFS journal file, and schedules an NTFS consistency check for the
7424 first boot into Windows.
7425
7426 This is not an equivalent of Windows "chkdsk". It does not scan the
7427 filesystem for inconsistencies.
7428
7429 The optional "clearbadsectors" flag clears the list of bad sectors.
7430 This is useful after cloning a disk with bad sectors to a new disk.
7431
7432 This command has one or more optional arguments. See "OPTIONAL
7433 ARGUMENTS".
7434
7435 This command depends on the feature "ntfs3g". See also "feature-
7436 available".
7437
7438 ntfsresize
7439 ntfsresize-opts
7440 ntfsresize device [size:N] [force:true|false]
7441
7442 This command resizes an NTFS filesystem, expanding or shrinking it to
7443 the size of the underlying device.
7444
7445 The optional parameters are:
7446
7447 "size"
7448 The new size (in bytes) of the filesystem. If omitted, the
7449 filesystem is resized to fit the container (eg. partition).
7450
7451 "force"
7452 If this option is true, then force the resize of the filesystem
7453 even if the filesystem is marked as requiring a consistency check.
7454
7455 After the resize operation, the filesystem is always marked as
7456 requiring a consistency check (for safety). You have to boot into
7457 Windows to perform this check and clear this condition. If you
7458 don't set the "force" option then it is not possible to call
7459 "ntfsresize" multiple times on a single filesystem without booting
7460 into Windows between each resize.
7461
7462 See also ntfsresize(8).
7463
7464 This command has one or more optional arguments. See "OPTIONAL
7465 ARGUMENTS".
7466
7467 This command depends on the feature "ntfsprogs". See also "feature-
7468 available".
7469
7470 ntfsresize-size
7471 ntfsresize-size device size
7472
7473 This command is the same as "ntfsresize" except that it allows you to
7474 specify the new size (in bytes) explicitly.
7475
7476 This function is deprecated. In new code, use the "ntfsresize" call
7477 instead.
7478
7479 Deprecated functions will not be removed from the API, but the fact
7480 that they are deprecated indicates that there are problems with correct
7481 use of these functions.
7482
7483 This command depends on the feature "ntfsprogs". See also "feature-
7484 available".
7485
7486 parse-environment
7487 parse-environment
7488
7489 Parse the program’s environment and set flags in the handle
7490 accordingly. For example if "LIBGUESTFS_DEBUG=1" then the ‘verbose’
7491 flag is set in the handle.
7492
7493 Most programs do not need to call this. It is done implicitly when you
7494 call "create".
7495
7496 See "ENVIRONMENT VARIABLES" in guestfs(3) for a list of environment
7497 variables that can affect libguestfs handles. See also
7498 "guestfs_create_flags" in guestfs(3), and "parse-environment-list".
7499
7500 parse-environment-list
7501 parse-environment-list 'environment ...'
7502
7503 Parse the list of strings in the argument "environment" and set flags
7504 in the handle accordingly. For example if "LIBGUESTFS_DEBUG=1" is a
7505 string in the list, then the ‘verbose’ flag is set in the handle.
7506
7507 This is the same as "parse-environment" except that it parses an
7508 explicit list of strings instead of the program's environment.
7509
7510 part-add
7511 part-add device prlogex startsect endsect
7512
7513 This command adds a partition to "device". If there is no partition
7514 table on the device, call "part-init" first.
7515
7516 The "prlogex" parameter is the type of partition. Normally you should
7517 pass "p" or "primary" here, but MBR partition tables also support "l"
7518 (or "logical") and "e" (or "extended") partition types.
7519
7520 "startsect" and "endsect" are the start and end of the partition in
7521 sectors. "endsect" may be negative, which means it counts backwards
7522 from the end of the disk ("-1" is the last sector).
7523
7524 Creating a partition which covers the whole disk is not so easy. Use
7525 "part-disk" to do that.
7526
7527 part-del
7528 part-del device partnum
7529
7530 This command deletes the partition numbered "partnum" on "device".
7531
7532 Note that in the case of MBR partitioning, deleting an extended
7533 partition also deletes any logical partitions it contains.
7534
7535 part-disk
7536 part-disk device parttype
7537
7538 This command is simply a combination of "part-init" followed by "part-
7539 add" to create a single primary partition covering the whole disk.
7540
7541 "parttype" is the partition table type, usually "mbr" or "gpt", but
7542 other possible values are described in "part-init".
7543
7544 part-expand-gpt
7545 part-expand-gpt device
7546
7547 Move backup GPT data structures to the end of the disk. This is useful
7548 in case of in-place image expand since disk space after backup GPT
7549 header is not usable. This is equivalent to "sgdisk -e".
7550
7551 See also sgdisk(8).
7552
7553 This command depends on the feature "gdisk". See also "feature-
7554 available".
7555
7556 part-get-bootable
7557 part-get-bootable device partnum
7558
7559 This command returns true if the partition "partnum" on "device" has
7560 the bootable flag set.
7561
7562 See also "part-set-bootable".
7563
7564 part-get-disk-guid
7565 part-get-disk-guid device
7566
7567 Return the disk identifier (GUID) of a GPT-partitioned "device".
7568 Behaviour is undefined for other partition types.
7569
7570 This command depends on the feature "gdisk". See also "feature-
7571 available".
7572
7573 part-get-gpt-attributes
7574 part-get-gpt-attributes device partnum
7575
7576 Return the attribute flags of numbered GPT partition "partnum". An
7577 error is returned for MBR partitions.
7578
7579 This command depends on the feature "gdisk". See also "feature-
7580 available".
7581
7582 part-get-gpt-guid
7583 part-get-gpt-guid device partnum
7584
7585 Return the GUID of numbered GPT partition "partnum".
7586
7587 This command depends on the feature "gdisk". See also "feature-
7588 available".
7589
7590 part-get-gpt-type
7591 part-get-gpt-type device partnum
7592
7593 Return the type GUID of numbered GPT partition "partnum". For MBR
7594 partitions, return an appropriate GUID corresponding to the MBR type.
7595 Behaviour is undefined for other partition types.
7596
7597 This command depends on the feature "gdisk". See also "feature-
7598 available".
7599
7600 part-get-mbr-id
7601 part-get-mbr-id device partnum
7602
7603 Returns the MBR type byte (also known as the ID byte) from the numbered
7604 partition "partnum".
7605
7606 Note that only MBR (old DOS-style) partitions have type bytes. You
7607 will get undefined results for other partition table types (see "part-
7608 get-parttype").
7609
7610 part-get-mbr-part-type
7611 part-get-mbr-part-type device partnum
7612
7613 This returns the partition type of an MBR partition numbered "partnum"
7614 on device "device".
7615
7616 It returns "primary", "logical", or "extended".
7617
7618 part-get-name
7619 part-get-name device partnum
7620
7621 This gets the partition name on partition numbered "partnum" on device
7622 "device". Note that partitions are numbered from 1.
7623
7624 The partition name can only be read on certain types of partition
7625 table. This works on "gpt" but not on "mbr" partitions.
7626
7627 part-get-parttype
7628 part-get-parttype device
7629
7630 This command examines the partition table on "device" and returns the
7631 partition table type (format) being used.
7632
7633 Common return values include: "msdos" (a DOS/Windows style MBR
7634 partition table), "gpt" (a GPT/EFI-style partition table). Other
7635 values are possible, although unusual. See "part-init" for a full
7636 list.
7637
7638 part-init
7639 part-init device parttype
7640
7641 This creates an empty partition table on "device" of one of the
7642 partition types listed below. Usually "parttype" should be either
7643 "msdos" or "gpt" (for large disks).
7644
7645 Initially there are no partitions. Following this, you should call
7646 "part-add" for each partition required.
7647
7648 Possible values for "parttype" are:
7649
7650 efi
7651 gpt Intel EFI / GPT partition table.
7652
7653 This is recommended for >= 2 TB partitions that will be accessed
7654 from Linux and Intel-based Mac OS X. It also has limited backwards
7655 compatibility with the "mbr" format.
7656
7657 mbr
7658 msdos
7659 The standard PC "Master Boot Record" (MBR) format used by MS-DOS
7660 and Windows. This partition type will only work for device sizes
7661 up to 2 TB. For large disks we recommend using "gpt".
7662
7663 Other partition table types that may work but are not supported
7664 include:
7665
7666 aix AIX disk labels.
7667
7668 amiga
7669 rdb Amiga "Rigid Disk Block" format.
7670
7671 bsd BSD disk labels.
7672
7673 dasd
7674 DASD, used on IBM mainframes.
7675
7676 dvh MIPS/SGI volumes.
7677
7678 mac Old Mac partition format. Modern Macs use "gpt".
7679
7680 pc98
7681 NEC PC-98 format, common in Japan apparently.
7682
7683 sun Sun disk labels.
7684
7685 part-list
7686 part-list device
7687
7688 This command parses the partition table on "device" and returns the
7689 list of partitions found.
7690
7691 The fields in the returned structure are:
7692
7693 part_num
7694 Partition number, counting from 1.
7695
7696 part_start
7697 Start of the partition in bytes. To get sectors you have to divide
7698 by the device’s sector size, see "blockdev-getss".
7699
7700 part_end
7701 End of the partition in bytes.
7702
7703 part_size
7704 Size of the partition in bytes.
7705
7706 part-resize
7707 part-resize device partnum endsect
7708
7709 This command resizes the partition numbered "partnum" on "device" by
7710 moving the end position.
7711
7712 Note that this does not modify any filesystem present in the partition.
7713 If you wish to do this, you will need to use filesystem resizing
7714 commands like "resize2fs".
7715
7716 When growing a partition you will want to grow the filesystem
7717 afterwards, but when shrinking, you need to shrink the filesystem
7718 before the partition.
7719
7720 part-set-bootable
7721 part-set-bootable device partnum true|false
7722
7723 This sets the bootable flag on partition numbered "partnum" on device
7724 "device". Note that partitions are numbered from 1.
7725
7726 The bootable flag is used by some operating systems (notably Windows)
7727 to determine which partition to boot from. It is by no means
7728 universally recognized.
7729
7730 part-set-disk-guid
7731 part-set-disk-guid device guid
7732
7733 Set the disk identifier (GUID) of a GPT-partitioned "device" to "guid".
7734 Return an error if the partition table of "device" isn't GPT, or if
7735 "guid" is not a valid GUID.
7736
7737 This command depends on the feature "gdisk". See also "feature-
7738 available".
7739
7740 part-set-disk-guid-random
7741 part-set-disk-guid-random device
7742
7743 Set the disk identifier (GUID) of a GPT-partitioned "device" to a
7744 randomly generated value. Return an error if the partition table of
7745 "device" isn't GPT.
7746
7747 This command depends on the feature "gdisk". See also "feature-
7748 available".
7749
7750 part-set-gpt-attributes
7751 part-set-gpt-attributes device partnum attributes
7752
7753 Set the attribute flags of numbered GPT partition "partnum" to
7754 "attributes". Return an error if the partition table of "device" isn't
7755 GPT.
7756
7757 See
7758 https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries
7759 for a useful list of partition attributes.
7760
7761 This command depends on the feature "gdisk". See also "feature-
7762 available".
7763
7764 part-set-gpt-guid
7765 part-set-gpt-guid device partnum guid
7766
7767 Set the GUID of numbered GPT partition "partnum" to "guid". Return an
7768 error if the partition table of "device" isn't GPT, or if "guid" is not
7769 a valid GUID.
7770
7771 This command depends on the feature "gdisk". See also "feature-
7772 available".
7773
7774 part-set-gpt-type
7775 part-set-gpt-type device partnum guid
7776
7777 Set the type GUID of numbered GPT partition "partnum" to "guid". Return
7778 an error if the partition table of "device" isn't GPT, or if "guid" is
7779 not a valid GUID.
7780
7781 See
7782 http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
7783 for a useful list of type GUIDs.
7784
7785 This command depends on the feature "gdisk". See also "feature-
7786 available".
7787
7788 part-set-mbr-id
7789 part-set-mbr-id device partnum idbyte
7790
7791 Sets the MBR type byte (also known as the ID byte) of the numbered
7792 partition "partnum" to "idbyte". Note that the type bytes quoted in
7793 most documentation are in fact hexadecimal numbers, but usually
7794 documented without any leading "0x" which might be confusing.
7795
7796 Note that only MBR (old DOS-style) partitions have type bytes. You
7797 will get undefined results for other partition table types (see "part-
7798 get-parttype").
7799
7800 part-set-name
7801 part-set-name device partnum name
7802
7803 This sets the partition name on partition numbered "partnum" on device
7804 "device". Note that partitions are numbered from 1.
7805
7806 The partition name can only be set on certain types of partition table.
7807 This works on "gpt" but not on "mbr" partitions.
7808
7809 part-to-dev
7810 part-to-dev partition
7811
7812 This function takes a partition name (eg. "/dev/sdb1") and removes the
7813 partition number, returning the device name (eg. "/dev/sdb").
7814
7815 The named partition must exist, for example as a string returned from
7816 "list-partitions".
7817
7818 See also "part-to-partnum", "device-index".
7819
7820 part-to-partnum
7821 part-to-partnum partition
7822
7823 This function takes a partition name (eg. "/dev/sdb1") and returns the
7824 partition number (eg. 1).
7825
7826 The named partition must exist, for example as a string returned from
7827 "list-partitions".
7828
7829 See also "part-to-dev".
7830
7831 ping-daemon
7832 ping-daemon
7833
7834 This is a test probe into the guestfs daemon running inside the
7835 libguestfs appliance. Calling this function checks that the daemon
7836 responds to the ping message, without affecting the daemon or attached
7837 block device(s) in any other way.
7838
7839 pread
7840 pread path count offset
7841
7842 This command lets you read part of a file. It reads "count" bytes of
7843 the file, starting at "offset", from file "path".
7844
7845 This may read fewer bytes than requested. For further details see the
7846 pread(2) system call.
7847
7848 See also "pwrite", "pread-device".
7849
7850 Because of the message protocol, there is a transfer limit of somewhere
7851 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
7852
7853 pread-device
7854 pread-device device count offset
7855
7856 This command lets you read part of a block device. It reads "count"
7857 bytes of "device", starting at "offset".
7858
7859 This may read fewer bytes than requested. For further details see the
7860 pread(2) system call.
7861
7862 See also "pread".
7863
7864 Because of the message protocol, there is a transfer limit of somewhere
7865 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
7866
7867 pvchange-uuid
7868 pvchange-uuid device
7869
7870 Generate a new random UUID for the physical volume "device".
7871
7872 This command depends on the feature "lvm2". See also "feature-
7873 available".
7874
7875 pvchange-uuid-all
7876 pvchange-uuid-all
7877
7878 Generate new random UUIDs for all physical volumes.
7879
7880 This command depends on the feature "lvm2". See also "feature-
7881 available".
7882
7883 pvcreate
7884 pvcreate device
7885
7886 This creates an LVM physical volume on the named "device", where
7887 "device" should usually be a partition name such as /dev/sda1.
7888
7889 This command depends on the feature "lvm2". See also "feature-
7890 available".
7891
7892 pvremove
7893 pvremove device
7894
7895 This wipes a physical volume "device" so that LVM will no longer
7896 recognise it.
7897
7898 The implementation uses the "pvremove" command which refuses to wipe
7899 physical volumes that contain any volume groups, so you have to remove
7900 those first.
7901
7902 This command depends on the feature "lvm2". See also "feature-
7903 available".
7904
7905 pvresize
7906 pvresize device
7907
7908 This resizes (expands or shrinks) an existing LVM physical volume to
7909 match the new size of the underlying device.
7910
7911 This command depends on the feature "lvm2". See also "feature-
7912 available".
7913
7914 pvresize-size
7915 pvresize-size device size
7916
7917 This command is the same as "pvresize" except that it allows you to
7918 specify the new size (in bytes) explicitly.
7919
7920 This command depends on the feature "lvm2". See also "feature-
7921 available".
7922
7923 pvs
7924 pvs
7925
7926 List all the physical volumes detected. This is the equivalent of the
7927 pvs(8) command.
7928
7929 This returns a list of just the device names that contain PVs (eg.
7930 /dev/sda2).
7931
7932 See also "pvs-full".
7933
7934 This command depends on the feature "lvm2". See also "feature-
7935 available".
7936
7937 pvs-full
7938 pvs-full
7939
7940 List all the physical volumes detected. This is the equivalent of the
7941 pvs(8) command. The "full" version includes all fields.
7942
7943 This command depends on the feature "lvm2". See also "feature-
7944 available".
7945
7946 pvuuid
7947 pvuuid device
7948
7949 This command returns the UUID of the LVM PV "device".
7950
7951 pwrite
7952 pwrite path content offset
7953
7954 This command writes to part of a file. It writes the data buffer
7955 "content" to the file "path" starting at offset "offset".
7956
7957 This command implements the pwrite(2) system call, and like that system
7958 call it may not write the full data requested. The return value is the
7959 number of bytes that were actually written to the file. This could
7960 even be 0, although short writes are unlikely for regular files in
7961 ordinary circumstances.
7962
7963 See also "pread", "pwrite-device".
7964
7965 Because of the message protocol, there is a transfer limit of somewhere
7966 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
7967
7968 pwrite-device
7969 pwrite-device device content offset
7970
7971 This command writes to part of a device. It writes the data buffer
7972 "content" to "device" starting at offset "offset".
7973
7974 This command implements the pwrite(2) system call, and like that system
7975 call it may not write the full data requested (although short writes to
7976 disk devices and partitions are probably impossible with standard Linux
7977 kernels).
7978
7979 See also "pwrite".
7980
7981 Because of the message protocol, there is a transfer limit of somewhere
7982 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
7983
7984 read-file
7985 read-file path
7986
7987 This calls returns the contents of the file "path" as a buffer.
7988
7989 Unlike "cat", this function can correctly handle files that contain
7990 embedded ASCII NUL characters.
7991
7992 read-lines
7993 read-lines path
7994
7995 Return the contents of the file named "path".
7996
7997 The file contents are returned as a list of lines. Trailing "LF" and
7998 "CRLF" character sequences are not returned.
7999
8000 Note that this function cannot correctly handle binary files
8001 (specifically, files containing "\0" character which is treated as end
8002 of string). For those you need to use the "read-file" function and
8003 split the buffer into lines yourself.
8004
8005 readdir
8006 readdir dir
8007
8008 This returns the list of directory entries in directory "dir".
8009
8010 All entries in the directory are returned, including "." and "..". The
8011 entries are not sorted, but returned in the same order as the
8012 underlying filesystem.
8013
8014 Also this call returns basic file type information about each file.
8015 The "ftyp" field will contain one of the following characters:
8016
8017 'b' Block special
8018
8019 'c' Char special
8020
8021 'd' Directory
8022
8023 'f' FIFO (named pipe)
8024
8025 'l' Symbolic link
8026
8027 'r' Regular file
8028
8029 's' Socket
8030
8031 'u' Unknown file type
8032
8033 '?' The readdir(3) call returned a "d_type" field with an unexpected
8034 value
8035
8036 This function is primarily intended for use by programs. To get a
8037 simple list of names, use "ls". To get a printable directory for human
8038 consumption, use "ll".
8039
8040 Because of the message protocol, there is a transfer limit of somewhere
8041 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
8042
8043 readlink
8044 readlink path
8045
8046 This command reads the target of a symbolic link.
8047
8048 readlinklist
8049 readlinklist path 'names ...'
8050
8051 This call allows you to do a "readlink" operation on multiple files,
8052 where all files are in the directory "path". "names" is the list of
8053 files from this directory.
8054
8055 On return you get a list of strings, with a one-to-one correspondence
8056 to the "names" list. Each string is the value of the symbolic link.
8057
8058 If the readlink(2) operation fails on any name, then the corresponding
8059 result string is the empty string "". However the whole operation is
8060 completed even if there were readlink(2) errors, and so you can call
8061 this function with names where you don't know if they are symbolic
8062 links already (albeit slightly less efficient).
8063
8064 This call is intended for programs that want to efficiently list a
8065 directory contents without making many round-trips.
8066
8067 realpath
8068 realpath path
8069
8070 Return the canonicalized absolute pathname of "path". The returned
8071 path has no ".", ".." or symbolic link path elements.
8072
8073 remount
8074 remount mountpoint [rw:true|false]
8075
8076 This call allows you to change the "rw" (readonly/read-write) flag on
8077 an already mounted filesystem at "mountpoint", converting a readonly
8078 filesystem to be read-write, or vice-versa.
8079
8080 Note that at the moment you must supply the "optional" "rw" parameter.
8081 In future we may allow other flags to be adjusted.
8082
8083 This command has one or more optional arguments. See "OPTIONAL
8084 ARGUMENTS".
8085
8086 remove-drive
8087 remove-drive label
8088
8089 This function is conceptually the opposite of "add-drive-opts". It
8090 removes the drive that was previously added with label "label".
8091
8092 Note that in order to remove drives, you have to add them with labels
8093 (see the optional "label" argument to "add-drive-opts"). If you didn't
8094 use a label, then they cannot be removed.
8095
8096 You can call this function before or after launching the handle. If
8097 called after launch, if the backend supports it, we try to hot unplug
8098 the drive: see "HOTPLUGGING" in guestfs(3). The disk must not be in
8099 use (eg. mounted) when you do this. We try to detect if the disk is in
8100 use and stop you from doing this.
8101
8102 removexattr
8103 removexattr xattr path
8104
8105 This call removes the extended attribute named "xattr" of the file
8106 "path".
8107
8108 See also: "lremovexattr", attr(5).
8109
8110 This command depends on the feature "linuxxattrs". See also "feature-
8111 available".
8112
8113 rename
8114 rename oldpath newpath
8115
8116 Rename a file to a new place on the same filesystem. This is the same
8117 as the Linux rename(2) system call. In most cases you are better to
8118 use "mv" instead.
8119
8120 resize2fs
8121 resize2fs device
8122
8123 This resizes an ext2, ext3 or ext4 filesystem to match the size of the
8124 underlying device.
8125
8126 See also "RESIZE2FS ERRORS" in guestfs(3).
8127
8128 resize2fs-M
8129 resize2fs-M device
8130
8131 This command is the same as "resize2fs", but the filesystem is resized
8132 to its minimum size. This works like the -M option to the "resize2fs"
8133 command.
8134
8135 To get the resulting size of the filesystem you should call "tune2fs-l"
8136 and read the "Block size" and "Block count" values. These two numbers,
8137 multiplied together, give the resulting size of the minimal filesystem
8138 in bytes.
8139
8140 See also "RESIZE2FS ERRORS" in guestfs(3).
8141
8142 resize2fs-size
8143 resize2fs-size device size
8144
8145 This command is the same as "resize2fs" except that it allows you to
8146 specify the new size (in bytes) explicitly.
8147
8148 See also "RESIZE2FS ERRORS" in guestfs(3).
8149
8150 rm
8151 rm path
8152
8153 Remove the single file "path".
8154
8155 rm-f
8156 rm-f path
8157
8158 Remove the file "path".
8159
8160 If the file doesn't exist, that error is ignored. (Other errors, eg.
8161 I/O errors or bad paths, are not ignored)
8162
8163 This call cannot remove directories. Use "rmdir" to remove an empty
8164 directory, or "rm-rf" to remove directories recursively.
8165
8166 rm-rf
8167 rm-rf path
8168
8169 Remove the file or directory "path", recursively removing the contents
8170 if its a directory. This is like the "rm -rf" shell command.
8171
8172 rmdir
8173 rmdir path
8174
8175 Remove the single directory "path".
8176
8177 rmmountpoint
8178 rmmountpoint exemptpath
8179
8180 This call removes a mountpoint that was previously created with
8181 "mkmountpoint". See "mkmountpoint" for full details.
8182
8183 rsync
8184 rsync src dest [archive:true|false] [deletedest:true|false]
8185
8186 This call may be used to copy or synchronize two directories under the
8187 same libguestfs handle. This uses the rsync(1) program which uses a
8188 fast algorithm that avoids copying files unnecessarily.
8189
8190 "src" and "dest" are the source and destination directories. Files are
8191 copied from "src" to "dest".
8192
8193 The optional arguments are:
8194
8195 "archive"
8196 Turns on archive mode. This is the same as passing the --archive
8197 flag to "rsync".
8198
8199 "deletedest"
8200 Delete files at the destination that do not exist at the source.
8201
8202 This command has one or more optional arguments. See "OPTIONAL
8203 ARGUMENTS".
8204
8205 This command depends on the feature "rsync". See also "feature-
8206 available".
8207
8208 rsync-in
8209 rsync-in remote dest [archive:true|false] [deletedest:true|false]
8210
8211 This call may be used to copy or synchronize the filesystem on the host
8212 or on a remote computer with the filesystem within libguestfs. This
8213 uses the rsync(1) program which uses a fast algorithm that avoids
8214 copying files unnecessarily.
8215
8216 This call only works if the network is enabled. See "set-network" or
8217 the --network option to various tools like guestfish(1).
8218
8219 Files are copied from the remote server and directory specified by
8220 "remote" to the destination directory "dest".
8221
8222 The format of the remote server string is defined by rsync(1). Note
8223 that there is no way to supply a password or passphrase so the target
8224 must be set up not to require one.
8225
8226 The optional arguments are the same as those of "rsync".
8227
8228 This command has one or more optional arguments. See "OPTIONAL
8229 ARGUMENTS".
8230
8231 This command depends on the feature "rsync". See also "feature-
8232 available".
8233
8234 rsync-out
8235 rsync-out src remote [archive:true|false] [deletedest:true|false]
8236
8237 This call may be used to copy or synchronize the filesystem within
8238 libguestfs with a filesystem on the host or on a remote computer. This
8239 uses the rsync(1) program which uses a fast algorithm that avoids
8240 copying files unnecessarily.
8241
8242 This call only works if the network is enabled. See "set-network" or
8243 the --network option to various tools like guestfish(1).
8244
8245 Files are copied from the source directory "src" to the remote server
8246 and directory specified by "remote".
8247
8248 The format of the remote server string is defined by rsync(1). Note
8249 that there is no way to supply a password or passphrase so the target
8250 must be set up not to require one.
8251
8252 The optional arguments are the same as those of "rsync".
8253
8254 Globbing does not happen on the "src" parameter. In programs which use
8255 the API directly you have to expand wildcards yourself (see "glob-
8256 expand"). In guestfish you can use the "glob" command (see "glob"),
8257 for example:
8258
8259 ><fs> glob rsync-out /* rsync://remote/
8260
8261 This command has one or more optional arguments. See "OPTIONAL
8262 ARGUMENTS".
8263
8264 This command depends on the feature "rsync". See also "feature-
8265 available".
8266
8267 scrub-device
8268 scrub-device device
8269
8270 This command writes patterns over "device" to make data retrieval more
8271 difficult.
8272
8273 It is an interface to the scrub(1) program. See that manual page for
8274 more details.
8275
8276 This command depends on the feature "scrub". See also "feature-
8277 available".
8278
8279 scrub-file
8280 scrub-file file
8281
8282 This command writes patterns over a file to make data retrieval more
8283 difficult.
8284
8285 The file is removed after scrubbing.
8286
8287 It is an interface to the scrub(1) program. See that manual page for
8288 more details.
8289
8290 This command depends on the feature "scrub". See also "feature-
8291 available".
8292
8293 scrub-freespace
8294 scrub-freespace dir
8295
8296 This command creates the directory "dir" and then fills it with files
8297 until the filesystem is full, and scrubs the files as for "scrub-file",
8298 and deletes them. The intention is to scrub any free space on the
8299 partition containing "dir".
8300
8301 It is an interface to the scrub(1) program. See that manual page for
8302 more details.
8303
8304 This command depends on the feature "scrub". See also "feature-
8305 available".
8306
8307 selinux-relabel
8308 selinux-relabel specfile path [force:true|false]
8309
8310 SELinux relabel parts of the filesystem.
8311
8312 The "specfile" parameter controls the policy spec file used. You have
8313 to parse "/etc/selinux/config" to find the correct SELinux policy and
8314 then pass the spec file, usually: "/etc/selinux/" + selinuxtype +
8315 "/contexts/files/file_contexts".
8316
8317 The required "path" parameter is the top level directory where
8318 relabelling starts. Normally you should pass "path" as "/" to relabel
8319 the whole guest filesystem.
8320
8321 The optional "force" boolean controls whether the context is reset for
8322 customizable files, and also whether the user, role and range parts of
8323 the file context is changed.
8324
8325 This command has one or more optional arguments. See "OPTIONAL
8326 ARGUMENTS".
8327
8328 This command depends on the feature "selinuxrelabel". See also
8329 "feature-available".
8330
8331 set-append
8332 append
8333 set-append append
8334
8335 This function is used to add additional options to the libguestfs
8336 appliance kernel command line.
8337
8338 The default is "NULL" unless overridden by setting "LIBGUESTFS_APPEND"
8339 environment variable.
8340
8341 Setting "append" to "NULL" means no additional options are passed
8342 (libguestfs always adds a few of its own).
8343
8344 set-attach-method
8345 attach-method
8346 set-attach-method backend
8347
8348 Set the method that libguestfs uses to connect to the backend guestfsd
8349 daemon.
8350
8351 See "BACKEND" in guestfs(3).
8352
8353 This function is deprecated. In new code, use the "set-backend" call
8354 instead.
8355
8356 Deprecated functions will not be removed from the API, but the fact
8357 that they are deprecated indicates that there are problems with correct
8358 use of these functions.
8359
8360 set-autosync
8361 autosync
8362 set-autosync true|false
8363
8364 If "autosync" is true, this enables autosync. Libguestfs will make a
8365 best effort attempt to make filesystems consistent and synchronized
8366 when the handle is closed (also if the program exits without closing
8367 handles).
8368
8369 This is enabled by default (since libguestfs 1.5.24, previously it was
8370 disabled by default).
8371
8372 set-backend
8373 backend
8374 set-backend backend
8375
8376 Set the method that libguestfs uses to connect to the backend guestfsd
8377 daemon.
8378
8379 This handle property was previously called the "attach method".
8380
8381 See "BACKEND" in guestfs(3).
8382
8383 set-backend-setting
8384 set-backend-setting name val
8385
8386 Append "name=value" to the backend settings string list. However if a
8387 string already exists matching "name" or beginning with "name=", then
8388 that setting is replaced.
8389
8390 See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
8391
8392 set-backend-settings
8393 set-backend-settings 'settings ...'
8394
8395 Set a list of zero or more settings which are passed through to the
8396 current backend. Each setting is a string which is interpreted in a
8397 backend-specific way, or ignored if not understood by the backend.
8398
8399 The default value is an empty list, unless the environment variable
8400 "LIBGUESTFS_BACKEND_SETTINGS" was set when the handle was created.
8401 This environment variable contains a colon-separated list of settings.
8402
8403 This call replaces all backend settings. If you want to replace a
8404 single backend setting, see "set-backend-setting". If you want to
8405 clear a single backend setting, see "clear-backend-setting".
8406
8407 See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
8408
8409 set-cachedir
8410 cachedir
8411 set-cachedir cachedir
8412
8413 Set the directory used by the handle to store the appliance cache, when
8414 using a supermin appliance. The appliance is cached and shared between
8415 all handles which have the same effective user ID.
8416
8417 The environment variables "LIBGUESTFS_CACHEDIR" and "TMPDIR" control
8418 the default value: If "LIBGUESTFS_CACHEDIR" is set, then that is the
8419 default. Else if "TMPDIR" is set, then that is the default. Else
8420 /var/tmp is the default.
8421
8422 set-direct
8423 direct
8424 set-direct true|false
8425
8426 If the direct appliance mode flag is enabled, then stdin and stdout are
8427 passed directly through to the appliance once it is launched.
8428
8429 One consequence of this is that log messages aren't caught by the
8430 library and handled by "set-log-message-callback", but go straight to
8431 stdout.
8432
8433 You probably don't want to use this unless you know what you are doing.
8434
8435 The default is disabled.
8436
8437 This function is deprecated. In new code, use the "internal-get-
8438 console-socket" call instead.
8439
8440 Deprecated functions will not be removed from the API, but the fact
8441 that they are deprecated indicates that there are problems with correct
8442 use of these functions.
8443
8444 set-e2attrs
8445 set-e2attrs file attrs [clear:true|false]
8446
8447 This sets or clears the file attributes "attrs" associated with the
8448 inode file.
8449
8450 "attrs" is a string of characters representing file attributes. See
8451 "get-e2attrs" for a list of possible attributes. Not all attributes
8452 can be changed.
8453
8454 If optional boolean "clear" is not present or false, then the "attrs"
8455 listed are set in the inode.
8456
8457 If "clear" is true, then the "attrs" listed are cleared in the inode.
8458
8459 In both cases, other attributes not present in the "attrs" string are
8460 left unchanged.
8461
8462 These attributes are only present when the file is located on an
8463 ext2/3/4 filesystem. Using this call on other filesystem types will
8464 result in an error.
8465
8466 This command has one or more optional arguments. See "OPTIONAL
8467 ARGUMENTS".
8468
8469 set-e2generation
8470 set-e2generation file generation
8471
8472 This sets the ext2 file generation of a file.
8473
8474 See "get-e2generation".
8475
8476 set-e2label
8477 set-e2label device label
8478
8479 This sets the ext2/3/4 filesystem label of the filesystem on "device"
8480 to "label". Filesystem labels are limited to 16 characters.
8481
8482 You can use either "tune2fs-l" or "get-e2label" to return the existing
8483 label on a filesystem.
8484
8485 This function is deprecated. In new code, use the "set-label" call
8486 instead.
8487
8488 Deprecated functions will not be removed from the API, but the fact
8489 that they are deprecated indicates that there are problems with correct
8490 use of these functions.
8491
8492 set-e2uuid
8493 set-e2uuid device uuid
8494
8495 This sets the ext2/3/4 filesystem UUID of the filesystem on "device" to
8496 "uuid". The format of the UUID and alternatives such as "clear",
8497 "random" and "time" are described in the tune2fs(8) manpage.
8498
8499 You can use "vfs-uuid" to return the existing UUID of a filesystem.
8500
8501 This function is deprecated. In new code, use the "set-uuid" call
8502 instead.
8503
8504 Deprecated functions will not be removed from the API, but the fact
8505 that they are deprecated indicates that there are problems with correct
8506 use of these functions.
8507
8508 set-hv
8509 hv
8510 set-hv hv
8511
8512 Set the hypervisor binary that we will use. The hypervisor depends on
8513 the backend, but is usually the location of the qemu/KVM hypervisor.
8514 For the uml backend, it is the location of the "linux" or "vmlinux"
8515 binary.
8516
8517 The default is chosen when the library was compiled by the configure
8518 script.
8519
8520 You can also override this by setting the "LIBGUESTFS_HV" environment
8521 variable.
8522
8523 Note that you should call this function as early as possible after
8524 creating the handle. This is because some pre-launch operations depend
8525 on testing qemu features (by running "qemu -help"). If the qemu binary
8526 changes, we don't retest features, and so you might see inconsistent
8527 results. Using the environment variable "LIBGUESTFS_HV" is safest of
8528 all since that picks the qemu binary at the same time as the handle is
8529 created.
8530
8531 set-identifier
8532 identifier
8533 set-identifier identifier
8534
8535 This is an informative string which the caller may optionally set in
8536 the handle. It is printed in various places, allowing the current
8537 handle to be identified in debugging output.
8538
8539 One important place is when tracing is enabled. If the identifier
8540 string is not an empty string, then trace messages change from this:
8541
8542 libguestfs: trace: get_tmpdir
8543 libguestfs: trace: get_tmpdir = "/tmp"
8544
8545 to this:
8546
8547 libguestfs: trace: ID: get_tmpdir
8548 libguestfs: trace: ID: get_tmpdir = "/tmp"
8549
8550 where "ID" is the identifier string set by this call.
8551
8552 The identifier must only contain alphanumeric ASCII characters,
8553 underscore and minus sign. The default is the empty string.
8554
8555 See also "set-program", "set-trace", "get-identifier".
8556
8557 set-label
8558 set-label mountable label
8559
8560 Set the filesystem label on "mountable" to "label".
8561
8562 Only some filesystem types support labels, and libguestfs supports
8563 setting labels on only a subset of these.
8564
8565 ext2, ext3, ext4
8566 Labels are limited to 16 bytes.
8567
8568 NTFS
8569 Labels are limited to 128 unicode characters.
8570
8571 XFS The label is limited to 12 bytes. The filesystem must not be
8572 mounted when trying to set the label.
8573
8574 btrfs
8575 The label is limited to 255 bytes and some characters are not
8576 allowed. Setting the label on a btrfs subvolume will set the label
8577 on its parent filesystem. The filesystem must not be mounted when
8578 trying to set the label.
8579
8580 fat The label is limited to 11 bytes.
8581
8582 swap
8583 The label is limited to 16 bytes.
8584
8585 If there is no support for changing the label for the type of the
8586 specified filesystem, set_label will fail and set errno as ENOTSUP.
8587
8588 To read the label on a filesystem, call "vfs-label".
8589
8590 set-libvirt-requested-credential
8591 set-libvirt-requested-credential index cred
8592
8593 After requesting the "index"'th credential from the user, call this
8594 function to pass the answer back to libvirt.
8595
8596 See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
8597 example code.
8598
8599 set-libvirt-supported-credentials
8600 set-libvirt-supported-credentials 'creds ...'
8601
8602 Call this function before setting an event handler for
8603 "GUESTFS_EVENT_LIBVIRT_AUTH", to supply the list of credential types
8604 that the program knows how to process.
8605
8606 The "creds" list must be a non-empty list of strings. Possible strings
8607 are:
8608
8609 "username"
8610 "authname"
8611 "language"
8612 "cnonce"
8613 "passphrase"
8614 "echoprompt"
8615 "noechoprompt"
8616 "realm"
8617 "external"
8618
8619 See libvirt documentation for the meaning of these credential types.
8620
8621 See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
8622 example code.
8623
8624 set-memsize
8625 memsize
8626 set-memsize memsize
8627
8628 This sets the memory size in megabytes allocated to the hypervisor.
8629 This only has any effect if called before "launch".
8630
8631 You can also change this by setting the environment variable
8632 "LIBGUESTFS_MEMSIZE" before the handle is created.
8633
8634 For more information on the architecture of libguestfs, see guestfs(3).
8635
8636 set-network
8637 network
8638 set-network true|false
8639
8640 If "network" is true, then the network is enabled in the libguestfs
8641 appliance. The default is false.
8642
8643 This affects whether commands are able to access the network (see
8644 "RUNNING COMMANDS" in guestfs(3)).
8645
8646 You must call this before calling "launch", otherwise it has no effect.
8647
8648 set-path
8649 path
8650 set-path searchpath
8651
8652 Set the path that libguestfs searches for kernel and initrd.img.
8653
8654 The default is "$libdir/guestfs" unless overridden by setting
8655 "LIBGUESTFS_PATH" environment variable.
8656
8657 Setting "path" to "NULL" restores the default path.
8658
8659 set-pgroup
8660 pgroup
8661 set-pgroup true|false
8662
8663 If "pgroup" is true, child processes are placed into their own process
8664 group.
8665
8666 The practical upshot of this is that signals like "SIGINT" (from users
8667 pressing "^C") won't be received by the child process.
8668
8669 The default for this flag is false, because usually you want "^C" to
8670 kill the subprocess. Guestfish sets this flag to true when used
8671 interactively, so that "^C" can cancel long-running commands gracefully
8672 (see "user-cancel").
8673
8674 set-program
8675 program
8676 set-program program
8677
8678 Set the program name. This is an informative string which the main
8679 program may optionally set in the handle.
8680
8681 When the handle is created, the program name in the handle is set to
8682 the basename from "argv[0]". The program name can never be "NULL".
8683
8684 set-qemu
8685 qemu
8686 set-qemu hv
8687
8688 Set the hypervisor binary (usually qemu) that we will use.
8689
8690 The default is chosen when the library was compiled by the configure
8691 script.
8692
8693 You can also override this by setting the "LIBGUESTFS_HV" environment
8694 variable.
8695
8696 Setting "hv" to "NULL" restores the default qemu binary.
8697
8698 Note that you should call this function as early as possible after
8699 creating the handle. This is because some pre-launch operations depend
8700 on testing qemu features (by running "qemu -help"). If the qemu binary
8701 changes, we don't retest features, and so you might see inconsistent
8702 results. Using the environment variable "LIBGUESTFS_HV" is safest of
8703 all since that picks the qemu binary at the same time as the handle is
8704 created.
8705
8706 This function is deprecated. In new code, use the "set-hv" call
8707 instead.
8708
8709 Deprecated functions will not be removed from the API, but the fact
8710 that they are deprecated indicates that there are problems with correct
8711 use of these functions.
8712
8713 set-recovery-proc
8714 recovery-proc
8715 set-recovery-proc true|false
8716
8717 If this is called with the parameter "false" then "launch" does not
8718 create a recovery process. The purpose of the recovery process is to
8719 stop runaway hypervisor processes in the case where the main program
8720 aborts abruptly.
8721
8722 This only has any effect if called before "launch", and the default is
8723 true.
8724
8725 About the only time when you would want to disable this is if the main
8726 process will fork itself into the background ("daemonize" itself). In
8727 this case the recovery process thinks that the main program has
8728 disappeared and so kills the hypervisor, which is not very helpful.
8729
8730 set-selinux
8731 selinux
8732 set-selinux true|false
8733
8734 This sets the selinux flag that is passed to the appliance at boot
8735 time. The default is "selinux=0" (disabled).
8736
8737 Note that if SELinux is enabled, it is always in Permissive mode
8738 ("enforcing=0").
8739
8740 For more information on the architecture of libguestfs, see guestfs(3).
8741
8742 This function is deprecated. In new code, use the "selinux-relabel"
8743 call instead.
8744
8745 Deprecated functions will not be removed from the API, but the fact
8746 that they are deprecated indicates that there are problems with correct
8747 use of these functions.
8748
8749 set-smp
8750 smp
8751 set-smp smp
8752
8753 Change the number of virtual CPUs assigned to the appliance. The
8754 default is 1. Increasing this may improve performance, though often it
8755 has no effect.
8756
8757 This function must be called before "launch".
8758
8759 set-tmpdir
8760 tmpdir
8761 set-tmpdir tmpdir
8762
8763 Set the directory used by the handle to store temporary files.
8764
8765 The environment variables "LIBGUESTFS_TMPDIR" and "TMPDIR" control the
8766 default value: If "LIBGUESTFS_TMPDIR" is set, then that is the default.
8767 Else if "TMPDIR" is set, then that is the default. Else /tmp is the
8768 default.
8769
8770 set-trace
8771 trace
8772 set-trace true|false
8773
8774 If the command trace flag is set to 1, then libguestfs calls,
8775 parameters and return values are traced.
8776
8777 If you want to trace C API calls into libguestfs (and other libraries)
8778 then possibly a better way is to use the external ltrace(1) command.
8779
8780 Command traces are disabled unless the environment variable
8781 "LIBGUESTFS_TRACE" is defined and set to 1.
8782
8783 Trace messages are normally sent to "stderr", unless you register a
8784 callback to send them somewhere else (see "set-event-callback").
8785
8786 set-uuid
8787 set-uuid device uuid
8788
8789 Set the filesystem UUID on "device" to "uuid". If this fails and the
8790 errno is ENOTSUP, means that there is no support for changing the UUID
8791 for the type of the specified filesystem.
8792
8793 Only some filesystem types support setting UUIDs.
8794
8795 To read the UUID on a filesystem, call "vfs-uuid".
8796
8797 set-uuid-random
8798 set-uuid-random device
8799
8800 Set the filesystem UUID on "device" to a random UUID. If this fails
8801 and the errno is ENOTSUP, means that there is no support for changing
8802 the UUID for the type of the specified filesystem.
8803
8804 Only some filesystem types support setting UUIDs.
8805
8806 To read the UUID on a filesystem, call "vfs-uuid".
8807
8808 set-verbose
8809 verbose
8810 set-verbose true|false
8811
8812 If "verbose" is true, this turns on verbose messages.
8813
8814 Verbose messages are disabled unless the environment variable
8815 "LIBGUESTFS_DEBUG" is defined and set to 1.
8816
8817 Verbose messages are normally sent to "stderr", unless you register a
8818 callback to send them somewhere else (see "set-event-callback").
8819
8820 setcon
8821 setcon context
8822
8823 This sets the SELinux security context of the daemon to the string
8824 "context".
8825
8826 See the documentation about SELINUX in guestfs(3).
8827
8828 This function is deprecated. In new code, use the "selinux-relabel"
8829 call instead.
8830
8831 Deprecated functions will not be removed from the API, but the fact
8832 that they are deprecated indicates that there are problems with correct
8833 use of these functions.
8834
8835 This command depends on the feature "selinux". See also "feature-
8836 available".
8837
8838 setxattr
8839 setxattr xattr val vallen path
8840
8841 This call sets the extended attribute named "xattr" of the file "path"
8842 to the value "val" (of length "vallen"). The value is arbitrary 8 bit
8843 data.
8844
8845 See also: "lsetxattr", attr(5).
8846
8847 This command depends on the feature "linuxxattrs". See also "feature-
8848 available".
8849
8850 sfdisk
8851 sfdisk device cyls heads sectors 'lines ...'
8852
8853 This is a direct interface to the sfdisk(8) program for creating
8854 partitions on block devices.
8855
8856 "device" should be a block device, for example /dev/sda.
8857
8858 "cyls", "heads" and "sectors" are the number of cylinders, heads and
8859 sectors on the device, which are passed directly to sfdisk as the -C,
8860 -H and -S parameters. If you pass 0 for any of these, then the
8861 corresponding parameter is omitted. Usually for ‘large’ disks, you can
8862 just pass 0 for these, but for small (floppy-sized) disks, sfdisk (or
8863 rather, the kernel) cannot work out the right geometry and you will
8864 need to tell it.
8865
8866 "lines" is a list of lines that we feed to "sfdisk". For more
8867 information refer to the sfdisk(8) manpage.
8868
8869 To create a single partition occupying the whole disk, you would pass
8870 "lines" as a single element list, when the single element being the
8871 string "," (comma).
8872
8873 See also: "sfdisk-l", "sfdisk-N", "part-init"
8874
8875 This function is deprecated. In new code, use the "part-add" call
8876 instead.
8877
8878 Deprecated functions will not be removed from the API, but the fact
8879 that they are deprecated indicates that there are problems with correct
8880 use of these functions.
8881
8882 sfdiskM
8883 sfdiskM device 'lines ...'
8884
8885 This is a simplified interface to the "sfdisk" command, where partition
8886 sizes are specified in megabytes only (rounded to the nearest cylinder)
8887 and you don't need to specify the cyls, heads and sectors parameters
8888 which were rarely if ever used anyway.
8889
8890 See also: "sfdisk", the sfdisk(8) manpage and "part-disk"
8891
8892 This function is deprecated. In new code, use the "part-add" call
8893 instead.
8894
8895 Deprecated functions will not be removed from the API, but the fact
8896 that they are deprecated indicates that there are problems with correct
8897 use of these functions.
8898
8899 sfdisk-N
8900 sfdisk-N device partnum cyls heads sectors line
8901
8902 This runs sfdisk(8) option to modify just the single partition "n"
8903 (note: "n" counts from 1).
8904
8905 For other parameters, see "sfdisk". You should usually pass 0 for the
8906 cyls/heads/sectors parameters.
8907
8908 See also: "part-add"
8909
8910 This function is deprecated. In new code, use the "part-add" call
8911 instead.
8912
8913 Deprecated functions will not be removed from the API, but the fact
8914 that they are deprecated indicates that there are problems with correct
8915 use of these functions.
8916
8917 sfdisk-disk-geometry
8918 sfdisk-disk-geometry device
8919
8920 This displays the disk geometry of "device" read from the partition
8921 table. Especially in the case where the underlying block device has
8922 been resized, this can be different from the kernel’s idea of the
8923 geometry (see "sfdisk-kernel-geometry").
8924
8925 The result is in human-readable format, and not designed to be parsed.
8926
8927 sfdisk-kernel-geometry
8928 sfdisk-kernel-geometry device
8929
8930 This displays the kernel’s idea of the geometry of "device".
8931
8932 The result is in human-readable format, and not designed to be parsed.
8933
8934 sfdisk-l
8935 sfdisk-l device
8936
8937 This displays the partition table on "device", in the human-readable
8938 output of the sfdisk(8) command. It is not intended to be parsed.
8939
8940 See also: "part-list"
8941
8942 This function is deprecated. In new code, use the "part-list" call
8943 instead.
8944
8945 Deprecated functions will not be removed from the API, but the fact
8946 that they are deprecated indicates that there are problems with correct
8947 use of these functions.
8948
8949 sh
8950 sh command
8951
8952 This call runs a command from the guest filesystem via the guest’s
8953 /bin/sh.
8954
8955 This is like "command", but passes the command to:
8956
8957 /bin/sh -c "command"
8958
8959 Depending on the guest’s shell, this usually results in wildcards being
8960 expanded, shell expressions being interpolated and so on.
8961
8962 All the provisos about "command" apply to this call.
8963
8964 sh-lines
8965 sh-lines command
8966
8967 This is the same as "sh", but splits the result into a list of lines.
8968
8969 See also: "command-lines"
8970
8971 shutdown
8972 shutdown
8973
8974 This is the opposite of "launch". It performs an orderly shutdown of
8975 the backend process(es). If the autosync flag is set (which is the
8976 default) then the disk image is synchronized.
8977
8978 If the subprocess exits with an error then this function will return an
8979 error, which should not be ignored (it may indicate that the disk image
8980 could not be written out properly).
8981
8982 It is safe to call this multiple times. Extra calls are ignored.
8983
8984 This call does not close or free up the handle. You still need to call
8985 "close" afterwards.
8986
8987 "close" will call this if you don't do it explicitly, but note that any
8988 errors are ignored in that case.
8989
8990 sleep
8991 sleep secs
8992
8993 Sleep for "secs" seconds.
8994
8995 stat
8996 stat path
8997
8998 Returns file information for the given "path".
8999
9000 This is the same as the stat(2) system call.
9001
9002 This function is deprecated. In new code, use the "statns" call
9003 instead.
9004
9005 Deprecated functions will not be removed from the API, but the fact
9006 that they are deprecated indicates that there are problems with correct
9007 use of these functions.
9008
9009 statns
9010 statns path
9011
9012 Returns file information for the given "path".
9013
9014 This is the same as the stat(2) system call.
9015
9016 statvfs
9017 statvfs path
9018
9019 Returns file system statistics for any mounted file system. "path"
9020 should be a file or directory in the mounted file system (typically it
9021 is the mount point itself, but it doesn't need to be).
9022
9023 This is the same as the statvfs(2) system call.
9024
9025 strings
9026 strings path
9027
9028 This runs the strings(1) command on a file and returns the list of
9029 printable strings found.
9030
9031 The "strings" command has, in the past, had problems with parsing
9032 untrusted files. These are mitigated in the current version of
9033 libguestfs, but see "CVE-2014-8484" in guestfs(3).
9034
9035 Because of the message protocol, there is a transfer limit of somewhere
9036 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
9037
9038 strings-e
9039 strings-e encoding path
9040
9041 This is like the "strings" command, but allows you to specify the
9042 encoding of strings that are looked for in the source file "path".
9043
9044 Allowed encodings are:
9045
9046 s Single 7-bit-byte characters like ASCII and the ASCII-compatible
9047 parts of ISO-8859-X (this is what "strings" uses).
9048
9049 S Single 8-bit-byte characters.
9050
9051 b 16-bit big endian strings such as those encoded in UTF-16BE or
9052 UCS-2BE.
9053
9054 l (lower case letter L)
9055 16-bit little endian such as UTF-16LE and UCS-2LE. This is useful
9056 for examining binaries in Windows guests.
9057
9058 B 32-bit big endian such as UCS-4BE.
9059
9060 L 32-bit little endian such as UCS-4LE.
9061
9062 The returned strings are transcoded to UTF-8.
9063
9064 The "strings" command has, in the past, had problems with parsing
9065 untrusted files. These are mitigated in the current version of
9066 libguestfs, but see "CVE-2014-8484" in guestfs(3).
9067
9068 Because of the message protocol, there is a transfer limit of somewhere
9069 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
9070
9071 swapoff-device
9072 swapoff-device device
9073
9074 This command disables the libguestfs appliance swap device or partition
9075 named "device". See "swapon-device".
9076
9077 swapoff-file
9078 swapoff-file file
9079
9080 This command disables the libguestfs appliance swap on file.
9081
9082 swapoff-label
9083 swapoff-label label
9084
9085 This command disables the libguestfs appliance swap on labeled swap
9086 partition.
9087
9088 swapoff-uuid
9089 swapoff-uuid uuid
9090
9091 This command disables the libguestfs appliance swap partition with the
9092 given UUID.
9093
9094 This command depends on the feature "linuxfsuuid". See also "feature-
9095 available".
9096
9097 swapon-device
9098 swapon-device device
9099
9100 This command enables the libguestfs appliance to use the swap device or
9101 partition named "device". The increased memory is made available for
9102 all commands, for example those run using "command" or "sh".
9103
9104 Note that you should not swap to existing guest swap partitions unless
9105 you know what you are doing. They may contain hibernation information,
9106 or other information that the guest doesn't want you to trash. You
9107 also risk leaking information about the host to the guest this way.
9108 Instead, attach a new host device to the guest and swap on that.
9109
9110 swapon-file
9111 swapon-file file
9112
9113 This command enables swap to a file. See "swapon-device" for other
9114 notes.
9115
9116 swapon-label
9117 swapon-label label
9118
9119 This command enables swap to a labeled swap partition. See "swapon-
9120 device" for other notes.
9121
9122 swapon-uuid
9123 swapon-uuid uuid
9124
9125 This command enables swap to a swap partition with the given UUID. See
9126 "swapon-device" for other notes.
9127
9128 This command depends on the feature "linuxfsuuid". See also "feature-
9129 available".
9130
9131 sync
9132 sync
9133
9134 This syncs the disk, so that any writes are flushed through to the
9135 underlying disk image.
9136
9137 You should always call this if you have modified a disk image, before
9138 closing the handle.
9139
9140 syslinux
9141 syslinux device [directory:..]
9142
9143 Install the SYSLINUX bootloader on "device".
9144
9145 The device parameter must be either a whole disk formatted as a FAT
9146 filesystem, or a partition formatted as a FAT filesystem. In the
9147 latter case, the partition should be marked as "active" ("part-set-
9148 bootable") and a Master Boot Record must be installed (eg. using
9149 "pwrite-device") on the first sector of the whole disk. The SYSLINUX
9150 package comes with some suitable Master Boot Records. See the
9151 syslinux(1) man page for further information.
9152
9153 The optional arguments are:
9154
9155 directory
9156 Install SYSLINUX in the named subdirectory, instead of in the root
9157 directory of the FAT filesystem.
9158
9159 Additional configuration can be supplied to SYSLINUX by placing a file
9160 called syslinux.cfg on the FAT filesystem, either in the root
9161 directory, or under directory if that optional argument is being used.
9162 For further information about the contents of this file, see
9163 syslinux(1).
9164
9165 See also "extlinux".
9166
9167 This command has one or more optional arguments. See "OPTIONAL
9168 ARGUMENTS".
9169
9170 This command depends on the feature "syslinux". See also "feature-
9171 available".
9172
9173 tail
9174 tail path
9175
9176 This command returns up to the last 10 lines of a file as a list of
9177 strings.
9178
9179 Because of the message protocol, there is a transfer limit of somewhere
9180 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
9181
9182 tail-n
9183 tail-n nrlines path
9184
9185 If the parameter "nrlines" is a positive number, this returns the last
9186 "nrlines" lines of the file "path".
9187
9188 If the parameter "nrlines" is a negative number, this returns lines
9189 from the file "path", starting with the "-nrlines"th line.
9190
9191 If the parameter "nrlines" is zero, this returns an empty list.
9192
9193 Because of the message protocol, there is a transfer limit of somewhere
9194 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
9195
9196 tar-in
9197 tar-in-opts
9198 tar-in (tarfile|-) directory [compress:..] [xattrs:true|false] [selinux:true|false] [acls:true|false]
9199
9200 This command uploads and unpacks local file "tarfile" into directory.
9201
9202 The optional "compress" flag controls compression. If not given, then
9203 the input should be an uncompressed tar file. Otherwise one of the
9204 following strings may be given to select the compression type of the
9205 input file: "compress", "gzip", "bzip2", "xz", "lzop". (Note that not
9206 all builds of libguestfs will support all of these compression types).
9207
9208 The other optional arguments are:
9209
9210 "xattrs"
9211 If set to true, extended attributes are restored from the tar file.
9212
9213 "selinux"
9214 If set to true, SELinux contexts are restored from the tar file.
9215
9216 "acls"
9217 If set to true, POSIX ACLs are restored from the tar file.
9218
9219 Use "-" instead of a filename to read/write from stdin/stdout.
9220
9221 This command has one or more optional arguments. See "OPTIONAL
9222 ARGUMENTS".
9223
9224 tar-out
9225 tar-out-opts
9226 tar-out directory (tarfile|-) [compress:..] [numericowner:true|false] [excludes:..] [xattrs:true|false] [selinux:true|false] [acls:true|false]
9227
9228 This command packs the contents of directory and downloads it to local
9229 file "tarfile".
9230
9231 The optional "compress" flag controls compression. If not given, then
9232 the output will be an uncompressed tar file. Otherwise one of the
9233 following strings may be given to select the compression type of the
9234 output file: "compress", "gzip", "bzip2", "xz", "lzop". (Note that not
9235 all builds of libguestfs will support all of these compression types).
9236
9237 The other optional arguments are:
9238
9239 "excludes"
9240 A list of wildcards. Files are excluded if they match any of the
9241 wildcards.
9242
9243 "numericowner"
9244 If set to true, the output tar file will contain UID/GID numbers
9245 instead of user/group names.
9246
9247 "xattrs"
9248 If set to true, extended attributes are saved in the output tar.
9249
9250 "selinux"
9251 If set to true, SELinux contexts are saved in the output tar.
9252
9253 "acls"
9254 If set to true, POSIX ACLs are saved in the output tar.
9255
9256 Use "-" instead of a filename to read/write from stdin/stdout.
9257
9258 This command has one or more optional arguments. See "OPTIONAL
9259 ARGUMENTS".
9260
9261 tgz-in
9262 tgz-in (tarball|-) directory
9263
9264 This command uploads and unpacks local file "tarball" (a gzip
9265 compressed tar file) into directory.
9266
9267 Use "-" instead of a filename to read/write from stdin/stdout.
9268
9269 This function is deprecated. In new code, use the "tar-in" call
9270 instead.
9271
9272 Deprecated functions will not be removed from the API, but the fact
9273 that they are deprecated indicates that there are problems with correct
9274 use of these functions.
9275
9276 tgz-out
9277 tgz-out directory (tarball|-)
9278
9279 This command packs the contents of directory and downloads it to local
9280 file "tarball".
9281
9282 Use "-" instead of a filename to read/write from stdin/stdout.
9283
9284 This function is deprecated. In new code, use the "tar-out" call
9285 instead.
9286
9287 Deprecated functions will not be removed from the API, but the fact
9288 that they are deprecated indicates that there are problems with correct
9289 use of these functions.
9290
9291 touch
9292 touch path
9293
9294 Touch acts like the touch(1) command. It can be used to update the
9295 timestamps on a file, or, if the file does not exist, to create a new
9296 zero-length file.
9297
9298 This command only works on regular files, and will fail on other file
9299 types such as directories, symbolic links, block special etc.
9300
9301 truncate
9302 truncate path
9303
9304 This command truncates "path" to a zero-length file. The file must
9305 exist already.
9306
9307 truncate-size
9308 truncate-size path size
9309
9310 This command truncates "path" to size "size" bytes. The file must
9311 exist already.
9312
9313 If the current file size is less than "size" then the file is extended
9314 to the required size with zero bytes. This creates a sparse file (ie.
9315 disk blocks are not allocated for the file until you write to it). To
9316 create a non-sparse file of zeroes, use "fallocate64" instead.
9317
9318 tune2fs
9319 tune2fs device [force:true|false] [maxmountcount:N] [mountcount:N] [errorbehavior:..] [group:N] [intervalbetweenchecks:N] [reservedblockspercentage:N] [lastmounteddirectory:..] [reservedblockscount:N] [user:N]
9320
9321 This call allows you to adjust various filesystem parameters of an
9322 ext2/ext3/ext4 filesystem called "device".
9323
9324 The optional parameters are:
9325
9326 "force"
9327 Force tune2fs to complete the operation even in the face of errors.
9328 This is the same as the tune2fs "-f" option.
9329
9330 "maxmountcount"
9331 Set the number of mounts after which the filesystem is checked by
9332 e2fsck(8). If this is 0 then the number of mounts is disregarded.
9333 This is the same as the tune2fs "-c" option.
9334
9335 "mountcount"
9336 Set the number of times the filesystem has been mounted. This is
9337 the same as the tune2fs "-C" option.
9338
9339 "errorbehavior"
9340 Change the behavior of the kernel code when errors are detected.
9341 Possible values currently are: "continue", "remount-ro", "panic".
9342 In practice these options don't really make any difference,
9343 particularly for write errors.
9344
9345 This is the same as the tune2fs "-e" option.
9346
9347 "group"
9348 Set the group which can use reserved filesystem blocks. This is
9349 the same as the tune2fs "-g" option except that it can only be
9350 specified as a number.
9351
9352 "intervalbetweenchecks"
9353 Adjust the maximal time between two filesystem checks (in seconds).
9354 If the option is passed as 0 then time-dependent checking is
9355 disabled.
9356
9357 This is the same as the tune2fs "-i" option.
9358
9359 "reservedblockspercentage"
9360 Set the percentage of the filesystem which may only be allocated by
9361 privileged processes. This is the same as the tune2fs "-m" option.
9362
9363 "lastmounteddirectory"
9364 Set the last mounted directory. This is the same as the tune2fs
9365 "-M" option.
9366
9367 "reservedblockscount" Set the number of reserved filesystem blocks.
9368 This is the same as the tune2fs "-r" option.
9369 "user"
9370 Set the user who can use the reserved filesystem blocks. This is
9371 the same as the tune2fs "-u" option except that it can only be
9372 specified as a number.
9373
9374 To get the current values of filesystem parameters, see "tune2fs-l".
9375 For precise details of how tune2fs works, see the tune2fs(8) man page.
9376
9377 This command has one or more optional arguments. See "OPTIONAL
9378 ARGUMENTS".
9379
9380 tune2fs-l
9381 tune2fs-l device
9382
9383 This returns the contents of the ext2, ext3 or ext4 filesystem
9384 superblock on "device".
9385
9386 It is the same as running "tune2fs -l device". See tune2fs(8) manpage
9387 for more details. The list of fields returned isn't clearly defined,
9388 and depends on both the version of "tune2fs" that libguestfs was built
9389 against, and the filesystem itself.
9390
9391 txz-in
9392 txz-in (tarball|-) directory
9393
9394 This command uploads and unpacks local file "tarball" (an xz compressed
9395 tar file) into directory.
9396
9397 Use "-" instead of a filename to read/write from stdin/stdout.
9398
9399 This function is deprecated. In new code, use the "tar-in" call
9400 instead.
9401
9402 Deprecated functions will not be removed from the API, but the fact
9403 that they are deprecated indicates that there are problems with correct
9404 use of these functions.
9405
9406 This command depends on the feature "xz". See also "feature-
9407 available".
9408
9409 txz-out
9410 txz-out directory (tarball|-)
9411
9412 This command packs the contents of directory and downloads it to local
9413 file "tarball" (as an xz compressed tar archive).
9414
9415 Use "-" instead of a filename to read/write from stdin/stdout.
9416
9417 This function is deprecated. In new code, use the "tar-out" call
9418 instead.
9419
9420 Deprecated functions will not be removed from the API, but the fact
9421 that they are deprecated indicates that there are problems with correct
9422 use of these functions.
9423
9424 This command depends on the feature "xz". See also "feature-
9425 available".
9426
9427 umask
9428 umask mask
9429
9430 This function sets the mask used for creating new files and device
9431 nodes to "mask & 0777".
9432
9433 Typical umask values would be 022 which creates new files with
9434 permissions like "-rw-r--r--" or "-rwxr-xr-x", and 002 which creates
9435 new files with permissions like "-rw-rw-r--" or "-rwxrwxr-x".
9436
9437 The default umask is 022. This is important because it means that
9438 directories and device nodes will be created with 0644 or 0755 mode
9439 even if you specify 0777.
9440
9441 See also "get-umask", umask(2), "mknod", "mkdir".
9442
9443 This call returns the previous umask.
9444
9445 umount
9446 unmount
9447 umount-opts
9448 umount pathordevice [force:true|false] [lazyunmount:true|false]
9449
9450 This unmounts the given filesystem. The filesystem may be specified
9451 either by its mountpoint (path) or the device which contains the
9452 filesystem.
9453
9454 This command has one or more optional arguments. See "OPTIONAL
9455 ARGUMENTS".
9456
9457 umount-all
9458 unmount-all
9459 umount-all
9460
9461 This unmounts all mounted filesystems.
9462
9463 Some internal mounts are not unmounted by this call.
9464
9465 umount-local
9466 umount-local [retry:true|false]
9467
9468 If libguestfs is exporting the filesystem on a local mountpoint, then
9469 this unmounts it.
9470
9471 See "MOUNT LOCAL" in guestfs(3) for full documentation.
9472
9473 This command has one or more optional arguments. See "OPTIONAL
9474 ARGUMENTS".
9475
9476 upload
9477 upload (filename|-) remotefilename
9478
9479 Upload local file filename to remotefilename on the filesystem.
9480
9481 filename can also be a named pipe.
9482
9483 See also "download".
9484
9485 Use "-" instead of a filename to read/write from stdin/stdout.
9486
9487 upload-offset
9488 upload-offset (filename|-) remotefilename offset
9489
9490 Upload local file filename to remotefilename on the filesystem.
9491
9492 remotefilename is overwritten starting at the byte "offset" specified.
9493 The intention is to overwrite parts of existing files or devices,
9494 although if a non-existent file is specified then it is created with a
9495 "hole" before "offset". The size of the data written is implicit in
9496 the size of the source filename.
9497
9498 Note that there is no limit on the amount of data that can be uploaded
9499 with this call, unlike with "pwrite", and this call always writes the
9500 full amount unless an error occurs.
9501
9502 See also "upload", "pwrite".
9503
9504 Use "-" instead of a filename to read/write from stdin/stdout.
9505
9506 user-cancel
9507 user-cancel
9508
9509 This function cancels the current upload or download operation.
9510
9511 Unlike most other libguestfs calls, this function is signal safe and
9512 thread safe. You can call it from a signal handler or from another
9513 thread, without needing to do any locking.
9514
9515 The transfer that was in progress (if there is one) will stop shortly
9516 afterwards, and will return an error. The errno (see
9517 "guestfs_last_errno") is set to "EINTR", so you can test for this to
9518 find out if the operation was cancelled or failed because of another
9519 error.
9520
9521 No cleanup is performed: for example, if a file was being uploaded then
9522 after cancellation there may be a partially uploaded file. It is the
9523 caller’s responsibility to clean up if necessary.
9524
9525 There are two common places that you might call "user-cancel":
9526
9527 In an interactive text-based program, you might call it from a "SIGINT"
9528 signal handler so that pressing "^C" cancels the current operation.
9529 (You also need to call "guestfs_set_pgroup" so that child processes
9530 don't receive the "^C" signal).
9531
9532 In a graphical program, when the main thread is displaying a progress
9533 bar with a cancel button, wire up the cancel button to call this
9534 function.
9535
9536 utimens
9537 utimens path atsecs atnsecs mtsecs mtnsecs
9538
9539 This command sets the timestamps of a file with nanosecond precision.
9540
9541 "atsecs, atnsecs" are the last access time (atime) in secs and
9542 nanoseconds from the epoch.
9543
9544 "mtsecs, mtnsecs" are the last modification time (mtime) in secs and
9545 nanoseconds from the epoch.
9546
9547 If the *nsecs field contains the special value "-1" then the
9548 corresponding timestamp is set to the current time. (The *secs field
9549 is ignored in this case).
9550
9551 If the *nsecs field contains the special value "-2" then the
9552 corresponding timestamp is left unchanged. (The *secs field is ignored
9553 in this case).
9554
9555 utsname
9556 utsname
9557
9558 This returns the kernel version of the appliance, where this is
9559 available. This information is only useful for debugging. Nothing in
9560 the returned structure is defined by the API.
9561
9562 version
9563 version
9564
9565 Return the libguestfs version number that the program is linked
9566 against.
9567
9568 Note that because of dynamic linking this is not necessarily the
9569 version of libguestfs that you compiled against. You can compile the
9570 program, and then at runtime dynamically link against a completely
9571 different libguestfs.so library.
9572
9573 This call was added in version 1.0.58. In previous versions of
9574 libguestfs there was no way to get the version number. From C code you
9575 can use dynamic linker functions to find out if this symbol exists (if
9576 it doesn't, then it’s an earlier version).
9577
9578 The call returns a structure with four elements. The first three
9579 ("major", "minor" and "release") are numbers and correspond to the
9580 usual version triplet. The fourth element ("extra") is a string and is
9581 normally empty, but may be used for distro-specific information.
9582
9583 To construct the original version string:
9584 "$major.$minor.$release$extra"
9585
9586 See also: "LIBGUESTFS VERSION NUMBERS" in guestfs(3).
9587
9588 Note: Don't use this call to test for availability of features. In
9589 enterprise distributions we backport features from later versions into
9590 earlier versions, making this an unreliable way to test for features.
9591 Use "available" or "feature-available" instead.
9592
9593 vfs-label
9594 vfs-label mountable
9595
9596 This returns the label of the filesystem on "mountable".
9597
9598 If the filesystem is unlabeled, this returns the empty string.
9599
9600 To find a filesystem from the label, use "findfs-label".
9601
9602 vfs-minimum-size
9603 vfs-minimum-size mountable
9604
9605 Get the minimum size of filesystem in bytes. This is the minimum
9606 possible size for filesystem shrinking.
9607
9608 If getting minimum size of specified filesystem is not supported, this
9609 will fail and set errno as ENOTSUP.
9610
9611 See also ntfsresize(8), resize2fs(8), btrfs(8), xfs_info(8).
9612
9613 vfs-type
9614 vfs-type mountable
9615
9616 This command gets the filesystem type corresponding to the filesystem
9617 on "mountable".
9618
9619 For most filesystems, the result is the name of the Linux VFS module
9620 which would be used to mount this filesystem if you mounted it without
9621 specifying the filesystem type. For example a string such as "ext3" or
9622 "ntfs".
9623
9624 vfs-uuid
9625 get-uuid
9626 vfs-uuid mountable
9627
9628 This returns the filesystem UUID of the filesystem on "mountable".
9629
9630 If the filesystem does not have a UUID, this returns the empty string.
9631
9632 To find a filesystem from the UUID, use "findfs-uuid".
9633
9634 vg-activate
9635 vg-activate true|false 'volgroups ...'
9636
9637 This command activates or (if "activate" is false) deactivates all
9638 logical volumes in the listed volume groups "volgroups".
9639
9640 This command is the same as running "vgchange -a y|n volgroups..."
9641
9642 Note that if "volgroups" is an empty list then all volume groups are
9643 activated or deactivated.
9644
9645 This command depends on the feature "lvm2". See also "feature-
9646 available".
9647
9648 vg-activate-all
9649 vg-activate-all true|false
9650
9651 This command activates or (if "activate" is false) deactivates all
9652 logical volumes in all volume groups.
9653
9654 This command is the same as running "vgchange -a y|n"
9655
9656 This command depends on the feature "lvm2". See also "feature-
9657 available".
9658
9659 vgchange-uuid
9660 vgchange-uuid vg
9661
9662 Generate a new random UUID for the volume group "vg".
9663
9664 This command depends on the feature "lvm2". See also "feature-
9665 available".
9666
9667 vgchange-uuid-all
9668 vgchange-uuid-all
9669
9670 Generate new random UUIDs for all volume groups.
9671
9672 This command depends on the feature "lvm2". See also "feature-
9673 available".
9674
9675 vgcreate
9676 vgcreate volgroup 'physvols ...'
9677
9678 This creates an LVM volume group called "volgroup" from the non-empty
9679 list of physical volumes "physvols".
9680
9681 This command depends on the feature "lvm2". See also "feature-
9682 available".
9683
9684 vglvuuids
9685 vglvuuids vgname
9686
9687 Given a VG called "vgname", this returns the UUIDs of all the logical
9688 volumes created in this volume group.
9689
9690 You can use this along with "lvs" and "lvuuid" calls to associate
9691 logical volumes and volume groups.
9692
9693 See also "vgpvuuids".
9694
9695 vgmeta
9696 vgmeta vgname
9697
9698 "vgname" is an LVM volume group. This command examines the volume
9699 group and returns its metadata.
9700
9701 Note that the metadata is an internal structure used by LVM, subject to
9702 change at any time, and is provided for information only.
9703
9704 This command depends on the feature "lvm2". See also "feature-
9705 available".
9706
9707 vgpvuuids
9708 vgpvuuids vgname
9709
9710 Given a VG called "vgname", this returns the UUIDs of all the physical
9711 volumes that this volume group resides on.
9712
9713 You can use this along with "pvs" and "pvuuid" calls to associate
9714 physical volumes and volume groups.
9715
9716 See also "vglvuuids".
9717
9718 vgremove
9719 vgremove vgname
9720
9721 Remove an LVM volume group "vgname", (for example "VG").
9722
9723 This also forcibly removes all logical volumes in the volume group (if
9724 any).
9725
9726 This command depends on the feature "lvm2". See also "feature-
9727 available".
9728
9729 vgrename
9730 vgrename volgroup newvolgroup
9731
9732 Rename a volume group "volgroup" with the new name "newvolgroup".
9733
9734 vgs
9735 vgs
9736
9737 List all the volumes groups detected. This is the equivalent of the
9738 vgs(8) command.
9739
9740 This returns a list of just the volume group names that were detected
9741 (eg. "VolGroup00").
9742
9743 See also "vgs-full".
9744
9745 This command depends on the feature "lvm2". See also "feature-
9746 available".
9747
9748 vgs-full
9749 vgs-full
9750
9751 List all the volumes groups detected. This is the equivalent of the
9752 vgs(8) command. The "full" version includes all fields.
9753
9754 This command depends on the feature "lvm2". See also "feature-
9755 available".
9756
9757 vgscan
9758 vgscan
9759
9760 This rescans all block devices and rebuilds the list of LVM physical
9761 volumes, volume groups and logical volumes.
9762
9763 This function is deprecated. In new code, use the "lvm-scan" call
9764 instead.
9765
9766 Deprecated functions will not be removed from the API, but the fact
9767 that they are deprecated indicates that there are problems with correct
9768 use of these functions.
9769
9770 vguuid
9771 vguuid vgname
9772
9773 This command returns the UUID of the LVM VG named "vgname".
9774
9775 wc-c
9776 wc-c path
9777
9778 This command counts the characters in a file, using the "wc -c"
9779 external command.
9780
9781 wc-l
9782 wc-l path
9783
9784 This command counts the lines in a file, using the "wc -l" external
9785 command.
9786
9787 wc-w
9788 wc-w path
9789
9790 This command counts the words in a file, using the "wc -w" external
9791 command.
9792
9793 wipefs
9794 wipefs device
9795
9796 This command erases filesystem or RAID signatures from the specified
9797 "device" to make the filesystem invisible to libblkid.
9798
9799 This does not erase the filesystem itself nor any other data from the
9800 "device".
9801
9802 Compare with "zero" which zeroes the first few blocks of a device.
9803
9804 This command depends on the feature "wipefs". See also "feature-
9805 available".
9806
9807 write
9808 write path content
9809
9810 This call creates a file called "path". The content of the file is the
9811 string "content" (which can contain any 8 bit data).
9812
9813 See also "write-append".
9814
9815 write-append
9816 write-append path content
9817
9818 This call appends "content" to the end of file "path". If "path" does
9819 not exist, then a new file is created.
9820
9821 See also "write".
9822
9823 write-file
9824 write-file path content size
9825
9826 This call creates a file called "path". The contents of the file is
9827 the string "content" (which can contain any 8 bit data), with length
9828 "size".
9829
9830 As a special case, if "size" is 0 then the length is calculated using
9831 "strlen" (so in this case the content cannot contain embedded ASCII
9832 NULs).
9833
9834 NB. Owing to a bug, writing content containing ASCII NUL characters
9835 does not work, even if the length is specified.
9836
9837 Because of the message protocol, there is a transfer limit of somewhere
9838 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
9839
9840 This function is deprecated. In new code, use the "write" call
9841 instead.
9842
9843 Deprecated functions will not be removed from the API, but the fact
9844 that they are deprecated indicates that there are problems with correct
9845 use of these functions.
9846
9847 xfs-admin
9848 xfs-admin device [extunwritten:true|false] [imgfile:true|false] [v2log:true|false] [projid32bit:true|false] [lazycounter:true|false] [label:..] [uuid:..]
9849
9850 Change the parameters of the XFS filesystem on "device".
9851
9852 Devices that are mounted cannot be modified. Administrators must
9853 unmount filesystems before this call can modify parameters.
9854
9855 Some of the parameters of a mounted filesystem can be examined and
9856 modified using the "xfs-info" and "xfs-growfs" calls.
9857
9858 This command has one or more optional arguments. See "OPTIONAL
9859 ARGUMENTS".
9860
9861 This command depends on the feature "xfs". See also "feature-
9862 available".
9863
9864 xfs-growfs
9865 xfs-growfs path [datasec:true|false] [logsec:true|false] [rtsec:true|false] [datasize:N] [logsize:N] [rtsize:N] [rtextsize:N] [maxpct:N]
9866
9867 Grow the XFS filesystem mounted at "path".
9868
9869 The returned struct contains geometry information. Missing fields are
9870 returned as "-1" (for numeric fields) or empty string.
9871
9872 This command has one or more optional arguments. See "OPTIONAL
9873 ARGUMENTS".
9874
9875 This command depends on the feature "xfs". See also "feature-
9876 available".
9877
9878 xfs-info
9879 xfs-info pathordevice
9880
9881 "pathordevice" is a mounted XFS filesystem or a device containing an
9882 XFS filesystem. This command returns the geometry of the filesystem.
9883
9884 The returned struct contains geometry information. Missing fields are
9885 returned as "-1" (for numeric fields) or empty string.
9886
9887 This command depends on the feature "xfs". See also "feature-
9888 available".
9889
9890 xfs-repair
9891 xfs-repair device [forcelogzero:true|false] [nomodify:true|false] [noprefetch:true|false] [forcegeometry:true|false] [maxmem:N] [ihashsize:N] [bhashsize:N] [agstride:N] [logdev:..] [rtdev:..]
9892
9893 Repair corrupt or damaged XFS filesystem on "device".
9894
9895 The filesystem is specified using the "device" argument which should be
9896 the device name of the disk partition or volume containing the
9897 filesystem. If given the name of a block device, "xfs_repair" will
9898 attempt to find the raw device associated with the specified block
9899 device and will use the raw device instead.
9900
9901 Regardless, the filesystem to be repaired must be unmounted, otherwise,
9902 the resulting filesystem may be inconsistent or corrupt.
9903
9904 The returned status indicates whether filesystem corruption was
9905 detected (returns 1) or was not detected (returns 0).
9906
9907 This command has one or more optional arguments. See "OPTIONAL
9908 ARGUMENTS".
9909
9910 This command depends on the feature "xfs". See also "feature-
9911 available".
9912
9913 yara-destroy
9914 yara-destroy
9915
9916 Destroy previously loaded Yara rules in order to free libguestfs
9917 resources.
9918
9919 This command depends on the feature "libyara". See also "feature-
9920 available".
9921
9922 yara-load
9923 yara-load (filename|-)
9924
9925 Upload a set of Yara rules from local file filename.
9926
9927 Yara rules allow to categorize files based on textual or binary
9928 patterns within their content. See "yara-scan" to see how to scan
9929 files with the loaded rules.
9930
9931 Rules can be in binary format, as when compiled with yarac command, or
9932 in source code format. In the latter case, the rules will be first
9933 compiled and then loaded.
9934
9935 Rules in source code format cannot include external files. In such
9936 cases, it is recommended to compile them first.
9937
9938 Previously loaded rules will be destroyed.
9939
9940 Use "-" instead of a filename to read/write from stdin/stdout.
9941
9942 This command depends on the feature "libyara". See also "feature-
9943 available".
9944
9945 yara-scan
9946 yara-scan path
9947
9948 Scan a file with the previously loaded Yara rules.
9949
9950 For each matching rule, a "yara_detection" structure is returned.
9951
9952 The "yara_detection" structure contains the following fields.
9953
9954 "yara_name"
9955 Path of the file matching a Yara rule.
9956
9957 "yara_rule"
9958 Identifier of the Yara rule which matched against the given file.
9959
9960 This command depends on the feature "libyara". See also "feature-
9961 available".
9962
9963 zegrep
9964 zegrep regex path
9965
9966 This calls the external "zegrep" program and returns the matching
9967 lines.
9968
9969 Because of the message protocol, there is a transfer limit of somewhere
9970 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
9971
9972 This function is deprecated. In new code, use the "grep" call instead.
9973
9974 Deprecated functions will not be removed from the API, but the fact
9975 that they are deprecated indicates that there are problems with correct
9976 use of these functions.
9977
9978 zegrepi
9979 zegrepi regex path
9980
9981 This calls the external "zegrep -i" program and returns the matching
9982 lines.
9983
9984 Because of the message protocol, there is a transfer limit of somewhere
9985 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
9986
9987 This function is deprecated. In new code, use the "grep" call instead.
9988
9989 Deprecated functions will not be removed from the API, but the fact
9990 that they are deprecated indicates that there are problems with correct
9991 use of these functions.
9992
9993 zero
9994 zero device
9995
9996 This command writes zeroes over the first few blocks of "device".
9997
9998 How many blocks are zeroed isn't specified (but it’s not enough to
9999 securely wipe the device). It should be sufficient to remove any
10000 partition tables, filesystem superblocks and so on.
10001
10002 If blocks are already zero, then this command avoids writing zeroes.
10003 This prevents the underlying device from becoming non-sparse or growing
10004 unnecessarily.
10005
10006 See also: "zero-device", "scrub-device", "is-zero-device"
10007
10008 zero-device
10009 zero-device device
10010
10011 This command writes zeroes over the entire "device". Compare with
10012 "zero" which just zeroes the first few blocks of a device.
10013
10014 If blocks are already zero, then this command avoids writing zeroes.
10015 This prevents the underlying device from becoming non-sparse or growing
10016 unnecessarily.
10017
10018 zero-free-space
10019 zero-free-space directory
10020
10021 Zero the free space in the filesystem mounted on directory. The
10022 filesystem must be mounted read-write.
10023
10024 The filesystem contents are not affected, but any free space in the
10025 filesystem is freed.
10026
10027 Free space is not "trimmed". You may want to call "fstrim" either as
10028 an alternative to this, or after calling this, depending on your
10029 requirements.
10030
10031 zerofree
10032 zerofree device
10033
10034 This runs the zerofree program on "device". This program claims to
10035 zero unused inodes and disk blocks on an ext2/3 filesystem, thus making
10036 it possible to compress the filesystem more effectively.
10037
10038 You should not run this program if the filesystem is mounted.
10039
10040 It is possible that using this program can damage the filesystem or
10041 data on the filesystem.
10042
10043 This command depends on the feature "zerofree". See also "feature-
10044 available".
10045
10046 zfgrep
10047 zfgrep pattern path
10048
10049 This calls the external "zfgrep" program and returns the matching
10050 lines.
10051
10052 Because of the message protocol, there is a transfer limit of somewhere
10053 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
10054
10055 This function is deprecated. In new code, use the "grep" call instead.
10056
10057 Deprecated functions will not be removed from the API, but the fact
10058 that they are deprecated indicates that there are problems with correct
10059 use of these functions.
10060
10061 zfgrepi
10062 zfgrepi pattern path
10063
10064 This calls the external "zfgrep -i" program and returns the matching
10065 lines.
10066
10067 Because of the message protocol, there is a transfer limit of somewhere
10068 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
10069
10070 This function is deprecated. In new code, use the "grep" call instead.
10071
10072 Deprecated functions will not be removed from the API, but the fact
10073 that they are deprecated indicates that there are problems with correct
10074 use of these functions.
10075
10076 zfile
10077 zfile meth path
10078
10079 This command runs file after first decompressing "path" using "method".
10080
10081 "method" must be one of "gzip", "compress" or "bzip2".
10082
10083 Since 1.0.63, use "file" instead which can now process compressed
10084 files.
10085
10086 This function is deprecated. In new code, use the "file" call instead.
10087
10088 Deprecated functions will not be removed from the API, but the fact
10089 that they are deprecated indicates that there are problems with correct
10090 use of these functions.
10091
10092 zgrep
10093 zgrep regex path
10094
10095 This calls the external "zgrep" program and returns the matching lines.
10096
10097 Because of the message protocol, there is a transfer limit of somewhere
10098 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
10099
10100 This function is deprecated. In new code, use the "grep" call instead.
10101
10102 Deprecated functions will not be removed from the API, but the fact
10103 that they are deprecated indicates that there are problems with correct
10104 use of these functions.
10105
10106 zgrepi
10107 zgrepi regex path
10108
10109 This calls the external "zgrep -i" program and returns the matching
10110 lines.
10111
10112 Because of the message protocol, there is a transfer limit of somewhere
10113 between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).
10114
10115 This function is deprecated. In new code, use the "grep" call instead.
10116
10117 Deprecated functions will not be removed from the API, but the fact
10118 that they are deprecated indicates that there are problems with correct
10119 use of these functions.
10120
10122 guestfish returns 0 if the commands completed without error, or 1 if
10123 there was an error.
10124
10126 EDITOR
10127 The "edit" command uses $EDITOR as the editor. If not set, it uses
10128 "vi".
10129
10130 GUESTFISH_DISPLAY_IMAGE
10131 The "display" command uses $GUESTFISH_DISPLAY_IMAGE to display
10132 images. If not set, it uses display(1).
10133
10134 GUESTFISH_INIT
10135 Printed when guestfish starts. See "PROMPT".
10136
10137 GUESTFISH_OUTPUT
10138 Printed before guestfish output. See "PROMPT".
10139
10140 GUESTFISH_PID
10141 Used with the --remote option to specify the remote guestfish
10142 process to control. See section "REMOTE CONTROL GUESTFISH OVER A
10143 SOCKET".
10144
10145 GUESTFISH_PS1
10146 Set the command prompt. See "PROMPT".
10147
10148 GUESTFISH_RESTORE
10149 Printed before guestfish exits. See "PROMPT".
10150
10151 HEXEDITOR
10152 The "hexedit" command uses $HEXEDITOR as the external hex editor.
10153 If not specified, the external hexedit(1) program is used.
10154
10155 HOME
10156 If compiled with GNU readline support, various files in the home
10157 directory can be used. See "FILES".
10158
10159 LIBGUESTFS_APPEND
10160 Pass additional options to the guest kernel.
10161
10162 LIBGUESTFS_ATTACH_METHOD
10163 This is the old way to set "LIBGUESTFS_BACKEND".
10164
10165 LIBGUESTFS_BACKEND
10166 Choose the default way to create the appliance. See
10167 "guestfs_set_backend" in guestfs(3).
10168
10169 LIBGUESTFS_BACKEND_SETTINGS
10170 A colon-separated list of backend-specific settings. See "BACKEND"
10171 in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
10172
10173 LIBGUESTFS_CACHEDIR
10174 The location where libguestfs will cache its appliance, when using
10175 a supermin appliance. The appliance is cached and shared between
10176 all handles which have the same effective user ID.
10177
10178 If "LIBGUESTFS_CACHEDIR" is not set, then "TMPDIR" is used. If
10179 "TMPDIR" is not set, then /var/tmp is used.
10180
10181 See also "LIBGUESTFS_TMPDIR", "set-cachedir".
10182
10183 LIBGUESTFS_DEBUG
10184 Set "LIBGUESTFS_DEBUG=1" to enable verbose messages. This has the
10185 same effect as using the -v option.
10186
10187 LIBGUESTFS_HV
10188 Set the default hypervisor (usually qemu) binary that libguestfs
10189 uses. If not set, then the qemu which was found at compile time by
10190 the configure script is used.
10191
10192 LIBGUESTFS_MEMSIZE
10193 Set the memory allocated to the qemu process, in megabytes. For
10194 example:
10195
10196 LIBGUESTFS_MEMSIZE=700
10197
10198 LIBGUESTFS_PATH
10199 Set the path that guestfish uses to search for kernel and
10200 initrd.img. See the discussion of paths in guestfs(3).
10201
10202 LIBGUESTFS_QEMU
10203 This is the old way to set "LIBGUESTFS_HV".
10204
10205 LIBGUESTFS_TMPDIR
10206 The location where libguestfs will store temporary files used by
10207 each handle.
10208
10209 If "LIBGUESTFS_TMPDIR" is not set, then "TMPDIR" is used. If
10210 "TMPDIR" is not set, then /tmp is used.
10211
10212 See also "LIBGUESTFS_CACHEDIR", "set-tmpdir".
10213
10214 LIBGUESTFS_TRACE
10215 Set "LIBGUESTFS_TRACE=1" to enable command traces.
10216
10217 PAGER
10218 The "more" command uses $PAGER as the pager. If not set, it uses
10219 "more".
10220
10221 PATH
10222 Libguestfs and guestfish may run some external programs, and rely
10223 on $PATH being set to a reasonable value. If using the libvirt
10224 backend, libvirt will not work at all unless $PATH contains the
10225 path of qemu/KVM.
10226
10227 SUPERMIN_KERNEL
10228 SUPERMIN_KERNEL_VERSION
10229 SUPERMIN_MODULES
10230 These three environment variables allow the kernel that libguestfs
10231 uses in the appliance to be selected. If $SUPERMIN_KERNEL is not
10232 set, then the most recent host kernel is chosen. For more
10233 information about kernel selection, see supermin(1).
10234
10235 TMPDIR
10236 See "LIBGUESTFS_CACHEDIR", "LIBGUESTFS_TMPDIR".
10237
10238 XDG_RUNTIME_DIR
10239 This directory represents a user-specific directory for storing
10240 non-essential runtime files.
10241
10242 If it is set, then is used to store temporary sockets. Otherwise,
10243 /tmp is used.
10244
10245 See also "get-sockdir",
10246 http://www.freedesktop.org/wiki/Specifications/basedir-spec/.
10247
10249 $XDG_CONFIG_HOME/libguestfs/libguestfs-tools.conf
10250 $HOME/.libguestfs-tools.rc
10251 $XDG_CONFIG_DIRS/libguestfs/libguestfs-tools.conf
10252 /etc/libguestfs-tools.conf
10253 This configuration file controls the default read-only or read-
10254 write mode (--ro or --rw).
10255
10256 See libguestfs-tools.conf(5).
10257
10258 $HOME/.guestfish
10259 If compiled with GNU readline support, then the command history is
10260 saved in this file.
10261
10262 $HOME/.inputrc
10263 /etc/inputrc
10264 If compiled with GNU readline support, then these files can be used
10265 to configure readline. For further information, please see
10266 "INITIALIZATION FILE" in readline(3).
10267
10268 To write rules which only apply to guestfish, use:
10269
10270 $if guestfish
10271 ...
10272 $endif
10273
10274 Variables that you can set in inputrc that change the behaviour of
10275 guestfish in useful ways include:
10276
10277 completion-ignore-case (default: on)
10278 By default, guestfish will ignore case when tab-completing
10279 paths on the disk. Use:
10280
10281 set completion-ignore-case off
10282
10283 to make guestfish case sensitive.
10284
10285 test1.img
10286 test2.img (etc)
10287 When using the -N or --new option, the prepared disk or filesystem
10288 will be created in the file test1.img in the current directory.
10289 The second use of -N will use test2.img and so on. Any existing
10290 file with the same name will be overwritten. You can use a
10291 different filename by using the "filename=" prefix.
10292
10294 guestfs(3), http://libguestfs.org/, virt-alignment-scan(1),
10295 virt-builder(1), virt-builder-repository(1), virt-cat(1),
10296 virt-copy-in(1), virt-copy-out(1), virt-customize(1), virt-df(1),
10297 virt-diff(1), virt-edit(1), virt-filesystems(1), virt-inspector(1),
10298 virt-list-filesystems(1), virt-list-partitions(1), virt-log(1),
10299 virt-ls(1), virt-make-fs(1), virt-p2v(1), virt-rescue(1),
10300 virt-resize(1), virt-sparsify(1), virt-sysprep(1), virt-tail(1),
10301 virt-tar(1), virt-tar-in(1), virt-tar-out(1), virt-v2v(1),
10302 virt-win-reg(1), libguestfs-tools.conf(5), display(1), hexedit(1),
10303 supermin(1).
10304
10306 Richard W.M. Jones ("rjones at redhat dot com")
10307
10309 Copyright (C) 2009-2019 Red Hat Inc.
10310
10312 This program is free software; you can redistribute it and/or modify it
10313 under the terms of the GNU General Public License as published by the
10314 Free Software Foundation; either version 2 of the License, or (at your
10315 option) any later version.
10316
10317 This program is distributed in the hope that it will be useful, but
10318 WITHOUT ANY WARRANTY; without even the implied warranty of
10319 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10320 General Public License for more details.
10321
10322 You should have received a copy of the GNU General Public License along
10323 with this program; if not, write to the Free Software Foundation, Inc.,
10324 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
10325
10327 To get a list of bugs against libguestfs, use this link:
10328 https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
10329
10330 To report a new bug against libguestfs, use this link:
10331 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
10332
10333 When reporting a bug, please supply:
10334
10335 · The version of libguestfs.
10336
10337 · Where you got libguestfs (eg. which Linux distro, compiled from
10338 source, etc)
10339
10340 · Describe the bug accurately and give a way to reproduce it.
10341
10342 · Run libguestfs-test-tool(1) and paste the complete, unedited output
10343 into the bug report.
10344
10345
10346
10347libguestfs-1.40.1 2019-01-17 guestfish(1)