Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Feb 2010 13:23:52 -0500
From:      Jerry McAllister <jerrymc@msu.edu>
To:        Martin McCormick <martin@dc.cis.okstate.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Swap Partition First?
Message-ID:  <20100202182352.GA10903@gizmo.acns.msu.edu>
In-Reply-To: <201002021728.o12HSDDi092152@dc.cis.okstate.edu>
References:  <201002021728.o12HSDDi092152@dc.cis.okstate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100202182352.GA10903>