Re: Boot Drive Nomenclature and How to Figure it out

2010-09-03 Thread Adam Vande More
On Fri, Sep 3, 2010 at 9:10 AM, Martin McCormick
mar...@dc.cis.okstate.eduwrote:

I have been writing a script to build a system from a
 mfsboot startup and it is going well but I want to revisit part
 of the script that I don't think I did a very good job with.

Is there an automatic way to tell which of the devices
 shown in /dev is a likely system drive? This is before anything
 is mounted.

We can usually figure it out ourselves, but is there a
 way for a script to figure out automatically which character
 device could be the one we are going to put the OS on and use as
 our boot drive?

I know this sounds really obvious and you can tell
 scripts not to use /dev/acdx as they are CDROM devices, but
 system drives can actually take many different names depending
 on whether they are RAIDs SCSI IDE, etc.

Any good suggestions are appreciated.


Would doing something like:

gpart list

help?


-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Boot Drive Nomenclature and How to Figure it out

2010-09-03 Thread Martin McCormick
Adam Vande More writes:
 Would doing something like:
 
 gpart list
 
 help?

Thank you. I have never heard of gpart before so I gave
it a try and that helps very much if the drive is already
formatted. Most of these drives I plan to encounter will be
formatted so this basically solves the problem but it raises a
new question. If one does

gpart list as suggested and the disk is formatted, one gets
exactly the information necessary. I believe it is even the
first line of output. It doesn't get better than that. If the
disk is not corrected formatted such as might happen with
corruption or maybe a new drive, gpart list executes silently
and prints nothing on the output.

As I said, you answered my question so many thanks. The
new question might best be put:

Okay, if nothing is there, where did gpart look to see nothing?

Martin McCormick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org



Re: Boot Drive Nomenclature and How to Figure it out

2010-09-03 Thread Adam Vande More
On Fri, Sep 3, 2010 at 10:04 AM, Martin McCormick
mar...@x.it.okstate.eduwrote:

Thank you. I have never heard of gpart before so I gave
 it a try and that helps very much if the drive is already
 formatted. Most of these drives I plan to encounter will be
 formatted so this basically solves the problem but it raises a
 new question. If one does

 gpart list as suggested and the disk is formatted, one gets
 exactly the information necessary. I believe it is even the
 first line of output. It doesn't get better than that. If the
 disk is not corrected formatted such as might happen with
 corruption or maybe a new drive, gpart list executes silently
 and prints nothing on the output.

As I said, you answered my question so many thanks. The
 new question might best be put:

 Okay, if nothing is there, where did gpart look to see nothing?


I believe gpart checks the geom sector which the last one of a particular
geom class. The sector is written anytime the geom device is added or
updated.  This applies only to geom devices which are hardcoded.  For
example, /dev/ad0 and /dev/ad0p1 would both be seperate geom classes and
have their own meta-data sector.

FWIW, the only suitable hard disk devices I know of are:

/dev/ad{0-9}
/dev/ada{0-9}
/dev/da{0-9}

If you're writing a test, I would probably grep dmesg for the presence of
one of them.  The first device appearance is probably a prime candidate for
installation target.

-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org