Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Sep 1995 19:12:52 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        hackers@freebsd.org, jehamby@lightside.com
Subject:   Re: Adding/deleting partitions should be Linux-like
Message-ID:  <199509180912.TAA16027@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>In order to make room for 2.1.0-STABLE source on my hard drive, I got rid 
>of a 400 meg DOS partition and tried to add it as /usr/src to FreeBSD.  I 
>had nothing but trouble, since fdisk and disklabel are RIDICULOUSLY 
>difficult to use.  No matter how much I RTFM, I just could not figure out 
>how to change partition 1 from MSDOS to FreeBSD,

	fdisk -u /dev/rwd0	# for IDE drive 0
	# Hit return to accept the default for everything except:
	# - answer `y' to the question about changing the partition
	#   (slice) you want to change.
	# - supply a new value of 165 for the `sysid' of that slice.
	# - answer `y' to the question about the entry being correct.
	# - answer `y' to the question about writing the new changes.

This step can be skipped if you are in a hurry and don't need to boot
from the slice.  You just have to worry about other OS's thinking that
they own it.

>nor would newfs work 
>properly without a description of the partition size.  It seemed that 
>everything revolved around writing an /etc/disktab which I did NOT want 
>to do.  In comparison, Linux's mkfs command automagically sizes the 
>partition and creates the filesystem.

Yes, Linux's mkfs gets the size of the partition from the DOS partition
table, while BSD's newfs gets the size of the partition from the label.
newfs would work better if there was a dummy label for each slice.
Currently, only the whole disk slice has a dummy label.  It's done this
way to reduce the chance of newfs'ing non-BSD slices.

To avoid changing /etc/disktab, I sometimes use:

	disklabel -r -w sd1s2 floppy5	# bogusly label my sd1s2 as a floppy
	disklabel /dev/rsd1 >/tmp/foo	# remember hints about sd1's geometry
	disklabel -e sd1s2		# edit label to what it should be

>I know, I know, the Berkeley FFS 
>wants to know the cylinder/head/sector geometry in order to optimize the 
>layout,

Not in FreeBSD.  The default is to use a big fictitous geometry ...

>but with the geometry translations of IDE (and SCSI?) drives, 
>trying to do this properly is probably futile.

... since a big fictitious geometry is no worse than a small fictitious
geometry supplied by drives, and better than a wrong fictitions geometry
supplied by confused installers.

>Anyway, I ended up booting my FreeBSD boot disk to run sysinstall and
>create the filesystem.  After a couple of failures, I managed to create

This is said to be easier using Wizard mode.

>and mkfs a FreeBSD partition with a single /usr/src slice, but then
>FreeBSD wouldn't boot!  I realized that the FreeBSD boot loader assumes
>partition one (my new /usr/src) is the root partition, so it couldn't find
>the kernel.  Back to square one.  I finally ended up using my trusty LINUX

Adding a new FreeBSD slice before the one with the bootstrap would give
you a different compatibility slice that you can't boot from.  This can
be worked around by rearranging the DOS partitions or simply by not
changing the sysid of the new FreeBSD slice - change it Linux or No-nix
(better not leave it as DOS).

Bruce



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