I got stuck when trying to extend the root partition. The partition table ended up broken and I cannot boot into the system.
- download Hiren Boot CD, it will come in .iso format
- install syslinux in the system (
sudo yum install -y syslinux
)
Because, Openstack will only boot on an image (which is VM image), and the image must contain partition table. In this case, we will use tool "isohybrid" for doing that.
But, first, Hiren has strange kind of file structure for a bootable cdrom. We need to modify the original iso image. According to this page, I wrote a script for doing that
sudo -s # be root
mkdir -p /tmp/hiren-orig
mount -t iso9660 -o loop,ro,uid=0 hiren.iso /tmp/hiren-orig
mkdir -p /tmp/hiren-new
cd /tmp/hiren-new
rsync -avh /tmp/hiren-orig/* .
cd /tmp/hiren-new/HBCD
mv isolinux.cfg syslinux.cfg
cd ..
mkisofs -o /tmp/hiren-bootcd.iso -b HBCD/isolinux.bin -c HBCD/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "Hirens Boot CD" .
# clean up
cd /tmp
umount /tmp/hiren-orig
rm -rf /tmp/hiren-orig
rm -rf /tmp/hiren-new
Then, use isohybrid
to add partition table to the .iso
isohybrid /tmp/hiren-bootcd.iso
Now, the hiren-bootcd.iso file will have partition table. It can be viewed by Openstack as it is an VM image. Next, import this into Openstack
Create Glance image with the bood cd, named "Hiren Boot CD"
glance image-create --name "Hiren Boot CD" --file ./images/hiren-bootcd.iso --container-format bare --disk-format iso --os-version "15.2" --visibility public --progress
Use the image to create a volume at Cinder, with size at 1GB
cinder create --image "Hiren Boot CD" --name "Hiren Boot CD" 1
Attach the boot cd volume to the instance
nova list # show all instances
cinder list # show all volumes
nova volume-attach <instance-id> <volume-id>
Start the instance, and on "Grub" prompt, use hd1 (the boot cd volume) to boot.
grub> rootnoverify (hd1,0)
grub> makeactive
grub> chainloader +1
grub> boot
Boot CD will run and you can recover the disk.