jas43
May 21st, 2012, 09:23 PM
We have a large number of workstations so we use install media with custom preseed files to install and upgrade them. When upgrading/reinstalling we only want to format the boot, root and swap partitions and leave all other partitions untouched.
Under 10.04 I could do this by deleting the relevant partitions (which are identical size and /dev/sda1, /dev/sda2 and /dev/sda3 on all machines) and the using a recipe to create, format and mount them them:
d-i partman/early_command string for i in 1 2 3; do if [ "`fdisk -l /dev/sda | grep /dev/sda$i`" ]; then echo -e "d\n$i\nw\n" | fdisk /dev/sda ; fi ; done; exit 0;
d-i partman-auto/init_automatically_partition select biggest_free
d-i partman-auto/expert_recipe string \
reinstall :: \
100 100 100 ext3 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext3 } \
mountpoint{ /boot } \
. \
29000 29000 29000 ext3 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext3 } \
mountpoint{ / } \
. \
6000 6000 6000 linux-swap \
$primary{ } \
method{ swap } format{ } \
.
d-i partman-auto/choose_recipe select reinstall
This doesn't work under 12.04 because fdisk (and also sfdisk) are no longer available from inside the installer.
Does anyone have any suggestions as to how I could do this (either using fdisk or a different strategy) in a preseed file for 12.04?
Thanks!
Under 10.04 I could do this by deleting the relevant partitions (which are identical size and /dev/sda1, /dev/sda2 and /dev/sda3 on all machines) and the using a recipe to create, format and mount them them:
d-i partman/early_command string for i in 1 2 3; do if [ "`fdisk -l /dev/sda | grep /dev/sda$i`" ]; then echo -e "d\n$i\nw\n" | fdisk /dev/sda ; fi ; done; exit 0;
d-i partman-auto/init_automatically_partition select biggest_free
d-i partman-auto/expert_recipe string \
reinstall :: \
100 100 100 ext3 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext3 } \
mountpoint{ /boot } \
. \
29000 29000 29000 ext3 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext3 } \
mountpoint{ / } \
. \
6000 6000 6000 linux-swap \
$primary{ } \
method{ swap } format{ } \
.
d-i partman-auto/choose_recipe select reinstall
This doesn't work under 12.04 because fdisk (and also sfdisk) are no longer available from inside the installer.
Does anyone have any suggestions as to how I could do this (either using fdisk or a different strategy) in a preseed file for 12.04?
Thanks!