fdisk behavior hack

Julian Elischer julian at elischer.org
Wed Nov 4 17:48:57 UTC 2009


M. Warner Losh wrote:
> Greetings,
> 
> Enclosed please find a hack to the behavior of fdisk.  On !x86, !ia64
> platforms, you can't do a "fdisk -I da0" because there's not
> /boot/mbr.  It is perfectly valid to make disks that don't have any
> boot code on them (say if you are an ARM or MIPS embedded machine).
> 
> This patch changes things.  Currently, for all patforms except ia64 we
> open the specified file (defaulting to /boot/mbr).  If it doesn't
> exist or we can't read it, we die.  Then we do a bunch of sanity
> checking on the MBR that was read in.  On ia64 we just make a fake one
> and return (we don't use the -b argument at all!).

I'd say that you could make a valid readable disk without teh boot 
code even on x86..  just give a big warning.

"No boot code available. Disk will not be bootable"

> 
> I'd like to propose something simpler.
> 
> I'd like to propose that for !i386 and !amd64 we allow the open and/or
> stat to fail.  If the user specified the -b flag, the same thing as
> the !ia64 case will happen as today: they get an error and the program
> refuses to work.  If no -b flag was specified, then we'll use the
> current ia64-only code to fake up a 'good enough' MBR and proceed.
> 
> This will allow non-x86 platforms that install fdisk to still
> initialize a disk in the face of the missing template mbr file.
> 
> Comments?
> 
> Code Review?
> 
> Warner
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> freebsd-arch at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"



More information about the freebsd-arch mailing list