Swap Partition First?

Jerry McAllister jerrymc at msu.edu
Tue Feb 2 18:25:17 UTC 2010

On Tue, Feb 02, 2010 at 11:28:13AM -0600, Martin McCormick wrote:

> 	I figured out a way to install swap as the only
> fixed-sized partition such that whatever is left is marked as
> BSD (165) but I am not sure if this is a workable solution so I
> am asking for suggestions.
> 	If I set up the disk label reference file as follows:
> # /dev/ad0s1:
> 8 partitions:
> #        size   offset    fstype   [fsize bsize bps/cpg]
>   a: *  2097152    4.2BSD     2048 16384 28552 
>   b:  2097152        0      swap                    
> bsdlabel gets very confused and one ends up with possibly swap
> and about 4 gigabytes of FreeBSD which is not right.

This could be a problem.   I think using the '*' for size will 
cause it to use the whole remaining space for that partition.
Even though it logically starts at 2097152, it might not come out
even on a good boundary or something like that.  It really seems to
like to have things entered sequentially.

> 	So, I inverted things since what we want is for
> everything but swap to be FreeBSD and we want this to work on
> some disk for which we may not know the size.
> # /dev/ad0s1:
> 8 partitions:
> #        size   offset    fstype   [fsize bsize bps/cpg]
>   a:  2097152        0      swap                    
>   b: *  2097152    4.2BSD     2048 16384 28552 
> 	This means one mounts ad0s1b instead of ad0s1a which is
> what you normally see. Will this create some sort of monster
> later down the line?

It should not create a problem in the system, but it might 
introduce some confusion later when you have partly forgotten
what you did and why.   So, you might want to keep the swap
on 'b' since it is a strong convention.

You could have left the 'a' partition empty; just not used it.
Then make 'b' your swap with the fixed size as usual and then 
something like 'd' (or 'e' or 'f' or 'g' or 'h') be that large 
partition using up all the rest of the space.

Although it seems to prefer the space be claimed in order, it 
has no problem ignoring skipped partition letters.    

If I use up a who extra disk in one slice-partition, I usually 
make it 'd' or 'h' and skip 'a', 'b' (and of course, 'c') just to 
keep things clear in my head.

Something like:

# /dev/ad0s1:
  8 partitions:
  #        size    offset    fstype   [fsize bsize bps/cpg]
    b:  2097152         0      swap
    g:        *         *    4.2BSD     2048 16384 28552
Should work just fine.

> 	The hope is to create a largely automated process that
> coworkers can use if we ever need to recreate X or Y server from
> a new piece of hardware during an upgrade or after a lightening
> storm when every minute counts. Many thanks.

So, in that case, do stick closer to convention and use a higher 
partition label identifier such as 'd' or whatever, as above.   
In fact set yourself up with a conventional use for each identifier
so that it can be used in all circumstances.  Such as:

   a = root            (if the disk doesn't have root skip 'a')
   b = swap            (''  ''  ''   ''      ''  swap  ''  'b')
   c = reserved for system
   d = /tmp            (  etc                                 )
   e = /usr            (  etc                                 )
   f = /var            (  etc                                 )
   g = /home           (  etc                                 )
   h = /work       extra big space to put stuff.  ( etc       )

Just use the ones needed and skip the others.   But still enter 
the ones you use in their conventional order in bsdlabel.

> Martin McCormick WB5AGZ  Stillwater, OK 
> Systems Engineer
> OSU Information Technology Department Telecommunications Services Group
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

More information about the freebsd-questions mailing list