]> git.sur5r.net Git - bacula/rescue/blob - rescue/solaris/custom_boot_cd.txt
Tweak version
[bacula/rescue] / rescue / solaris / custom_boot_cd.txt
1
2 Quick guide on how to make a custom Solaris boot CD to use as a Bacula
3 client rescue CD for Solaris 10_03/05 x86 (FCS).
4
5         copyright Robert W Hartzell 2006-04-21 <rwhartz at cox.net>
6  
7 What you will need:
8         1) Static compiled file daemon and config files for your setup.
9         2) Solaris 10_03/05 CD 1 of 4
10         3) CD Burner
11         4) super-user access to build the miniroot & iso image.
12
13
14 1) mkdir /tmp/isodir
15
16 2) Create an empty file to hold the miniroot plus a little extra room
17    and leaves about 290mb free on the CD
18         
19         # mkfile 360m /var/tmp/miniroot
20
21 3) Map the file to a block device
22         
23         # lofiadm -a /var/tmp/miniroot
24         /dev/lofi/1
25
26 4) Create a new file system on the miniroot
27         
28         # newfs -i 8192 -m 1 /dev/rlofi/1
29         
30         newfs: construct a new file system /dev/rlofi/1: (y/n)? y
31         /dev/rlofi/1: 736800 sectors in 1228 cylinders of 1 tracks, 600 sectors
32         359.8MB in 77 cyl groups (16 c/g, 4.69MB/g, 576 i/g)
33         super-block backups (for fsck -F ufs -o b=#) at:
34         32, 9632, 19232, 28832, 38432, 48032, 57632, 67232, 76832, 86432,
35         643232, 652832, 662432, 672032, 681632, 691232, 700832, 710432, 
36         720032, 729632
37         
38 5) Mount the block device
39
40         # mount /dev/lofi/1 /mnt
41
42 6) Copy the root image to the miniroot file system
43         
44         # cd /cdrom/cdrom0/s0
45         # find . -depth -print | cpio -pdm /mnt
46         780288 blocks
47
48 7)      Add your static built fd and config files to /mnt
49         I just reproduced my production directory structure so it looks
50         like this but you can place the files however you want. Just make
51         sure they match the config files.
52         
53         # cd /mnt/
54
55         # ls -R opt/local
56         opt/local:
57         bin         etc         sbin
58         
59         opt/local/bin:
60         bacula   bconsole   btraceback.dbx  btraceback.gdb  gconsole
61         
62         opt/local/etc:
63         bacula
64         
65         opt/local/etc/bacula:
66         bacula-ctl-fd   bacula-fd.conf  bconsole.conf
67         
68         opt/local/sbin:
69         bacula-fd   bconsole    btraceback
70         
71         Edit your config files so that the working directory
72         is /tmp so bacula has writable place to put the pid and state file.
73
74         I also needed to copy some gcc libs from /usr/sfw/lib to the miniroot
75         and setup a couple of softlinks. Put them in the /mnt/usr/sfw/lib
76
77         # cd /mnt/usr/sfw/lib
78         # cp /usr/sfw/lib/libgcc_s.so.1 .
79         # ln -s libgcc_s.so.1 libgcc_s.so
80         # cp /usr/sfw/lib/libstdc++.so.6.0.3 .
81         # ln -s libstdc++.so.6.0.3 libstdc++.so.6
82
83 8) Unmount the file system and delete the lofi device
84
85         # umount /mnt
86         # lofiadm -d /dev/lofi/1
87
88 9) Extract the boot files from the CD
89
90         a) Turn off the volume manager
91                 # /etc/init.d/volmgt stop
92         b) The CD should stll be in the drive. Make sure you use the correct 
93         device for your CDROM drive
94         
95                 # dd if=/dev/dsk/c1t0d0p0 of=/tmp/mboot+pboot.cd bs=512 count=2
96                 2+0 records in
97                 2+0 records out
98
99         c) Save the bootblk into a file named bootblk.cd
100            
101         # dd if=/dev/dsk/c1t0d0p0 of=/tmp/bootblk.cd bs=512 iseek=4 count=60
102                 60+0 records in
103                 60+0 records out
104
105 10) Create the boot files
106
107         a) Create the bootimage
108
109                 # cp /tmp/mboot+pboot.cd /tmp/isodir/.bootimage
110
111         b) Create the boot file with a 1k gap in the file
112
113                 # cp /tmp/mboot+pboot.cd /tmp/genboot
114                 # dd if=/dev/zero bs=1024 count=1 >> /tmp/genboot
115                 1+0 records in
116                 1+0 records out
117                 # cat /tmp/bootblk.cd >> /tmp/genboot
118
119 11) Add your custom content to the CD image (max size is about 290mb)
120         
121         I haven't messed with this yet but you should be able to place
122         just about anything you want in the /tmp/isodir before you create
123         iso image. It would be a good place to put config files for other
124         systems. Whatever program you run has to fit in available memory.
125         
126 12) Create the CD image using mkisofs
127
128                 # mkisofs -r -no-emul-boot \
129                  -b .bootimage \
130                  -c .catalog \
131                  -G genboot \
132                  -o bacula-rescue.iso \
133                  -sunx86-boot /var/tmp/miniroot \
134                  /tmp/isodir/
135
136         Size of boot image is 4 sectors -> No emulation
137         Total translation table size: 2048
138         Total rockridge attributes bytes: 331
139         Total directory bytes: 0
140         Path table size(bytes): 10
141         Total extents including Solaris x86 boot = 184480
142         Max brk space used 8000
143         184630 extents written (360 MB)
144         
145 13) Create the custom boot CD
146         
147         a) Restart volmgt
148  
149                 # /etc/init.d/volmgt start
150                 volume management starting.
151
152         b) Burn the image (use the correct device for your burner). 
153         You can get the correct device with: 
154
155         # /opt/sfw/bin/cdrecord -scanbus
156         
157         Burn the image with:
158
159         # /opt/sfw/bin/cdrecord dev=1,0,0 -v -eject /tmp/bacula-rescue.iso
160
161 14) Now your ready to boot the the system with the rescue CD
162
163         a) Insert the rescue CD and boot the system. 
164         b) Choose option 4 Solaris Interactive Text (Console session)
165         c) Allow the install routine continue and setup the networking
166         information according to your site.     
167         d) When you see the "Solaris Interactive Installation" screen exit 
168         the install routine with F5 then confirm with F2
169         e) Format and partition the new hard drive (duplicate the partitioning
170         scheme that was used on the old HD).
171         f) Create the file systems with newfs, check them with fsck.
172         g) Mount the HD to /mnt
173         h) Start the bacula file daemon with:
174                 /opt/local/bin/bacula start
175         and then bconsole with:
176                 /opt/local/bin/bconsole
177
178         You should now be connected to you backup server and ready to 
179         restore your system to /mnt
180         i) After the restore is complete you need to make the new HD bootable
181         with installboot (details on how to do this in the next rev of the doc)
182         For reference (man installboot)
183         j) reboot
184
185
186
187
188
189
190
191