[CFT] Patch to bsdinstall to support root-on-ZFS and GELI

Nathan Whitehorn nwhitehorn at freebsd.org
Thu Oct 10 07:00:57 UTC 2013


On 10/09/13 18:55, Teske, Devin wrote:
> On Oct 8, 2013, at 11:19 PM, Nathan Whitehorn wrote:
>
>> On 10/09/13 01:13, Allan Jude wrote:
>>> On 2013-10-08 16:17, Nathan Whitehorn wrote:
>>>> On 10/07/13 21:59, Allan Jude wrote:
>>>>> Devin Teske and I have been working on a big patch to bsdinstall to
>>>>> implement installing on a ZFS pool. It supports both GPT and MBR, the 4k
>>>>> sector gnop trick, and optional GELI encryption. We would like to commit
>>>>> this in time for 10.0-BETA1 so it needs some testing to work out any
>>>>> obvious bugs before we send it off to re@ to get it committed.
>>>>>
>>>>> It includes a single configuration menu that allows you to select all of
>>>>> the required details, including which drives to use (gets details from
>>>>> camcontrol, also includes an inspection utility that presents the
>>>>> detailed output of camcontrol inquiry/identify, and gpart show), what
>>>>> ZFS RAID level to use (taking in to consideration the selected number of
>>>>> drives), GPT/mbr, 4k YES/no, GELI yes/NO, pool name, etc.
>>>>>
>>>>>
>>>>> Additional, it includes some other changes to bsdinstall:
>>>>> 1. Change the default to the 'non-standard keyboard mapping' prompt to no
>>>>> 2. Replace the 3 separate dialogs to configure an ipv4 address with just 1
>>>>> 3. Remove the dialog asking if you wish to enable crash dumps, this
>>>>> feature has been combined into the regular 'services to enable' dialog
>>>>> and enabled by default
>>>>>
>>>>>
>>>>> You can browse the patches here:
>>>>> http://druidbsd.cvs.sf.net/viewvc/druidbsd/bsdinstall_zfs/
>>>>>
>>>>> I've built a bootonly.iso (10.0-ALPHA4) to make testing easier,
>>>>> available compressed (48 MB) or uncompressed (211 MB):
>>>>>
>>>>> http://www.allanjude.com/bsd/zfsbootonly_2013-10-06.iso.xz
>>>>>
>>>>> http://www.allanjude.com/bsd/zfsbootonly_2013-10-06.iso
>>>>>
>>>>>
>>>>> We look forward to your feedback
>>>>>
>>>> Thanks for doing this! I had a few comments:
>>>> 1. ZFS is not bootable on all architectures. Could you adjust that menu
>>>> item to only display for i386, amd64, and (I think?) sparc64. Use uname
>>>> -m, not -p, for this.
>>> I had not considered that, I'll make that change
>>>
>>>> 1a. The script is broken on sparc64 in any case, which uses VTOC8
>>>> instead of GPT.
>>> I'll disable sparc64 as well
>>>
>>>> 2. Why are you using camcontrol? That is guaranteed not to work on
>>>> non-CAM systems. You should use the GEOM ident string if you need an ID.
>>> The GEOM ident string doesn't do enough to help the user identify which
>>> drive is which.
>>> More data is not exposed anywhere that I could find
>>>
>>> What we really need, is dev.ada.0.desc% like we have for network
>>> interfaces and a slew of other devices. GEOM data is great, but it is
>>> not exposed in a shell friendly way any place that I could find, other
>>> than the sysctl with DOT and XML data.
>> This is one of the reasons the partition editor is written in C. There
>> are a few other odd corner-cases where C is much more powerful than the
>> command-line for the GEOM operations that partedit needs to do. I'm not
>> sure how to usefully get it just from the shell. You can see how to do
>> it in C in the boot_disk() routine of partedit/auto_part.c.
>>
>>>> 3. Any plans to integrate this into the regular partition editor? ZFS
>>>> support is important enough that I will definitely not get in the way,
>>>> even as a bolt-on, but it would be a shame for it to stay that way. The
>>>> editor is also designed for ZFS to be added.
>>> I am a sysadmin, not a programmer. I can't write C. Most people
>>> deploying servers can't write C. I agree with Devin Teske, if everything
>>> was in shell it would be a lot more usable for non-developers, who
>>> probably make up the majority of people who deploy FreeBSD.
>> There are some cases the other way too. Devin is probably the most
>> shell-proficient FreeBSD committer.
> Well, there's jilles ;D (he writes/maintains the sh(1) implementation itself).
>
>
>> I certainly can't write shell
>> scripts at that level, which means that for me bsdconfig, for example,
>> is effectively read-only (and quite hard to read as well).
> In the past few days of working on the bsdinstall_zfs patch-set with Allan
> Jude, I learned something new actually.
>
> It seems that sh(1) doesn't suffer so much from this "read only" concept.
>
> Imagine you're starting a new C project on an operating system that has
> all new syscalls and all new APIs that you've never seen. Would be pretty
> hard, no doubt. Now imagine that you're thrown a life-line called POSIX
> and hey, now you're slinging code in MinGW on Windows when you don't
> know a lick of M$ syscalls or APIs.
>
> In a similar manner, I've witnessed functionality be added that is truly
> functional *without* using any of the API calls. Then I come in and do
> a round of optimizations to leverage the existing API.
>
> Shell is kinda like that...
>
> I'm noticing Allan Jude doesn't know all the API calls yet (who could? other
> than me of course -- and even I have trouble remembering them _all_) yet
> this doesn't phase him (or others) from jumping in and lending a hand.
>
> No different than C, but the read-only aspect is lessened significantly I
> believe because there are so many people out there that know enough
> good shell syntax and are just a stone's throw away from *great* shell
> syntax (which I must admit jilles helped me cross that boundary).
>
> I think in C, the read-only aspect is greater because its harder to parcel-out
> the functions for a unit-test; harder to inject new code; and harder to get
> to a functioning end-state.

Look, I have no doubt that in the right hands shell can do amazing
things and C can be badly written. That isn't the issue though. My
statement was purely that most FreeBSD developers (me included) are more
comfortable with C than shell when used at the kind of level involved
here. This is not a value judgment but a statement of fact. Whether or
not, at some platonic level, shell or C or python or whatever are more
or less read-only is not the point here. The point is that I, and I
suspect many other developers, cannot write (or read) very advanced
levels of shell scripting but can read and write the equivalent programs
when written in C in many cases. It's what the rest of the system is
written in and what we spend most of our time using. Whether this should
be the case or not is immaterial; the fact remains that shell scripting
at any but a very basic level does introduce a very large barrier to
entry for probably a large majority of committers.

This is not always a problem -- especially if using something more
obscure allows very active development by the set of people working on
it -- but does reduce the set of people who can make modifications
substantially. I have no ability to change, or understand, most of
bsdconfig, for example. This isn't a problem since you are doing all the
work and there is no reason I would need to or want to make changes to
it. But it could become a problem in a part of the system to which
multiple people needed to contribute. It's about other people's comfort
zones and knowledge in the end.
-Nathan


More information about the freebsd-current mailing list