Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jun 2008 12:07:23 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        Nejc =?iso-8859-15?Q?=A6koberne?= <nejc@skoberne.net>
Cc:        User Questions <freebsd-questions@freebsd.org>
Subject:   Re: FreeBSD fdisk how to?
Message-ID:  <20080621100723.GA30639@slackbox.xs4all.nl>
In-Reply-To: <485CC929.2030604@skoberne.net>
References:  <20080620123154.K47466@wojtek.tensor.gdynia.pl> <867893.19250.qm@web57012.mail.re3.yahoo.com> <20080620105111.GA2249@owl.midgard.homeip.net> <485CC929.2030604@skoberne.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Jun 21, 2008 at 11:26:01AM +0200, Nejc =A6koberne wrote:
> Hi,
>=20
> > Well, fdisk(8) is somewhat cumbersome to use.  Personally I tend to inv=
oke
> > sysinstall(8) to create new slices (can be done after install too.)  Mu=
ch
> > easier to use.
>=20
> OT, but: does sysinstall's "fdisk" also support gmirror and gstripe devic=
es?

No

> Or do I need to use fdisk to make slices there?

Yes. But it is not hard.

First of all: _make backups_ !

To create this mirror configuration, the machine is booted from a CD
which contains a live filesystem. I used the
7.0-RELEASE-amd64-livefs.iso image to create this CD. After the machine
boots, the sysinstall(8) application is started automatically. In the
first two menus you have to set your location and keyboard type. The
location doesn't really matter since we won't be installing anything. It
is probably best to choose the default keyboard layout, unless you know
otherwise. Next the ``Fixit'' option is chosen, followed by the
``CDROM/DVD'' option in the next menu. We are now in the shell of the
livefs. The first order of business is to check if the disks have been
recognized. The command

# ls /dev/ad*

should return two disks.=20
Now it is time to create a mirrored device using
the gmirror(8) tool. Next the mirror is activated by loading the
geom_mirror kernel module. After the kernel module has been
loaded, the mirrored device \texttt/dev/mirror/gm0 should appear.

# gmirror label gm0 ad4 ad6
# kldload /mnt2/boot/kernel/geom_mirror.ko


Now it is time to devide the disks into slices (which are called partitions
in PC parlance). The -I option creates one FreeBSD slice covering
the entire disk. The -B option writes a boot block.

# fdisk -vBI /dev/ad4
# fdisk -vBI /dev/ad6

Now that the disk has been given a single slice, a new device
/dev/mirror/gm0s1 will appear. We will now subdivide that into
FreeBSD partitions using bsdlabel(8). First we will write a standard
label and boot blocks.=20

# bsdlabel -wB /dev/mirror/gm0s1
# export EDITOR=3D/mnt2/usr/bin/ee
# bsdlabel -e /dev/mirror/gm0s1

The command in the middle sets the editor to something more user friendly
then vi! The last command will open a text editor with the
partition table that the first command made. It should be edited to look
like the following (for example);

# /dev/mirror/gm0s1:
8 partitions:
#  size  offset  fstype  [fsize bsize]
a: 500M  16      4.2BSD  2048 16384  # /
b: 8G    *       swap                # Reserved for swap.
c: *     *       unused  0    0      # "raw" part.
d: 2G    *       4.2BSD   2048 16384 # /var
e: 50G   *       4.2BSD   2048 16384 # /tmp
f: 20G   *       4.2BSD   2048 16384 # /usr
g: *     *       4.2BSD   2048 16384 # /home

The disk partitions are now ready to put the filesystems on them. To
minimize the chance of problems with the root partition, softupdates are
not enabled for root.

# newfs /dev/mirror/gm0s1a
# newfs -U /dev/mirror/gm0s1d
# newfs -U /dev/mirror/gm0s1e
# newfs -U /dev/mirror/gm0s1f
# newfs -U /dev/mirror/gm0s1g

Now you can restore your backups.

Before you reboot, edit /etc/fstab to mount the right partitions.

And edit /boot/loader.conf to load the geom_mirror module.

# echo 'geom_mirror_load=3D"YES"' >>/boot/loader.conf

Roland
--=20
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)

--tThc/1wpZn/ma/RB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkhc0tsACgkQEnfvsMMhpyVg1wCfYSB46rp7ZXyf1/FOBcP6K7UR
e38An3fRiy9hm4Kv+OotRaWBVh9GCuIY
=ERU3
-----END PGP SIGNATURE-----

--tThc/1wpZn/ma/RB--



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