HP Insight Control server provisioning Capturing and Installing Linux System Images
7
3. Click OK to save the script.
Create New Filesystem Script
Create a new script that repartitions the disk, creates logical volumes/groups and creates the filesystem to receive the
new image. While the sample script partitions the disk so it replicates the old partition table, it is possible to alter the
new partition if required. Any new changes will have to be reflected in the target server image’s /etc/fstab once the
image has been deployed.
To create a new script to create the filesystem:
1. On the IC server provisioning appliance, create a new script of Unix type and name it for the appropriate
function.
2. Create the script content or copy and paste the script content from an external application. For example, the
script would contain:
#!/bin/bash
# Partition disk
echo "Partitioning disk..."
sfdisk /dev/sda -uM << EOF
0,500,L,*
,,L
EOF
while [ ! -e /dev/sda2 ]; do sleep 1; done
# Mark partition as Linux LVM
sfdisk --change-id /dev/sda 2 0x8e
# Create filesystems and logical volumes
echo "Create filesyste on boot partition..."
mkfs.ext4 -j -L boot /dev/sda1
echo "Create logical group and volumes..."
pvcreate /dev/sda2
vgcreate VolGroup /dev/sda2
lvcreate --size 10G VolGroup --name lv_root
while [ ! -e /dev/VolGroup/lv_root ]; do sleep 1; done
lvcreate --size 10G VolGroup --name lv_home
while [ ! -e /dev/VolGroup/lv_home ]; do sleep 1; done
lvcreate --size 4G VolGroup --name lv_swap
while [ ! -e /dev/VolGroup/lv_swap ]; do sleep 1; done
mkfs.ext4 -j -L root /dev/VolGroup/lv_root
mkfs.ext4 -j -L home /dev/VolGroup/lv_home
mkswap -L swap0 /dev/VolGroup/lv_swap
3. Click OK to save the script.
Mount the Filesystem Script
Create a new script that mounts the filesystem so the image can be written to it. If the image’s partition structure hasn’t
changed from the capture, the capture OS Build Plan’s Mount Server Image script can be used.
To create a new script to mount the filesystem:
1. On the IC server provisioning appliance, create a new script of Unix type and name it for the appropriate
function.