Creating a bootable ZFS Filesystem

Ноябрь 27, 2009 at 10:04 дп (помойка справочной инфы) ()

1. Boot FreeBSD install DVD

1. Choose Fixit option in sysinstall

1. Create GPT Disks

Fixit# gpart create -s gpt ad0
Fixit# gpart create -s gpt ad1
Fixit# gpart create -s gpt ad2

1. Create the boot, swap and zfs partitions

Create 3 partitions on drives ad0, ad1 and ad2. The first partition contains the gptzfsboot loader which is able to recognize and load the loader from a [[ZFS]] partition. The second partition is a 4 GB swap partition. The third partition is the partition containing the zpool (60GB).

Fixit# gpart add -b 34 -s 128 -t freebsd-boot ad0
Fixit# gpart add -b 162 -s 8388608 -t freebsd-swap -l swap0 ad0
Fixit# gpart add -b 8388770 -s 125829120 -t freebsd-zfs -l disk0 ad0

 

Fixit# gpart add -b 34 -s 128 -t freebsd-boot ad1
Fixit# gpart add -b 162 -s 8388608 -t freebsd-swap -l swap1 ad1
Fixit# gpart add -b 8388770 -s 125829120 -t freebsd-zfs -l disk1 ad1

 

Fixit# gpart add -b 34 -s 128 -t freebsd-boot ad2
Fixit# gpart add -b 162 -s 8388608 -t freebsd-swap -l swap2 ad2
Fixit# gpart add -b 8388770 -s 125829120 -t freebsd-zfs -l disk2 ad2

”’Note:”’ 1. While a [[RootOnZFS|ZFS Swap Volume]] can be used instead of the freebsd-swap partition, crash dumps can’t be created on the ZFS Swap Volume. 1. Sizes and offsets are specified in sectors (1 sector is typically 512 bytes).

1. Set partition active (Optional)

Some BIOSes might require setting a Slice active. Here we set partition 1 as the active partition.

Fixit# gpart set -a active -i 1 ad0

”’Note:”’ This is no longer required on 9-CURRENT, as installing the bootcode will mark the partition active.

1. Install the Protected MBR (pmbr) and gptzfsboot loader to both drives

Fixit# gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfsboot -i 1 ad0
Fixit# gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfsboot -i 1 ad1
Fixit# gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfsboot -i 1 ad2

This may fail with an “operation not permitted” error message, since the kernel likes to protect critical parts of the disk. If this happens for you, run:

Fixit# sysctl kern.geom.debugflags=0x10

1. Load ZFS kernel module

Fixit# kldload /mnt2/boot/kernel/opensolaris.ko
Fixit# kldload /mnt2/boot/kernel/zfs.ko

1. Create ZFS Pool zroot

Fixit# mkdir /boot/zfs
Fixit# zpool create zroot raidz1 /dev/gpt/disk0 /dev/gpt/disk1 /dev/gpt/disk2
Fixit# zpool set bootfs=zroot zroot

”’Note:”’ 1. zroot is the name of the ZFS Pool, it could be anything (i.e. tank, data, …) 1. A raidz1 pool requires a minimum of 3 disks and a maximum of 9 disks

<>

== Finish install ==

1. Create /etc/fstab

Fixit# cat << EOF > /zroot/etc/fstab
# Device			Mountpoint		FStype	Options		Dump	Pass#
/dev/gpt/swap0			none			swap	sw		0	0
/dev/gpt/swap1			none			swap	sw		0	0
/dev/gpt/swap2			none			swap	sw		0	0
EOF

1. export LD_LIBRARY_PATH

Fixit# export LD_LIBRARY_PATH=/mnt2/lib

1. Unmount all zfs filesystems

Fixit# zfs unmount -a

1. Change mount points for zroot pool

Fixit# zfs set mountpoint=legacy zroot
Fixit# zfs set mountpoint=/tmp zroot/tmp
Fixit# zfs set mountpoint=/usr zroot/usr
Fixit# zfs set mountpoint=/var zroot/var

1. Exit Fixit mode, and then sysinstall. Remove the FreeBSD install CD and the system will boot using the ZFS root.

http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/RAIDZ1
http://blogs.freebsdish.org/lulf/2008/12/16/setting-up-a-zfs-only-system/
http://f-andrey.blogspot.com/2009/01/freebsd-zfs.html

1 комментарий

  1. syloarrorgody сказал,

    Пидор это тот кто не платит по считам , кто уебан холявщик вор , гандон ) Знай это он

Добавить комментарий

Fill in your details below or click an icon to log in:

Логотип WordPress.com

You are commenting using your WordPress.com account. Log Out / Изменить )

Фотография Twitter

You are commenting using your Twitter account. Log Out / Изменить )

Фотография Facebook

You are commenting using your Facebook account. Log Out / Изменить )

Connecting to %s

Follow

Get every new post delivered to your Inbox.