Quick guide on how to make a custom Solaris boot CD to use as a Bacula client rescue CD for Solaris 10_03/05 x86 (FCS). copyright Robert W Hartzell 2006-04-21 What you will need: 1) Static compiled file daemon and config files for your setup. 2) Solaris 10_03/05 CD 1 of 4 3) CD Burner 4) super-user access to build the miniroot & iso image. 1) mkdir /tmp/isodir 2) Create an empty file to hold the miniroot plus a little extra room and leaves about 290mb free on the CD # mkfile 360m /var/tmp/miniroot 3) Map the file to a block device # lofiadm -a /var/tmp/miniroot /dev/lofi/1 4) Create a new file system on the miniroot # newfs -i 8192 -m 1 /dev/rlofi/1 newfs: construct a new file system /dev/rlofi/1: (y/n)? y /dev/rlofi/1: 736800 sectors in 1228 cylinders of 1 tracks, 600 sectors 359.8MB in 77 cyl groups (16 c/g, 4.69MB/g, 576 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 9632, 19232, 28832, 38432, 48032, 57632, 67232, 76832, 86432, 643232, 652832, 662432, 672032, 681632, 691232, 700832, 710432, 720032, 729632 5) Mount the block device # mount /dev/lofi/1 /mnt 6) Copy the root image to the miniroot file system # cd /cdrom/cdrom0/s0 # find . -depth -print | cpio -pdm /mnt 780288 blocks 7) Add your static built fd and config files to /mnt I just reproduced my production directory structure so it looks like this but you can place the files however you want. Just make sure they match the config files. # cd /mnt/ # ls -R opt/local opt/local: bin etc sbin opt/local/bin: bacula bconsole btraceback.dbx btraceback.gdb gconsole opt/local/etc: bacula opt/local/etc/bacula: bacula-ctl-fd bacula-fd.conf bconsole.conf opt/local/sbin: bacula-fd bconsole btraceback Edit your config files so that the working directory is /tmp so bacula has writable place to put the pid and state file. I also needed to copy some gcc libs from /usr/sfw/lib to the miniroot and setup a couple of softlinks. Put them in the /mnt/usr/sfw/lib # cd /mnt/usr/sfw/lib # cp /usr/sfw/lib/libgcc_s.so.1 . # ln -s libgcc_s.so.1 libgcc_s.so # cp /usr/sfw/lib/libstdc++.so.6.0.3 . # ln -s libstdc++.so.6.0.3 libstdc++.so.6 8) Unmount the file system and delete the lofi device # umount /mnt # lofiadm -d /dev/lofi/1 9) Extract the boot files from the CD a) Turn off the volume manager # /etc/init.d/volmgt stop b) The CD should stll be in the drive. Make sure you use the correct device for your CDROM drive # dd if=/dev/dsk/c1t0d0p0 of=/tmp/mboot+pboot.cd bs=512 count=2 2+0 records in 2+0 records out c) Save the bootblk into a file named bootblk.cd # dd if=/dev/dsk/c1t0d0p0 of=/tmp/bootblk.cd bs=512 iseek=4 count=60 60+0 records in 60+0 records out 10) Create the boot files a) Create the bootimage # cp /tmp/mboot+pboot.cd /tmp/isodir/.bootimage b) Create the boot file with a 1k gap in the file # cp /tmp/mboot+pboot.cd /tmp/genboot # dd if=/dev/zero bs=1024 count=1 >> /tmp/genboot 1+0 records in 1+0 records out # cat /tmp/bootblk.cd >> /tmp/genboot 11) Add your custom content to the CD image (max size is about 290mb) I haven't messed with this yet but you should be able to place just about anything you want in the /tmp/isodir before you create iso image. It would be a good place to put config files for other systems. Whatever program you run has to fit in available memory. 12) Create the CD image using mkisofs # mkisofs -r -no-emul-boot \ -b .bootimage \ -c .catalog \ -G genboot \ -o bacula-rescue.iso \ -sunx86-boot /var/tmp/miniroot \ /tmp/isodir/ Size of boot image is 4 sectors -> No emulation Total translation table size: 2048 Total rockridge attributes bytes: 331 Total directory bytes: 0 Path table size(bytes): 10 Total extents including Solaris x86 boot = 184480 Max brk space used 8000 184630 extents written (360 MB) 13) Create the custom boot CD a) Restart volmgt # /etc/init.d/volmgt start volume management starting. b) Burn the image (use the correct device for your burner). You can get the correct device with: # /opt/sfw/bin/cdrecord -scanbus Burn the image with: # /opt/sfw/bin/cdrecord dev=1,0,0 -v -eject /tmp/bacula-rescue.iso 14) Now your ready to boot the the system with the rescue CD a) Insert the rescue CD and boot the system. b) Choose option 4 Solaris Interactive Text (Console session) c) Allow the install routine continue and setup the networking information according to your site. d) When you see the "Solaris Interactive Installation" screen exit the install routine with F5 then confirm with F2 e) Format and partition the new hard drive (duplicate the partitioning scheme that was used on the old HD). f) Create the file systems with newfs, check them with fsck. g) Mount the HD to /mnt h) Start the bacula file daemon with: /opt/local/bin/bacula start and then bconsole with: /opt/local/bin/bconsole You should now be connected to you backup server and ready to restore your system to /mnt i) After the restore is complete you need to make the new HD bootable with installboot (details on how to do this in the next rev of the doc) For reference (man installboot) j) reboot