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