Hi,
On Fri, 22 Feb 2013, Polytropon wrote:
> Als guten Einstieg empfehle ich Dir folgende Lektüre:
>
> http://www.wonkity.com/~wblock/docs/html/disksetup.html
>
> Den Teil mit der Boot-Partition kannst Du weglassen.
Mein Setup ist auch dem angepaßt, nur daß außer / so ziemlich alles auf
ZFS landet:
# 2 disks
first="ada0"
disks="ada0 ada1"
zpool_creation="mirror /dev/gpt/zpoolada0 /dev/gpt/zpoolada1"
echo "Allow fiddling with the MBR"
${echo} sysctl kern.geom.debugflags=0x10
echo "Load ZFS module"
${echo} kldload zfs
echo "ZFS - What is there?"
zpool import
sleep 5
echo GEOM work
for d in ${disks}; do
echo "... disk ${d}"
echo "... GEOM - what is there?"
gpart show -l ${d}
sleep 5
echo "... ... Create partition table"
${echo} gpart create -s gpt ${d}
echo "... ... Create partitions"
${echo} gpart add -b 40 -s 512K -t freebsd-boot -l boot${d} ${d}
${echo} gpart add -b 1M -s 2G -t freebsd-ufs -l root${d} ${d}
${echo} gpart add -s 4G -t freebsd-swap -l swap${d} ${d}
${echo} gpart add -t freebsd-zfs -l zpool${d} ${d}
echo "... ... Write bootcode"
${echo} gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ${d}
echo "... ... All good?"
gpart show -l ${d}
sleep 5
done
echo "Create and mount UFS on first disk"
${echo} newfs -U -j /dev/gpt/root${first}
${echo} mount /dev/gpt/root${first} /mnt
sleep 5
echo "Create zpool"
${echo} zpool create zpool ${zpool_creation}
sleep 5
echo "Create some ZFS"
level1_zfs="/home /var /tmp /usr /opt"
level2_zfs="/usr/local /var/backups"
all_zfs="${level1_zfs} ${level2_zfs}"
umount_zfs="${level2_zfs} ${level1_zfs}"
setuid_off_zfs="/home /tmp /opt /var/backups"
exec_off_zfs="/var/backups"
zfs create -o canmount=off zpool/host
for z in ${all_zfs}; do
${echo} mkdir -p /mnt/${z}
${echo} zfs create -p -o mountpoint=/mnt${z} zpool/host${z}
done
for z in ${setuid_off_zfs}; do
${echo} zfs set setuid=off zpool/host${z}
done
for z in ${exec_off_zfs}; do
${echo} zfs set exec=off zpool/host${z}
done
zfs list
sleep 5
# .. Und dann kommt die Vorbereitung der Systeministallation nach /mnt
# Bei mir via "zfs send | receive" von anderswo,
# /usr/src, /usr/obj, /usr/ports, /usr/ports/packages, /var/db/ports
# und /opt/fda, welches mehr Skripte und Konfigs etc. hat
"Install the system"
cd /usr/src
${echo} make installkernel DESTDIR=/mnt
${echo} make installworld DESTDIR=/mnt
${echo} make distribution DESTDIR=/mnt
# Get out of ZFS for umounts
cd
for z in ${umount_zfs}; do
${echo} zfs umount zpool/host${z}
done
for z in ${all_zfs}; do
${echo} zfs set mountpoint=${z} zpool/host${z}
done
sleep 5
echo "Write /etc/fstab"
cat << EOFSTAB > /mnt/etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/gpt/root${first} / ufs rw 1 1
EOFSTAB
for e in ${disks}; do
cat << EOFSWAP >> /mnt/etc/fstab
/dev/gpt/swap${e} none swap sw 0 0
EOFSWAP
done
echo "Enable ZFS in /etc/rc.conf"
cat << EORC > /mnt/etc/rc.conf
# Enable ZFS
zfs_enable="YES"
EORC
Nach dem Neuboot muß man einmal ein
zpool import -f zpool
machen.
Die Anzeigen und sleeps dienen der Vergewisserung, nichts weiter. Wenn
z.B. schon was auf der Platte war, muß man erst einmal löschen.
> Zum Thema Label:
>
> http://www.freebsd.org/doc/handbook/geom-glabel.html
>
> Das hat den Vorteil, daß man sich im Nachhinein nicht mehr
> damit auseinandersetzen muß, ob eine Platte ad, da oder ada
> ist und in welcher Reihenfolge sie gefunden wurde, um auf
> die gewünschte Partition zugreifen zu können.
Das stimmt.. Nächster Schritt zur Perfektion;-)
Der andere ist der Einsatz von gmirror für root.
Ich habe stattdessen eine Kopie des Root-UFS auf der zweiten Platte, so
daß ich im Falle eines erfolglosen Updates das alte System noch da habe
(das ZFS bekommt einen Snapshot) und von der zweiten Platte booten kann.
Es grüßt
Peter
To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Fri 22 Feb 2013 - 04:06:46 CET