diff options
author | Richard Jones <rjones@redhat.com> | 2009-05-18 17:16:24 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-05-18 17:16:24 +0100 |
commit | 85ed8cef99c19b4143844991d14e0b848fecc5da (patch) | |
tree | 61e34886d4ec4b59a37c8e4ab6779e7ef7834f34 /recipes | |
parent | adf0974245af914c46b48766d0efdd5ee8608dda (diff) | |
download | libguestfs-85ed8cef99c19b4143844991d14e0b848fecc5da.tar.gz libguestfs-85ed8cef99c19b4143844991d14e0b848fecc5da.tar.xz libguestfs-85ed8cef99c19b4143844991d14e0b848fecc5da.zip |
Add vg-activate{,-all} commands, and resize recipe.
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/resize.html | 19 | ||||
-rwxr-xr-x | recipes/resize.sh | 35 | ||||
-rw-r--r-- | recipes/resize.title | 1 |
3 files changed, 55 insertions, 0 deletions
diff --git a/recipes/resize.html b/recipes/resize.html new file mode 100644 index 00000000..1a0ca3bb --- /dev/null +++ b/recipes/resize.html @@ -0,0 +1,19 @@ +<p> +This example shows how a block device containing a partition +and a physical volume can be resized. +</p> + +<p> +If you try this out, you +may find that attempts to repartition the disk fail because the +disk is locked by the LVM devices which exist on it. You have +to deactivate (temporarily) the volume groups, perform the +fdisk, and then activate them again. +</p> + +<p> +This example script is self-contained. It first creates a +block device (a temporary file) containing some LVs, then it extends +the temporary file, and shows how to deactivate volgroups, repartition, +and activate them again. +</p> diff --git a/recipes/resize.sh b/recipes/resize.sh new file mode 100755 index 00000000..17a7e770 --- /dev/null +++ b/recipes/resize.sh @@ -0,0 +1,35 @@ +#!/bin/sh - + +guestfish <<EOF +alloc test.img 130M +run +# You can uncomment the following to see the +# geometry (CHS), which is needed to repartition. +#sfdisk-disk-geometry /dev/sda +sfdisk /dev/sda 0 0 0 , +pvcreate /dev/sda1 +vgcreate VG /dev/sda1 +lvcreate LV1 VG 32M +lvcreate LV2 VG 32M +lvcreate LV3 VG 32M +sync +EOF + +truncate --size=260M test.img + +guestfish -a test.img <<EOF +run +# Turn off the VGs before we can repartition. +vg-activate-all false +sfdisk-N /dev/sda 1 32 255 63 0,31 +vg-activate-all true + +pvresize /dev/sda1 + +# The following command would fail if the +# partition or PV hadn't been resized: +lvcreate LV4 VG 64M + +echo New LV list: +lvs +EOF
\ No newline at end of file diff --git a/recipes/resize.title b/recipes/resize.title new file mode 100644 index 00000000..cc2f3a23 --- /dev/null +++ b/recipes/resize.title @@ -0,0 +1 @@ +Repartition and resize a block device
\ No newline at end of file |