FreeBSD kasutamine töökohaarvutis

Allikas: Imre kasutab arvutit
Mine navigeerimisribaleMine otsikasti

Sissejuhatus

TODO

Tööpõhimõte

Root-on-ZFS viilisel paigaldatud FreeBSD arvuti plokkseadmele moodustatakse GPT partitsioonitabel

root@ubuntu-server:~# fdisk /dev/sda -l
Disk /dev/sda: 32 GiB, 34359738368 bytes, 67108864 sectors
Disk model: QEMU HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E29CD194-A59F-11EB-BE47-25E51CD972F4

Device       Start      End  Sectors  Size Type
/dev/sda1       40   532519   532480  260M EFI System
/dev/sda2   532520   533543     1024  512K FreeBSD boot
/dev/sda3   534528  4728831  4194304    2G FreeBSD swap
/dev/sda4  4728832 67106815 62377984 29.7G FreeBSD ZFS

kus

  • TODO

ZFS failisüsteemi kasutamine Linux töökohaarvutist

Nt eriolukorras kui FreeBSD iseseisvalt ei käivitu saab zfs andmetele ligi selliselt

  • kopeerida internetist tavaline nt Ubuntu v. 21.10 live-server-image .iso fail
  • käivitada ubuntu abil freebsd arvuti nn live režiimis
  • importida zfs failisüsteemid, monteerides altroot kataloogi suhtes
# zpool import -o altroot=/mnt -f zroot

Tulemusena on failisüsteemnid moniteeritud ja kasutatavad

root@ubuntu-server:~# findmnt -t zfs
TARGET                SOURCE                  FSTYPE OPTIONS
/mnt/tmp              zroot/tmp               zfs    rw,nosuid,noatime,xattr,noacl
/mnt/zroot            zroot                   zfs    rw,noatime,xattr,noacl
/mnt/var/crash        zroot/var/crash         zfs    rw,nosuid,noexec,noatime,xattr,noacl
/mnt/usr/home         zroot/usr/home          zfs    rw,noatime,xattr,noacl
/mnt/usr/ports        zroot/usr/ports         zfs    rw,nosuid,noatime,xattr,noacl
/mnt/var/audit        zroot/var/audit         zfs    rw,nosuid,noexec,noatime,xattr,noacl
/mnt/var/tmp          zroot/var/tmp           zfs    rw,nosuid,noatime,xattr,noacl
/mnt/usr/src          zroot/usr/src           zfs    rw,noatime,xattr,noacl
/mnt/var/log          zroot/var/log           zfs    rw,nosuid,noexec,noatime,xattr,noacl
/mnt/var/mail         zroot/var/mail          zfs    rw,xattr,noacl
...

Kasutamise lõpetamiseks sobib öelda

# zpool export zroot

Paistab, et nii kasutamine ei sega seejärel FreeBSD kasutamist tavalisel viisil.

GPT partitsioonitabeli parandamine

Enne

# dmesg | grep GEOM
GEOM: ada0: the secondary GPT header is not in the last LBA.

# gpart show ada0
=>       3  10552571  ada0  GPT  (5.0G) [CORRUPT]
         3       127     1  freebsd-boot  (64K)
       130     66584     2  efi  (33M)
     66714   2097152     3  freebsd-swap  (1.0G)
   2163866   8388708     4  freebsd-ufs  (4.0G)

Parandamine

# gpart recover ada0

Pärast

# gpart show ada0
=>       3  10552571  ada0  GPT  (5.0G)
         3       127     1  freebsd-boot  (64K)
       130     66584     2  efi  (33M)
     66714   2097152     3  freebsd-swap  (1.0G)
   2163866   8388708     4  freebsd-ufs  (4.0G)

ZFS failisüsteemi vigade parendamine

root@freebsd-tk:~ # zpool status -v
  pool: zroot
 state: ONLINE
status: One or more devices has experienced an error resulting in data
	corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
	entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub repaired 0B in 00:00:35 with 1 errors on Sun May 22 12:09:28 2022
config:

	NAME        STATE     READ WRITE CKSUM
	zroot       ONLINE       0     0     0
	  vtbd0p4   ONLINE       0     0    12

errors: Permanent errors have been detected in the following files:

        //usr/local/llvm12/lib/libLLVMMCParser.a

ja

root@freebsd-tk:~ # ls -ld /usr/local/llvm12/lib/libLLVMMCParser.a
-rw-r--r--  1 root  wheel  1016274 Apr 12 05:47 /usr/local/llvm12/lib/libLLVMMCParser.a

root@freebsd-tk:~ # md5sum  /usr/local/llvm12/lib/libLLVMMCParser.a
md5sum: /usr/local/llvm12/lib/libLLVMMCParser.a: Input/output error

saadakse teada millise paketi koosseisu kõnealune fail kuulub ja reinstallitakse vastav pakett

root@freebsd-tk:~ # pkg which /usr/local/llvm12/lib/libLLVMMCParser.a
/usr/local/llvm12/lib/libLLVMMCParser.a was installed by package llvm12-12.0.1_9 

root@freebsd-tk:~ # pkg upgrade -f llvm12

root@freebsd-tk:~ # md5sum  /usr/local/llvm12/lib/libLLVMMCParser.a
2498037054a5c71c52734e5956f236a3  /usr/local/llvm12/lib/libLLVMMCParser.a

Nüüd on aga see probleem paistab välja nii

root@freebsd-tk:~ # zpool status -v
  pool: zroot
 state: ONLINE
status: One or more devices has experienced an error resulting in data
	corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
	entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub repaired 0B in 00:00:35 with 1 errors on Sun May 22 12:09:28 2022
config:

	NAME        STATE     READ WRITE CKSUM
	zroot       ONLINE       0     0     0
	  vtbd0p4   ONLINE       0     0    14

errors: Permanent errors have been detected in the following files:

        zroot/ROOT/default:<0x356da>

Tundub, et selle vastu aitab

# zpool scrub zroot
# zpool status -v (kuni on tehtud)
# zpool clear zroot

Tulemus peaks olema ilus

root@freebsd-tk:~ # zpool status -v
  pool: zroot
 state: ONLINE
  scan: scrub repaired 0B in 00:00:38 with 0 errors on Sun May 22 13:37:43 2022
config:

	NAME        STATE     READ WRITE CKSUM
	zroot       ONLINE       0     0     0
	  vtbd0p4   ONLINE       0     0     0

errors: No known data errors

AMD RX 550 videokaardi kasutamine

MÄRKUS: järgnev lähenemine toimib 2022 aasta lõpus proxmox v. 7.3 gpu passthru tingimustes

root@freebsd-tk:~ # pkg install drm-kmod

...

Message from drm-510-kmod-5.10.113_7:

--
The drm-510-kmod port can be enabled for amdgpu (for AMD
GPUs starting with the HD7000 series / Tahiti) or i915kms (for Intel
APUs starting with HD3000 / Sandy Bridge) through kld_list in
/etc/rc.conf. radeonkms for older AMD GPUs can be loaded and there are
some positive reports if EFI boot is NOT enabled (similar to amdgpu).

For amdgpu: kld_list="amdgpu"
For Intel: kld_list="i915kms"
For radeonkms: kld_list="radeonkms"

Please ensure that all users requiring graphics are members of the
"video" group.

Tulemusena paigaldatakse fail

 root@freebsd-tk:~ # find / -name amdgpu.ko
 /boot/modules/amdgpu.ko

Nagu paigaldamise järel õpetatakse, peab /etc/rc.conf failis olema rida

root@freebsd-tk:~ # grep amdgpu /etc/rc.conf
kld_list="amdgpu"

Kasulikud lisamaterjalid

  • TODO