[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatic setup of partitions


I am still working on a nice automated installation CD system.  It is  
partially a custom boot CD and partially a site36.tgz file that  
installs all the relevant packages, then does a scripted restoration  
from out backup server.  It's intended for bare-metal restores in the  
event of complete disk or server failure, and should operate almost  
totally unattended.

The only problem I have left to overcome is that of automatically  
partitioning the disk at the first stage of the process.  I know that  
I can read an existing disklabel to a text file, and write a  
disklabel to a disk from the contents of a text file.  My  
configuration file for each server would have an entry like this in it:

     /                = 15%
     swap            = 512M
     /home            = 10%
     /root            = 10%
     /var            = *
     /www            = 25%
     /logs            = 10%
     /tmp            = 5%

The problem arises when, if going on to a brand new machine, that the  
disk size may be different than the original it is restoring.  As  
part of the installer (in the OpenBSD install environment, booted off  
an openbsd installer CD) I'd like to read the size of the disk and  
partition the disk accordingly.  would I need to generate all of this  

#        size   offset    fstype   [fsize bsize   cpg]
   a:  2048193       63    4.2BSD     1024  8192    16   # (Cyl.     
0*- 2031)
   b:   524160  2048256      swap                        # (Cyl. 2032  
- 2551)
   c: 117187500        0    unused        0     0        # (Cyl.    0  
- 116257*)
   d: 114605694  2572416    4.2BSD     1024  8192    16  # (Cyl. 2552  
- 116248*)

I'd rather just tell it to create some given partitions and have it  
handle the math itself.  I could do approximate sums for partition  
sizes based on numbers of bytes per parition versus drive space.  How  
much of the disklabel ASCII text file would I need to generate?   
Could I assign default values to the drive, then partition it later?

The partitioning needs to happen after boot but before I start  
installing packages (obviously).  I have no problem with hacking the  
installer script to suit my needs.  I can see that I can also use the  
-f switch to build my fstab for me, so I don't need to worry about  
that, but I'd rather use as much of the OpenBSD installer code as  


Junkets for bunterish lickspittles since 1998!