Benutzer Diskussion:PaulRiegel/TrueOS: Unterschied zwischen den Versionen

Aus Wiki StuRa HTW Dresden
Zur Navigation springen Zur Suche springen
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 418: Zeile 418:
==== Ersetzen von einem Massenspeicher als Teil von einem mirror ====
==== Ersetzen von einem Massenspeicher als Teil von einem mirror ====


WIP
; Szenario:
* Eines der Geräte für Massenspeicher ist ausgefallen und muss ersetzt werden.
*: Zum Testen dieses Szenario wurde TrueOS mit einem Spiegel für den Massenspeicher installiert.
*:: Theoretisch (und praktisch) funktioniert das auch bei einer standardmäßigen Installation von FreeBSD mit einem Spiegel für den Massenspeicher.
*: Zum Testen wurde eines der Geräte für Massenspeicher einfach entfernt. (Es soll praktisch dargestellt werden, dass das Gerät für Massenspeicher "kaputt" wäre.)
*: Zum Testen gibt es gleichwertiges Gerät für Massenspeicher, dass als Ersatz dienten soll.
 
; Siehe auch:
* https://www.freebsd.org/doc/handbook/zfs-zpool.html
** https://www.freebsd.org/doc/de/books/handbook/zfs-zpool.html
* https://forums.pcbsd.org/thread-20757.html
 
----


: <code>zpool status</code>
: <code>zpool status</code>
Zeile 488: Zeile 500:


errors: No known data errors
errors: No known data errors
</pre>
: <code>gpart show</code>
: <code>gpart show</code>
<pre>
<pre>
Zeile 500: Zeile 513:
   934799912  41943040    3  freebsd-swap  (20G)
   934799912  41943040    3  freebsd-swap  (20G)
   976742952      30176        - free -  (15M)
   976742952      30176        - free -  (15M)
</pre>
: <code>gpart backup ada1</code>
: <code>gpart backup ada1</code>
<pre>
<pre>
Zeile 506: Zeile 520:
2    freebsd-zfs      552 934799360   
2    freebsd-zfs      552 934799360   
3  freebsd-swap 934799912  41943040   
3  freebsd-swap 934799912  41943040   
</pre>
: <code>gpart backup ada1 | gpart restore -F ada0</code>
: <code>gpart backup ada1 | gpart restore -F ada0</code>
<pre>
<pre>
gpart backup ada1 | gpart restore -F ada0
gpart backup ada1 | gpart restore -F ada0
</pre>
: <code>gpart show</code>
: <code>gpart show</code>
<pre>
<pre>
Zeile 583: Zeile 599:
ada1p3
ada1p3
</pre>
</pre>
{|
|-
| Hinzufügen
| Ersetzen
|-
|
: <code>sudo zpool attach vzfspool /dev/ada0p2.eli /dev/ada1p2.eli</code>
: <code>sudo zpool attach vzfspool /dev/ada0p2.eli /dev/ada1p2.eli</code>
<pre>
<pre>
Zeile 596: Zeile 618:


</pre>
</pre>
: <code>gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1p1</code>
: <code>gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0p1</code>
<pre>
<pre>
gpart: No such geom: ada0p1.
gpart: No such geom: ada0p1.
</pre>
</pre>
: <code>sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada1</code>
: <code>sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada0</code>
<pre>
<pre>
partcode written to ada1p1
partcode written to ada0p1
bootcode written to ada1
bootcode written to ada0
</pre>
: <code>geli status</code>
<pre>
          Name  Status  Components
    ada0p2.eli  ACTIVE  ada0p2
    ada1p2.eli  ACTIVE  ada1p2
label/swap0.eli  ACTIVE  label/swap0
</pre>
</pre>
: <code>sudo zpool attach vzfspool /dev/ada1p2.eli /dev/ada0p2.eli</code>
: <code>sudo zpool attach vzfspool /dev/ada1p2.eli /dev/ada0p2.eli</code>
Zeile 624: Zeile 639:
/dev/ada0p2.eli is part of active pool 'vzfspool'
/dev/ada0p2.eli is part of active pool 'vzfspool'
</pre>
</pre>
: <code>zpool status                                            
: <code>zpool status</code>
</code>
<pre>
<pre>
   pool: vzfspool
   pool: vzfspool
Zeile 640: Zeile 654:
errors: No known data errors
errors: No known data errors
</pre>
</pre>
|
: <code>sudo zpool replace zopt 4561791786978147166 /dev/ada0p2.eli</code>
<pre>
Make sure to wait until resilver is done before rebooting.
If you boot from pool 'vzfspool', you may need to update
boot code on newly attached disk '/dev/ada0p2.eli'.
Assuming you use GPT partitioning and 'da0' is your new boot disk
you may use the following command:
        gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
</pre>
: <code>sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0</code>
<pre>
partcode written to ada0p1
bootcode written to ada0
</pre>
: <code>zpool status</code>
<pre>
  pool: vzfspool
state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Sun mm dd HH:MM:SS yyyy
        6.15G scanned out of 12.3G at 32.1M/s, 0h1m to go
        6.15G resilvered, 50.00% done
config:
        NAME                      STATE    READ WRITE CKSUM
        zopt                      DEGRADED    0    0    0
          mirror-0                DEGRADED    0    0    0
            replacing-0            OFFLINE      0    0    0
              4561791786978147166  OFFLINE      0    0    0  was /dev/ada0
              ada0p2.eli          ONLINE      0    0    0
            ada1p2.eli            ONLINE      0    0    0
errors: No known data errors
</pre>
: <code>zpool status</code>
<pre>
  pool: vzfspool
state: ONLINE
  scan: resilvered 12.3G in 0h2m with 0 errors on Sun mm dd HH:MM:SS yyyy
config:
        NAME            STATE    READ WRITE CKSUM
        vzfspool        ONLINE      0    0    0
          mirror-0      ONLINE      0    0    0
            ada1p2.eli  ONLINE      0    0    0
            ada0p2.eli  ONLINE      0    0    0
errors: No known data errors
</pre>
|-
|}


; Siehe auch:
; Notizen:


* https://forums.pcbsd.org/thread-20757.html
dd if=/dev/ada1p1 of=/dev/ada0p1


==== Ersetzen von einem Massenspeicher als Teil von einem mirror "pc-sysinstall stlyle" ====
==== Ersetzen von einem Massenspeicher als Teil von einem mirror "pc-sysinstall stlyle" ====

Aktuelle Version vom 30. Juni 2018, 16:16 Uhr

Dinge, die gesichert werden sollte, wenn größer umgezogen wird[Bearbeiten]

muss[Bearbeiten]

persönliche Daten
~
Festhalten der UID
sudo cat /etc/passwd | grep ~
iooi:*:1001:1001:IOOI:/usr/home/iooi:/bin/csh
Zugangsdaten fürs Netzwerk (WPA)
/etc/wpa_supplicant.conf
bestehende genutzte Zertifikate mitnehmen
ls /usr/local/etc/ssl/certs/

Installation mit 2 Geräten für Massenspeicher als Spiegel[Bearbeiten]

pc-sysinstall.log

kern.geom.debugflags: 0 -> 16
kern.geom.label.disk_ident.enable: 0 -> 0
Deleting all gparts
Running: gpart destroy -F /dev/ada0
gpart: arg0 'ada0': Invalid argument
Running: zpool labelclear -f /dev/ada0
failed to read label from /dev/ada0
Running: gpart create -s gpt /dev/ada0
ada0 created
Running: gpart destroy -F /dev/ada0
ada0 destroyed
Clearing gpt backup table location on disk
Running: dd if=/dev/zero of=/dev/ada0 bs=1m count=1
1+0 records in
1+0 records out
1048576 bytes transferred in 0.046040 secs (22775338 bytes/sec)
Running: dd if=/dev/zero of=/dev/ada0 bs=1m oseek=305241
dd: /dev/ada0: short write on character device
dd: /dev/ada0: end of device
5+0 records in
4+1 records out
4546560 bytes transferred in 0.082831 secs (54889445 bytes/sec)
Running gpart on /dev/ada0
Running: gpart create -s GPT -f active /dev/ada0
ada0 created
Running: gpart add -s 512 -t freebsd-boot /dev/ada0
ada0p1 added
Stamping boot sector on /dev/ada0
Running: gpart bootcode -b /boot/pmbr /dev/ada0
bootcode written to ada0
Looping through _zvars: /dev/ada0p2
Looping through _zvars: /dev/ada2
Setting up ZFS disk /dev/ada2
kern.geom.debugflags: 16 -> 16
kern.geom.label.disk_ident.enable: 0 -> 0
Deleting all gparts
Running: gpart destroy -F /dev/ada2
gpart: arg0 'ada2': Invalid argument
Running: zpool labelclear -f /dev/ada2
failed to read label from /dev/ada2
Running: gpart create -s gpt /dev/ada2
ada2 created
Running: gpart destroy -F /dev/ada2
ada2 destroyed
Clearing gpt backup table location on disk
Running: dd if=/dev/zero of=/dev/ada2 bs=1m count=1
1+0 records in
1+0 records out
1048576 bytes transferred in 0.046489 secs (22555159 bytes/sec)
Running: dd if=/dev/zero of=/dev/ada2 bs=1m oseek=305241
dd: /dev/ada2: short write on character device
dd: /dev/ada2: end of device
5+0 records in
4+1 records out
4546560 bytes transferred in 0.075279 secs (60396406 bytes/sec)
Running gpart on /dev/ada2
Running: gpart create -s GPT -f active /dev/ada2
ada2 created
Running: gpart add -s 512 -t freebsd-boot /dev/ada2
ada2p1 added
Stamping boot sector on /dev/ada2
Running: gpart bootcode -b /boot/pmbr /dev/ada2
bootcode written to ada2
Running: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada2
partcode written to ada2p1
bootcode written to ada2
Running: gpart add -a 4k -s 305230M -t freebsd-zfs /dev/ada0
ada0p2 added
Cloning disk layout to ZFS disk /dev/ada2
Running: gpart add -a 4k -s 305230M -t freebsd-zfs /dev/ada2
ada2p2 added
Running: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada0
partcode written to ada0p1
bootcode written to ada0
Creating geli provider for /dev/ada0p2
Running: geli init -g -b -J /tmp/.pc-sysinstall/part-info-enc/-dev-ada0p2-encpass /dev/ada0p2

Metadata backup can be found in /var/backups/ada0p2.eli and
can be restored with the following command:

        # geli restore /var/backups/ada0p2.eli /dev/ada0p2

Running: geli attach -j /tmp/.pc-sysinstall/part-info-enc/-dev-ada0p2-encpass /dev/ada0p2
Setting up GELI on mirrored disks: /dev/ada2p2
Running: geli init -g -b -J /tmp/.pc-sysinstall/part-info-enc/-dev-ada0p2-encpass /dev/ada2p2

Metadata backup can be found in /var/backups/ada2p2.eli and
can be restored with the following command:

        # geli restore /var/backups/ada2p2.eli /dev/ada2p2

Running: geli attach -j /tmp/.pc-sysinstall/part-info-enc/-dev-ada0p2-encpass /dev/ada2p2
NEWFS: /dev/ada0p2 - ZFS
Creating storage pool vatertop with mirror /dev/ada0p2.eli /dev/ada2p2.eli
Running: zpool create -m none -f vatertop mirror /dev/ada0p2.eli /dev/ada2p2.eli
zfs create  -p vatertop/ROOT
Running: zfs create  -p vatertop/ROOT
zfs create  -p vatertop/ROOT/initial
Running: zfs create  -p vatertop/ROOT/initial
Running: zfs set mountpoint=/mnt vatertop/ROOT/initial
Stamping vatertop/ROOT/initial as bootfs
Running: zpool set bootfs=vatertop/ROOT/initial vatertop
Running: zfs set compress=lz4 vatertop/ROOT/initial
Running: zfs set atime=off vatertop/ROOT/initial
zfs create  -p vatertop/tmp
Running: zfs create  -p vatertop/tmp
Running: zfs set mountpoint=/mnt/tmp vatertop/tmp
Running: zfs set compress=lz4 vatertop/tmp
Running: zfs set setuid=off vatertop/tmp
zfs create  -p vatertop/usr
Running: zfs create  -p vatertop/usr
Running: zfs set mountpoint=/mnt/usr vatertop/usr
Running: zfs set canmount=off vatertop/usr
Running: zfs set mountpoint=none vatertop/usr
zfs create  -p vatertop/usr/home
Running: zfs create  -p vatertop/usr/home
Running: zfs set mountpoint=/mnt/usr/home vatertop/usr/home
Running: zfs set compress=lz4 vatertop/usr/home
zfs create  -p vatertop/usr/jails
Running: zfs create  -p vatertop/usr/jails
Running: zfs set mountpoint=/mnt/usr/jails vatertop/usr/jails
Running: zfs set compress=lz4 vatertop/usr/jails
zfs create -o canmount=off -p vatertop/usr/local
Running: zfs create -o canmount=off -p vatertop/usr/local
Running: zfs set mountpoint=none vatertop/usr/local
zfs create -o canmount=off -p vatertop/usr/local/share
Running: zfs create -o canmount=off -p vatertop/usr/local/share
Running: zfs set mountpoint=none vatertop/usr/local/share
zfs create  -p vatertop/usr/local/share/doc
Running: zfs create  -p vatertop/usr/local/share/doc
Running: zfs set mountpoint=/mnt/usr/local/share/doc vatertop/usr/local/share/doc
Running: zfs set compress=gzip vatertop/usr/local/share/doc
zfs create  -p vatertop/usr/obj
Running: zfs create  -p vatertop/usr/obj
Running: zfs set mountpoint=/mnt/usr/obj vatertop/usr/obj
Running: zfs set compress=lz4 vatertop/usr/obj
zfs create  -p vatertop/usr/ports
Running: zfs create  -p vatertop/usr/ports
Running: zfs set mountpoint=/mnt/usr/ports vatertop/usr/ports
Running: zfs set compress=lz4 vatertop/usr/ports
zfs create  -p vatertop/usr/src
Running: zfs create  -p vatertop/usr/src
Running: zfs set mountpoint=/mnt/usr/src vatertop/usr/src
Running: zfs set compress=lz4 vatertop/usr/src
zfs create  -p vatertop/var
Running: zfs create  -p vatertop/var
Running: zfs set mountpoint=/mnt/var vatertop/var
Running: zfs set canmount=off vatertop/var
Running: zfs set atime=on vatertop/var
zfs create  -p vatertop/var/audit
Running: zfs create  -p vatertop/var/audit
Running: zfs set mountpoint=/mnt/var/audit vatertop/var/audit
Running: zfs set compress=lz4 vatertop/var/audit
zfs create  -p vatertop/var/log
Running: zfs create  -p vatertop/var/log
Running: zfs set mountpoint=/mnt/var/log vatertop/var/log
Running: zfs set compress=lz4 vatertop/var/log
Running: zfs set exec=off vatertop/var/log
Running: zfs set setuid=off vatertop/var/log
zfs create  -p vatertop/var/mail
Running: zfs create  -p vatertop/var/mail
Running: zfs set mountpoint=/mnt/var/mail vatertop/var/mail
Running: zfs set compress=lz4 vatertop/var/mail
zfs create  -p vatertop/var/tmp
Running: zfs create  -p vatertop/var/tmp
Running: zfs set mountpoint=/mnt/var/tmp vatertop/var/tmp
Running: zfs set compress=lz4 vatertop/var/tmp
Running: zfs set exec=off vatertop/var/tmp
Running: zfs set setuid=off vatertop/var/tmp
Running: tar xvpf /dist/packages/All/fbsd-distrib.txz -C /mnt
x ./
x ./root/
x ./proc/
x ./net/
x ./etc/
x ./.cshrc
x ./usr/
x ./bin/
x ./boot/
x ./lib/
x ./libexec/
x ./rescue/
x ./mnt/
x ./sbin/
x ./.profile
x ./tmp/
x ./sys
x ./COPYRIGHT
x ./media/
x ./dev/
x ./var/

Running: mkdir -p /mnt/compat
Running: mkdir -p /mnt/packages
Running: mount_nullfs /dist/packages /mnt/packages
pkg -c /mnt add /packages/All/FreeBSD--development-12.0.s20171108182534.txz

pkg -c /mnt add /packages/All/FreeBSD-zfs-12.0.s20171108182534.txz
Running: umount -f /mnt/packages
Running: mkdir -p /mnt/usr/.pkgtmp
Running: mount_nullfs /dist/packages /mnt/mnt
Running: cd /mnt/mnt
Running chroot command: which pkg-static
Bootstraping pkgng..
Running: cd /dist/packages
Running: pkg -c /mnt add /mnt/All/pkg-1.10.1.txz
Installing pkg-1.10.1...
Extracting pkg-1.10.1: .......... done
Running chroot command: pkg -R /mnt/repo-installer update -f
Packages to install: 22
Running chroot command: pkg info -e misc/trueos-desktop
Installing package: misc/trueos-desktop
Running chroot command: pkg add /mnt/All/trueos-desktop-201710251909.txz
Running chroot command: pkg add /mnt/All/trueos-desktop-201710251909.txz
Installing trueos-desktop-201710251909...

Extracting trueos-desktop-201710251909: .......... done
Doing first-time bootstrap
 * service ipfw added to runlevel boot
 * service devd added to runlevel boot
 * service devfs added to runlevel boot
 * rc-update: routing already installed in runlevel `boot'; skipping
 * service automount added to runlevel default
 * service statd added to runlevel default
 * service lockd added to runlevel default
 * service rpcbind added to runlevel default
 * service cupsd added to runlevel default
 * service cups_browsed added to runlevel default
 * rc-update: service `dhcpcd' is not in the runlevel `default'
 * rc-update: service `wpa_supplicant' is not in the runlevel `default'
 * service openntpd added to runlevel default
 * service pcdm added to runlevel default
 * service sysadm added to runlevel default
 * service dbus added to runlevel default
 * rc-update: service `hald' does not exist
 * service trueosinit added to runlevel default
 * service moused added to runlevel default
 * service bsdstats added to runlevel default
 * service automountd added to runlevel default
 * service autounmountd added to runlevel default
 * rc-update: service `sndiod' does not exist
 * service mountlate added to runlevel default
webcamd_enable:  -> YES
kldload_i915:  -> 
kld_list:  -> 
kldload_i915kms:  -> 
 * rc-update: trueosinit already installed in runlevel `default'; skipping
Message from anacron-2.3_6:
Configuration hints:
- Edit /usr/local/etc/anacrontab
- Deactivate the 'periodic' commands in /etc/crontab
- Add a call to anacron to /etc/crontab, like
  0  0  *  *  *    root    /usr/local/sbin/anacron
- Add anacron_enable="YES" to /etc/rc.conf
- Read anacron(8) and anacrontab(5)
Message from bsdstats-6.0_2:

Running chroot command: rm -rf /usr/local/tmp/All
Running chroot command: pkg info -e x11-fonts/droid-fonts-ttf
Package installation complete!
Cleaning up: /mnt/usr/.pkgtmp
Running: cd /dev
Running: umount /mnt/mnt
Running: rmdir /mnt/usr/.pkgtmp
Running chroot command: /usr/bin/cap_mkdb /etc/login.conf
Setting em0 to DHCP on the system.
Setting wlan0 to DHCP on the system.
Creating parent wlan0 for iwn0
Running chroot command: ln -s /usr/home /home
Setting hostname: trueos-6202
Running external command: /root/save-config.sh
Running external command: cp /root/defaultpkgbranch ${FSMNT}/root/defaultpkgbranch
Running chroot command: sh /usr/local/share/trueos/scripts/sys-init.sh desktop en_US
Running chroot command: touch /var/.trueos-firstboot
Running chroot command: touch /var/.trueos-firstgui
Running external command: cp /etc/X11/xorg.conf ${FSMNT}/etc/X11/xorg.conf
Running chroot command: echo "pc101 us altgr-intl" >/var/.wizardKeyboard
Running chroot command: newaliases
Running: mount -t devfs devfs /mnt/dev
Running: cp /boot/zfs/zpool.cache /mnt/boot/zfs/
Running: ln -s ../zfs /mnt/boot/kernel/zfs
Running: cp /etc/hostid /mnt/etc/hostid
Running: umount /mnt/dev
ZFS Unmount: vatertop/var/tmp
Running: zfs unmount vatertop/var/tmp
Running: zfs set mountpoint=/var/tmp vatertop/var/tmp
ZFS Unmount: vatertop/var/mail
Running: zfs unmount vatertop/var/mail
Running: zfs set mountpoint=/var/mail vatertop/var/mail
ZFS Unmount: vatertop/var/log
Running: zfs unmount vatertop/var/log
Running: zfs set mountpoint=/var/log vatertop/var/log
ZFS Unmount: vatertop/var/audit
Running: zfs unmount vatertop/var/audit
Running: zfs set mountpoint=/var/audit vatertop/var/audit
ZFS Unmount: vatertop/usr/src
Running: zfs unmount vatertop/usr/src
Running: zfs set mountpoint=/usr/src vatertop/usr/src
ZFS Unmount: vatertop/usr/ports
Running: zfs unmount vatertop/usr/ports
Running: zfs set mountpoint=/usr/ports vatertop/usr/ports
ZFS Unmount: vatertop/usr/obj
Running: zfs unmount vatertop/usr/obj
Running: zfs set mountpoint=/usr/obj vatertop/usr/obj
ZFS Unmount: vatertop/usr/local/share/doc
Running: zfs unmount vatertop/usr/local/share/doc
Running: zfs set mountpoint=/usr/local/share/doc vatertop/usr/local/share/doc
ZFS Unmount: vatertop/usr/jails
Running: zfs unmount vatertop/usr/jails
Running: zfs set mountpoint=/usr/jails vatertop/usr/jails
ZFS Unmount: vatertop/usr/home
Running: zfs unmount vatertop/usr/home
Running: zfs set mountpoint=/usr/home vatertop/usr/home
ZFS Unmount: vatertop/tmp
Running: zfs unmount vatertop/tmp
Running: zfs set mountpoint=/tmp vatertop/tmp
Unmounting: /mnt
Running: umount -f /mnt
Installation finished!

part-info_-dev-ada0p2

ZFS#/(compress=lz4|atime=off),/tmp(compress=lz4|setuid=off),/usr(canmount=off|mountpoint=none),/usr/home(compress=lz4),/usr/jails(compress=lz4),/usr/local/share/doc(compress=gzip),/usr/obj(compress=lz4),/usr/ports(compress=lz4),/usr/src(compress=lz4),/var(canmount=off|atime=on|mountpoint=none),/var/audit(compress=lz4),/var/log(compress=lz4|exec=off|setuid=off),/var/mail(compress=lz4),/var/tmp(compress=lz4|exec=off|setuid=off)#ON#zpool0#GPT#mirror /dev/ada0p2.eli /dev/ada2p2.eli

sys-install.cfg

# Auto-Generated pc-sysinstall configuration
installInteractive=no
installMode=fresh
installType=TrueOS
packageType=pkg
distFiles=base doc kernel lib32

zpoolName=vatertop
zfsForce4k=YES
netSaveDev=AUTO-DHCP-SLAAC
installMedium=local
localPath=/dist
 
# Disk setup for ada0
disk0=ada0
partition=ALL
bootManager=BSD
partscheme=GPT
commitDiskPart

# Partition Setup for ada0(ALL)
# All sizes are expressed in MB
# Avail FS Types, UFS, UFS+S, UFS+SUJ, UFS+J, ZFS, SWAP
# UFS.eli, UFS+S.eli, UFS+SUJ, UFS+J.eli, ZFS.eli, SWAP.eli
disk0-part=ZFS.eli 305230 /(compress=lz4|atime=off),/tmp(compress=lz4|setuid=off),/usr(canmount=off|mountpoint=none),/usr/home(compress=lz4),/usr/jails(compress=lz4),/usr/local/share/doc(compress=gzip),/usr/obj(compress=lz4),/usr/ports(compress=lz4),/usr/src(compress=lz4),/var(canmount=off|atime=on|mountpoint=none),/var/audit(compress=lz4),/var/log(compress=lz4|exec=off|setuid=off),/var/mail(compress=lz4),/var/tmp(compress=lz4|exec=off|setuid=off) (mirror: ada2)
encpass=das-ist-das-passwort-fuer-die-verschluesselung-des-massenspeichers-im-klartext
commitDiskLabel

runExtCommand=/root/save-config.sh
installPackages=misc/trueos-desktop x11/lumina sysutils/fusefs-ntfs www/firefox www/qupzilla-qt5 mail/thunderbird mail/trojita multimedia/vlc multimedia/openh264 multimedia/libdvdcss audio/pianobar x11-themes/cursor-jimmac-theme graphics/phototonic misc/trueos-meta-hunspell x11/qterminal graphics/xsane print/qpdfview print/cups-pdf print/cups-filters print/gutenprint x11-fonts/noto-lite x11-fonts/droid-fonts-ttf

runExtCommand=cp /root/defaultpkgbranch ${FSMNT}/root/defaultpkgbranch
runCommand=sh /usr/local/share/trueos/scripts/sys-init.sh desktop en_US
# Touch flags to enable TrueOS setup at first boot
runCommand=touch /var/.trueos-firstboot
runCommand=touch /var/.trueos-firstgui
runExtCommand=cp /etc/X11/xorg.conf ${FSMNT}/etc/X11/xorg.conf
runCommand=echo "pc101 us altgr-intl" >/var/.wizardKeyboard
runCommand=newaliases

mirroring[Bearbeiten]

Das Szenario
Es wird bei einer Maschine ein Spiegel vom Massenspeicher verwendet. Bei der Installation von TrueOS ist das ganz einfach auswählbar. TrueOS richtet das auch alles ein. (Aber was passiert da eigentlich?) Ferner geht es um das Nachvollziehen der durch pc-sysinstall durchgeführten Abläufe. Aber auch notwendige Wartungsarbeiten - etwa das #Ersetzen von einem Massenspeicher als Teil von einem mirror, sollen so "sauber" erledigt werden können.

Ersetzen von einem Massenspeicher als Teil von einem mirror[Bearbeiten]

Szenario
  • Eines der Geräte für Massenspeicher ist ausgefallen und muss ersetzt werden.
    Zum Testen dieses Szenario wurde TrueOS mit einem Spiegel für den Massenspeicher installiert.
    Theoretisch (und praktisch) funktioniert das auch bei einer standardmäßigen Installation von FreeBSD mit einem Spiegel für den Massenspeicher.
    Zum Testen wurde eines der Geräte für Massenspeicher einfach entfernt. (Es soll praktisch dargestellt werden, dass das Gerät für Massenspeicher "kaputt" wäre.)
    Zum Testen gibt es gleichwertiges Gerät für Massenspeicher, dass als Ersatz dienten soll.
Siehe auch

zpool status
  pool: vzfspool
 state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
        the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
   see: http://illumos.org/msg/ZFS-8000-2Q
  scan: scrub repaired 0 in 0h1m with 0 errors on Sun mm dd HH:MM:SS yyyy
config:

        NAME                     STATE     READ WRITE CKSUM
        vzfspool                 DEGRADED     0     0     0
          mirror-0               DEGRADED     0     0     0
            4561791786978147166  UNAVAIL      0     0     0  was /dev/ada0p2.eli
            ada1p2.eli           ONLINE       0     0     0

errors: No known data errors
sudo zpool online vzfspool 4561791786978147166
warning: device '4561791786978147166' onlined, but remains in faulted state
use 'zpool replace' to replace devices that are no longer present
zpool replace vzfspool 4561791786978147166
cannot open '4561791786978147166': no such GEOM provider
must be a full path or shorthand device name
zpool replace vzfspool /dev/ada0p2.eli
cannot open '/dev/ada0p2.eli': No such file or directory
sudo zpool detach vzfspool /dev/ada0p2.eli

zpool status
  pool: vzfspool
 state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
        the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
   see: http://illumos.org/msg/ZFS-8000-2Q
  scan: scrub repaired 0 in 0h1m with 0 errors on Sun mm dd HH:MM:SS yyyy
config:

        NAME                     STATE     READ WRITE CKSUM
        vzfspool                 DEGRADED     0     0     0
          mirror-0               DEGRADED     0     0     0
            4561791786978147166  UNAVAIL      0     0     0  was /dev/ada0p2.eli
            ada1p2.eli           ONLINE       0     0     0

errors: No known data errors
sudo zpool detach vzfspool /dev/ada0p2.eli

zpool status
  pool: vzfspool
 state: ONLINE
  scan: scrub repaired 0 in 0h1m with 0 errors on Sun mm dd HH:MM:SS yyyy
config:

        NAME          STATE     READ WRITE CKSUM
        vzfspool      ONLINE       0     0     0
          ada1p2.eli  ONLINE       0     0     0

errors: No known data errors
gpart show
=>       34  976773101  ada0  GPT  (466G)
         34       2014        - free -  (1.0M)
       2048  976771072     1  linux-data  (466G)
  976773120         15        - free -  (7.5K)

=>       40  976773088  ada1  GPT  (466G)
         40        512     1  freebsd-boot  (256K)
        552  934799360     2  freebsd-zfs  (446G)
  934799912   41943040     3  freebsd-swap  (20G)
  976742952      30176        - free -  (15M)
gpart backup ada1
GPT 152
1   freebsd-boot        40       512  
2    freebsd-zfs       552 934799360  
3   freebsd-swap 934799912  41943040  
gpart backup ada1 | gpart restore -F ada0
gpart backup ada1 | gpart restore -F ada0
gpart show
=>       40  976773088  ada0  GPT  (466G)
         40        512     1  freebsd-boot  (256K)
        552  934799360     2  freebsd-zfs  (446G)
  934799912   41943040     3  freebsd-swap  (20G)
  976742952      30176        - free -  (15M)

=>       40  976773088  ada1  GPT  (466G)
         40        512     1  freebsd-boot  (256K)
        552  934799360     2  freebsd-zfs  (446G)
  934799912   41943040     3  freebsd-swap  (20G)
  976742952      30176        - free -  (15M)
zpool status
  pool: vzfspool
 state: ONLINE
  scan: scrub repaired 0 in 0h1m with 0 errors on Sun mm dd HH:MM:SS yyyy
config:

        NAME          STATE     READ WRITE CKSUM
        vzfspool      ONLINE       0     0     0
          ada1p2.eli  ONLINE       0     0     0

errors: No known data errors
ls /dev/ | grep ada

zpool attach vzfspool /dev/ada1 /dev/ada0
cannot attach /dev/ada0 to /dev/ada1: no such device in pool
geli backup /dev/ada1p2 ~/geli.backup

sudo geli restore ~/geli.backup /dev/ada0p2

ls /dev | grep ada
ada0
ada0p1
ada0p2
ada0p3
ada1
ada1p1
ada1p2
ada1p2.eli
ada1p3
geli attach /dev/ada0p2
Enter passphrase: 
geli status
     
           Name  Status  Components
     ada1p2.eli  ACTIVE  ada1p2
label/swap0.eli  ACTIVE  label/swap0
     ada0p2.eli  ACTIVE  ada0p2
ls /dev | grep ada
ada0
ada0p1
ada0p2
ada0p2.eli
ada0p3
ada1
ada1p1
ada1p2
ada1p2.eli
ada1p3
Hinzufügen Ersetzen
sudo zpool attach vzfspool /dev/ada0p2.eli /dev/ada1p2.eli
Make sure to wait until resilver is done before rebooting.

If you boot from pool 'vzfspool', you may need to update
boot code on newly attached disk '/dev/ada1p2.eli'.

Assuming you use GPT partitioning and 'da0' is your new boot disk
you may use the following command:

        gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0p1
gpart: No such geom: ada0p1.
sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada0
partcode written to ada0p1
bootcode written to ada0
sudo zpool attach vzfspool /dev/ada1p2.eli /dev/ada0p2.eli
invalid vdev specification
use '-f' to override the following errors:
/dev/ada0p2.eli is part of active pool 'vzfspool'
sudo zpool attach vzfspool /dev/ada0p2.eli /dev/ada1p2.eli
invalid vdev specification
use '-f' to override the following errors:
/dev/ada0p2.eli is part of active pool 'vzfspool'
zpool status
  pool: vzfspool
 state: ONLINE
  scan: resilvered 12.3G in 0h1m with 0 errors on Sun mm dd HH:MM:SS yyyy
config:

        NAME            STATE     READ WRITE CKSUM
        vzfspool        ONLINE       0     0     0
          mirror-0      ONLINE       0     0     0
            ada1p2.eli  ONLINE       0     0     0
            ada0p2.eli  ONLINE       0     0     0

errors: No known data errors
sudo zpool replace zopt 4561791786978147166 /dev/ada0p2.eli
Make sure to wait until resilver is done before rebooting.

If you boot from pool 'vzfspool', you may need to update
boot code on newly attached disk '/dev/ada0p2.eli'.

Assuming you use GPT partitioning and 'da0' is your new boot disk
you may use the following command:

        gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
partcode written to ada0p1
bootcode written to ada0
zpool status
  pool: vzfspool
 state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Sun mm dd HH:MM:SS yyyy
        6.15G scanned out of 12.3G at 32.1M/s, 0h1m to go
        6.15G resilvered, 50.00% done
config:

        NAME                       STATE     READ WRITE CKSUM
        zopt                       DEGRADED     0     0     0
          mirror-0                 DEGRADED     0     0     0
            replacing-0            OFFLINE      0     0     0
              4561791786978147166  OFFLINE      0     0     0  was /dev/ada0
              ada0p2.eli           ONLINE       0     0     0
            ada1p2.eli             ONLINE       0     0     0

errors: No known data errors
zpool status
  pool: vzfspool
 state: ONLINE
  scan: resilvered 12.3G in 0h2m with 0 errors on Sun mm dd HH:MM:SS yyyy
config:

        NAME            STATE     READ WRITE CKSUM
        vzfspool        ONLINE       0     0     0
          mirror-0      ONLINE       0     0     0
            ada1p2.eli  ONLINE       0     0     0
            ada0p2.eli  ONLINE       0     0     0

errors: No known data errors


Notizen

dd if=/dev/ada1p1 of=/dev/ada0p1

Ersetzen von einem Massenspeicher als Teil von einem mirror "pc-sysinstall stlyle"[Bearbeiten]

pc-sysinstall
create replace

Zerstören aller möglichen Einträge zur Partitionierung

Running: gpart destroy -F /dev/ada0
gpart: arg0 'ada0': Invalid argument
Running: zpool labelclear -f /dev/ada0
failed to read label from /dev/ada0
Running: gpart create -s gpt /dev/ada0
ada0 created
Running: gpart destroy -F /dev/ada0
ada0 destroyed
Clearing gpt backup table location on disk
Running: dd if=/dev/zero of=/dev/ada0 bs=1m count=1
1+0 records in
1+0 records out
1048576 bytes transferred in 0.046040 secs (22775338 bytes/sec)
Running: dd if=/dev/zero of=/dev/ada0 bs=1m oseek=305241
dd: /dev/ada0: short write on character device
dd: /dev/ada0: end of device
5+0 records in
4+1 records out
4546560 bytes transferred in 0.082831 secs (54889445 bytes/sec)

(neue) Partitionstabelle erstellen

Running gpart on /dev/ada0
Running: gpart create -s GPT -f active /dev/ada0
ada0 created

Tätigkeit

Running: gpart add -s 512 -t freebsd-boot /dev/ada0
ada0p1 added
Stamping boot sector on /dev/ada0
Running: gpart bootcode -b /boot/pmbr /dev/ada0
bootcode written to ada0

???

Looping through _zvars: /dev/ada0p2
Looping through _zvars: /dev/ada2

weiteren Massenspeicher für den Spiegel gleichermaßen behandeln

Setting up ZFS disk /dev/ada2
kern.geom.debugflags: 16 -> 16
kern.geom.label.disk_ident.enable: 0 -> 0
Deleting all gparts
Running: gpart destroy -F /dev/ada2
gpart: arg0 'ada2': Invalid argument
Running: zpool labelclear -f /dev/ada2
failed to read label from /dev/ada2
Running: gpart create -s gpt /dev/ada2
ada2 created
Running: gpart destroy -F /dev/ada2
ada2 destroyed
Clearing gpt backup table location on disk
Running: dd if=/dev/zero of=/dev/ada2 bs=1m count=1
1+0 records in
1+0 records out
1048576 bytes transferred in 0.046489 secs (22555159 bytes/sec)
Running: dd if=/dev/zero of=/dev/ada2 bs=1m oseek=305241
dd: /dev/ada2: short write on character device
dd: /dev/ada2: end of device
5+0 records in
4+1 records out
4546560 bytes transferred in 0.075279 secs (60396406 bytes/sec)
Running gpart on /dev/ada2
Running: gpart create -s GPT -f active /dev/ada2
ada2 created
Running: gpart add -s 512 -t freebsd-boot /dev/ada2
ada2p1 added
Stamping boot sector on /dev/ada2
Running: gpart bootcode -b /boot/pmbr /dev/ada2
bootcode written to ada2
Running: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada2
partcode written to ada2p1
bootcode written to ada2
Running: gpart add -a 4k -s 305230M -t freebsd-zfs /dev/ada0
ada0p2 added

Übernehmen von den Eingenschaften für ZFS für die Partition vom weiteren Massenspeicher für den Spiegel

Cloning disk layout to ZFS disk /dev/ada2
Running: gpart add -a 4k -s 305230M -t freebsd-zfs /dev/ada2
ada2p2 added

???

Running: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada0
partcode written to ada0p1
bootcode written to ada0

Verschlüsseln vom ersten Massenspeicher

Creating geli provider for /dev/ada0p2
Running: geli init -g -b -J /tmp/.pc-sysinstall/part-info-enc/-dev-ada0p2-encpass /dev/ada0p2

Metadata backup can be found in /var/backups/ada0p2.eli and
can be restored with the following command:

        # geli restore /var/backups/ada0p2.eli /dev/ada0p2

Running: geli attach -j /tmp/.pc-sysinstall/part-info-enc/-dev-ada0p2-encpass /dev/ada0p2

Verschlüsseln vom weiteren Massenspeicher

Setting up GELI on mirrored disks: /dev/ada2p2
Running: geli init -g -b -J /tmp/.pc-sysinstall/part-info-enc/-dev-ada0p2-encpass /dev/ada2p2

Metadata backup can be found in /var/backups/ada2p2.eli and
can be restored with the following command:

        # geli restore /var/backups/ada2p2.eli /dev/ada2p2

Running: geli attach -j /tmp/.pc-sysinstall/part-info-enc/-dev-ada0p2-encpass /dev/ada2p2

???

NEWFS: /dev/ada0p2 - ZFS

Erstellen vom Pool

Creating storage pool vzfspool with mirror /dev/ada0p2.eli /dev/ada2p2.eli
Running: zpool create -m none -f vzfspool mirror /dev/ada0p2.eli /dev/ada2p2.eli