summaryrefslogtreecommitdiffstats
path: root/recipes/resize.sh
blob: 17a7e770f55106fd3de842ad5839e30c812a231a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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