summaryrefslogtreecommitdiffstats
path: root/guestfs.pod
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-11-04 23:15:26 +0000
committerRichard Jones <rjones@redhat.com>2009-11-10 16:32:20 +0000
commitb1e1ca2f74a921b3f784537d59c617df29ea1d60 (patch)
tree2aff7ca53f4314e5dcb12236a86583a9c00777f2 /guestfs.pod
parentb03995b67f9bc23d066b282bb7dad9b7c71c90da (diff)
downloadlibguestfs-b1e1ca2f74a921b3f784537d59c617df29ea1d60.tar.gz
libguestfs-b1e1ca2f74a921b3f784537d59c617df29ea1d60.tar.xz
libguestfs-b1e1ca2f74a921b3f784537d59c617df29ea1d60.zip
Generic partition creation interface.
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
Diffstat (limited to 'guestfs.pod')
-rw-r--r--guestfs.pod28
1 files changed, 13 insertions, 15 deletions
diff --git a/guestfs.pod b/guestfs.pod
index 33b84d73..fdac80a6 100644
--- a/guestfs.pod
+++ b/guestfs.pod
@@ -217,29 +217,27 @@ L<http://tldp.org/HOWTO/LVM-HOWTO/>.
=head2 PARTITIONING
-To create MBR-style (ie. normal PC) partitions use one of the
-C<guestfs_sfdisk*> variants. These calls use the external
-L<sfdisk(8)> command.
+In the common case where you want to create a single partition
+covering the whole disk, you should use the C<guestfs_part_disk>
+call:
-The simplest call is:
-
- char *lines[] = { ",", NULL };
- guestfs_sfdiskM (g, "/dev/sda", lines);
-
-This will create a single partition on C</dev/sda> called
-C</dev/sda1> covering the whole disk.
+ const char *parttype = "mbr";
+ if (disk_is_larger_than_2TB)
+ parttype = "gpt";
+ guestfs_part_disk (g, "/dev/sda", parttype);
In general MBR partitions are both unnecessarily complicated and
depend on archaic details, namely the Cylinder-Head-Sector (CHS)
-geometry of the disk. C<guestfs_sfdiskM> allows you to specify sizes
-in megabytes instead of cylinders, which is a small win.
+geometry of the disk. C<guestfs_sfdiskM> can be used to
+create more complex arrangements where the relative sizes are
+expressed in megabytes instead of cylinders, which is a small win.
C<guestfs_sfdiskM> will choose the nearest cylinder to approximate the
requested size. There's a lot of crazy stuff to do with IDE and
virtio disks having different, incompatible CHS geometries, that you
-probably don't want to know about. My advice: make a single partition
-to cover the whole disk, then use LVM on top.
+probably don't want to know about.
-In future we aim to provide access to libparted.
+My advice: make a single partition to cover the whole disk, then use
+LVM on top.
=head2 UPLOADING