mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
This commit introduces a generic partition creation interface
which should be future-proof and extensible, and partially
replaces the old sfdisk-based interface.
The implementation is based on parted but is hopefully not too
dependent on the particulars of parted.
The following new calls are introduced:
guestfs_part_init:
Initialize a disk with a partition table. Unlike the sfdisk-
based interface, we also support GPT and other partition
types, which is essential to scale to devices larger than 2TB.
guestfs_part_add: Add a partition to an existing disk.
guestfs_part_disk:
Convenience function which combines part_init & part_add,
creating a single partition that covers the whole disk.
guestfs_part_set_bootable:
guestfs_part_set_name:
Set various aspects of existing partitions.
guestfs_part_list:
List partitions on a device. This returns a programming-friendly
list of partition structs (in contrast to sfdisk-l which cannot
be parsed).
guestfs_part_get_parttype:
Return the partition table type, eg. "msdos" or "gpt".
The following calls are planned, but not added currently:
guestfs_part_get_bootable
guestfs_part_get_name
guestfs_part_set_type
guestfs_part_get_type
This directory contains guestfish-based shell which give some useful recipes to follow. These also get copied to the website here: http://libguestfs.org/recipes.html The format for each recipe is: foo.sh Shell script, using guestfish. foo.title The title of the recipe. foo.html HTML snippet describing the recipe. foo.example Plain text snippet showing example output. Everything in the recipes/ directory may be used and distributed without restrictions. To run a script before libguestfs has been installed, you can do something like this: LIBGUESTFS_PATH=../appliance PATH=../fish:$PATH ./show-devices.sh disk.img You can apply these recipes in your own programs by translating the guestfish commands into API calls in the language of your choice. The translation is a simple 1-1 mapping. Got a useful tip or recipe? Please contribute ...