Categories

ID #1397

How can an existing COD image be modified for Bright 7.3 and Bright 8.0?

 

How can an existing COD (Cluster On Demand) image be modified for Bright 7.3 and Bright 8.0?

 

 

Basically by resizing the image and adding what is needed.

 

Required elements:

  1. Bright COD image

  2. Image manifest

  3. XFS tools package (xfsprogs) must be installed

  4. loopback device support (is usually enabled by default)


Step one:


gunzip the image


Example:

gunzip bcmh-centos7u2-8.0-5.gzip

You should end up with a file :
bcmh-centos7u2-8.0-5.img

Step two:


Resize the image to the size desired. By default the COD image has very little free space left. So, if you plan to add files of a significant size, then the size of the image needs to be increased.


Example:

qemu-img resize bcmh-centos7u2-8.0-5.img +10G # that would add 10 gigs to your image

Step three:


Connect the image to a loopback device:


offset=$(fdisk -l bcmh-centos7u2-8.0-5.img | grep Start -A1 | tail -n+2 | awk '{print $2*512}')

losetup --offset $offset -f bcmh-centos7u2-8.0-5.img


Step four:
Confirm the new size and the that the image is connected to a loopback device:


lsblk

You should see a /dev/loopN in your device list.

 

Run kpartx on that loop device. You should end up with a partition when you run lsblk again, example :

 

kpartx -av /dev/loopN

lsblk

 

loop1       7:1    0    25G  0 loop
└─loop1p1 253:0 0 25G 0 part



Step five:
Mount and resize the filesystem of the image :


mkdir /mnt/image

 

 

Please note that loopNpN is supposed to be the partition that you got from lsblk after you ran kpartx.

mount /dev/loopNpN /mnt

xfs_growfs /dev/loopNpN


Step six:
Chroot and execute your changes


Example:

chroot /mnt/image
yum update -y

exit

sync

Step seven:


Umount and disconnect the loopback device

 

sync

umount /mnt/image

losetup -d /dev/loopN

Step eight:

Gzip the image and upload it using the instructions at /faq/index.php?action=artikel&id=386

Example:

gzip bcmh-centos7u2-8.0-5.img


export OS_PROJECT_NAME="bright"

cm-cluster-on-demand-openstack image install --is-public yes --image-file bcmh-centos7u2-8.0-3.img.gz

Tags: -

Related entries:

You cannot comment on this entry