Autres
AideEnLigne
CahierDeBrouillon
Présentation
Administration

MesLectures
[Articles publiés]
[Blog Affordance]
[LibreOffice en ligne]
[Journal d'Ophelia]
[Kim Khal]

Informations
[Rue 89]

DNS etc
[Robtex]
Logins
Votre ID: 111
Nom:
Login utilisateur
Mot de passe éditeur

ComputingFreeBSD

Différence (depuis la version majeure précédente) (modification mineure)

Ajouté: 284a285
:Using ZFS inside a jail https://github.com/DtxdF/AppJail/wiki/zfs

Ajouté: 317a319
:Nexcloud on FreeBSD? 13 https://vermaden.wordpress.com/2018/04/04/nextcloud-13-on-freebsd/

Modifié: 537c539
..
..

Modifié: 539c541
**If the ports are not yet installed (first install of FreeBSD?), update the "port collection" with this portsnap command:
**OBSOLETE If the ports are not yet installed (first install of FreeBSD?), update the "port collection" with this portsnap command:

Modifié: 543,544c545,553
**If Ports are already installed, only update ports:
#portsnap fetch update
** NOTE: portsnap is obsolete. Now git is preferred tool for ports install & update
#pkg install git
#git clone https://git.FreeBSD.org/ports.git /usr/ports

-and update the ports when needed
#git -C /usr/ports pull

Before upgrading take a look at the content of /usr/ports/UPDATING and follox instructions, if ever.


Effacé: 572,576d580
**Autre méthode de mise a jour avec portupgrade: (NB: Portupgrade depend de Ruby !!)
#/usr/local/sbin/pkgdb -Ff
#cd /usr/ports
#portupgrade -o lang/perl5.12 -f perl5.10.\*


Modifié: 588c592
-- Cmic maj 2016-11-08 11:29:06
-- 2024-01-31T21:32:15 maj -- Cmic maj 2016-11-08 11:29:06

Ajouté: 709a714
:ZFS nfsv3 nfsv4 server and client and autofs https://geekandnix.com/freebsd/install-nfs/

FreeBSD?, OpenBSD?, etc. Installations, tricks & tips

+Disk usage, gpart, RAID, etc.
  • list all available disks

 # camcontrol devlist
 <ST3120026AS 8.05>                 at scbus0 target 0 lun 0 (pass0,ada0)
 <MAXTOR STM3250310AS 3.AAF>        at scbus1 target 0 lun 0 (pass1,ada1)
 <Maxtor 6Y120P0 YAR41BW0>          at scbus2 target 0 lun 0 (pass2,ada2)
 <TSSTcorp CD/DVDW SH-S182M SB02>   at scbus3 target 0 lun 0 (pass3,cd0)

  • voir aussi diskinfo -v

gpart cheat chart (summary)

  • create A GPT disk:
 root@zany:/home/cmic #gpart create -s GPT ada2
 ada2 created

"gpart create" crée une table de partition du disque (ou d'une partition !) selon un scheme (BSD, MBR, GPT, ..). On peut alors creer des partitions avec gpart add. Dans chacune de ces partitions on peut alors, à nouveau, créer une table de partition selon une scheme donné, etc.

Traditionnelement, on crée des slices dans une table MBR, mais on peut également le faire en GPT. Cela donne alors des partitions ada2p1a, ada2p1b, ...ada2p2a, etc.

 gpart create -s gpt ada1 ; add -t freebsd     => slices: ada1s1
 gpart create -s gpt ada1 ; add -t freebsd-ufs => part:   ada1p1
 gpart create -s bsd ada1 ; add -t freebsd-ufs => part;   ada1a
 gpart create -s mbr ada1 ; add -t freebsd     => slices: ada1s1

 root@zany:/home/cmic # gpart add -t freebsd-ufs -s 12GB ada2
 ada2p1 added
 root@zany:/home/cmic # gpart show -p ada2
 =>       40  240121648    ada2  GPT  (114G)
          40   25165824  ada2p1  freebsd-ufs  (12G)
    25165864  214955824          - free -  (102G)

  • formatting the partition and mounting it
 root@zany:/home/cmic #newfs /dev/ada2p1  #filesystem-type default is UFS2
 ...
 root@zany:/home/cmic #mount /dev/ada2p1 /mnt

    • Or you can label the disk and mount it:

 root@zany:~ # glabel label mypart1 ada1p1
 root@zany:~ # newfs -Uj /dev/label/mypart1
 root@zany:~ # mount /dev/label/mypart1 /mnt

  • recovering a corrupted disk (gpart shows: adaN "...GPT (114G) [CORRUPT]")
 #gpart recover adaN

Add a disk

  • le disque systeme est en ada0, le disque supplémentaire en ada1.
 Faire : gpart show ada1 pour voir l'état des partitions

  • supprimer les partitions existantes, puis le label
 gpart delete -i 1 ada1
 gpart delete -i 2 ada1
 ...
 gpart destroy ada1

  • facultativement on peut créer un disque GUID:
 gpart create -s GPT ada1
  • créer une partition sur tout le disque (sinon il faut dimensionner)
 gpart add -t freebsd-ufs ada1
  • puis formater (ya pas de slices !)
 newfs ada1p1

Soft RAID 0

  • gstripe permet de creer un RAID 0 avec 2 ou plusieurs disques. (handbook 18.1)
  • Ex: avec 2 disques de 500GB /dev/ad1 et /dev/ada2 et 1 disque de 160GB /dev/ada3

 #kldload geom_stripe                              #charger le module gstrip
 #gstripe label -v st0 /dev/ada1 /dev/ada2         #resulting disc /dev/stripe/st0 is less than 1TB
 #gconcat label -v disk /dev/stripe/st0 /dev/ada3  

  • On obtient un disque de ~960GB. On peut alors utiliser gpart, puis mkfs, puis growfs si c'est du UFS, etc.

Soft RAID 1

  • gmiror permet de créer un RAID 1 de 2 ou plusiruers disques.
  • la taille totale sera egale à la taille du plus petit disque
  • On recommande ne pas creer de disque GPT car GPT et gmirror stockent tou les deux des infos en fin de disque.
  • on a 2 disques: ada1 de 160GB et ada2 de 500G

 #gmirror load
 #gmirror label -v gm1 dev/ada1 /dev/ada2
 Metadata value stored on /dev/ada1.
 Metadata value stored on /dev/ada2.
 Done.

  • on cree donc un disque MBR (pas GPT, voir ci-dessus). On note que mirro/gm1 fait 149 GB , taille du plus petit des 2 disques

 #gpart create -s MBR mirror/gm1
 mirror/gm1 created
 # gpart add -t freebsd mirror/gm1
 ..
  • creation d'une partition BSD, *puis d'une slice freebsd

 # gpart create -s BSD mirror/gm1s1
 ..
 #gpart add -t freebsd mirror/gm1s1
 ..
 #gpart show -p mirror/gm1
 =>       63  312581744    mirror/gm1  MBR  (149G)
          63          1                - free -  (512B)
          64  312581736  mirror/gm1s1  freebsd  (149G)
   312581800          7   

  • utilisation: newfs, mount, cp files, etc...

 #newfs -Uj /dev/mirror/gm1s1 && mount /dev/mirror/gm1s1 /mnt && cp -r /usr/local/bin /mnt 

  • ajouter dans fstab et charger le module dans /boot/loader.conf

 #cat fstab 
 /dev/mirror/gm1s1        /mnt            ufs     rw      0       0
 #cat /boot/loader.conf
 geom_mirror_load="YES"
 ..

  • reboot pour verifier que l'on retrouve mirror/gm1s1 monté sur /mnt
  • scenari d'une panne: ada2 fait défaut, on ajoute des fichiers sur gm1s1. puis on insère à nouveau ada2
  • il ya synchronisation du mirroir.

 #gmirror remove gm1 ada2
 .. ajout de fichiers sur /mtn (c.a.d. /dev/mirror/gm1s1)
 #gmirror insert gm1 ada2
 ..
 #gmirror status
       Name    Status  Components
 mirror/gm1  DEGRADED  ada1 (ACTIVE)
                       ada2 (SYNCHRONIZING, 4%)

+FreeBSD? 11 and X11, Xorg, KMS, etc.
+Installer minidlna

Ai voulu installer minidlna. ai été obligé d'upgrader plein de paquets. Et puis des paquets ont été effacés (Grrr !) J'ai du réinstaller emacs24 (/usr/ports/editors/emacs), mais libiconv.la (la <=> libtool archive) avait été supprimée.

NB: les libtool archives (.la) sont abandonnés dans les nouvelles versions de FreeBSD?

1- chercher les dépendances de libiconv.la

 #find /usr/local/lib -name '*.la' | xargs grep -l 'libiconv.la' | xargs pkg which
 /usr/local/lib/libxml2.la was installed by package libxml2-2.8.0_3
 /usr/local/lib/libwmf.la was installed by package libwmf-0.2.8.4_10
 /usr/local/lib/libcddb.la was installed by package libcddb-1.3.2_2
 /usr/local/lib/libcdio.la was installed by package libcdio-0.83_2
 /usr/local/lib/libcdio++.la was installed by package libcdio-0.83_2
 /usr/local/lib/libcdio_cdda.la was installed by package libcdio-0.83_2
 /usr/local/lib/libcdio_paranoia.la was installed by package libcdio-0.83_2
 /usr/local/lib/libiso9660.la was installed by package libcdio-0.83_2
 /usr/local/lib/libiso9660++.la was installed by package libcdio-0.83_2
 /usr/local/lib/libudf.la was installed by package libcdio-0.83_2

2- faire un rebuild de tous les packages trouvés

Il faut alors reconstruire tout ces paquets avec portmaster:

 #portmaster libxml2
 ...
 #portmaster libwmf
 ...
  etc

3- puis refaire un make emacs

Ensuite relancer le port emacs. Si erreur, recommencer la procédure ci-dessus..

+Installation
10 things to do after installation https://bastillebsd.org/blog/2022/07/14/ten-things-to-do-after-installing-freebsd/

NB: /usr/sbin/sysinstall has been removed since 10.0. Replaced by bsdconfig and bsdinstall.

Install normale...

    • pkgNG FIXME

pkg_add -r emacs # -r so pkg_add searches for the right version)
pkg_add -r xorg
pour Gnome : # pkg_install -r gnome puis : echo /usr/local/bin/gnome-session > ~/.xinitrc
pour Xfce4 : # pkg_add -r xfce4, puis echo startxfce4 > ~/.xinitrc

setenv PAKAGEROOT ftp://ftp3.fr.freebsd.org pour faire les package_add a partir de ce site

pkg_info -L < pkg_name

Pas de xorg.conf ? Le creer sous root :
 # Xorg -configure. Placer ensuite le fichier ~root/xorg.conf dans /etc/X11. 
Config du touchpad sur zazou (DELL latitude D600); http://wiki.freebsd.org/SynapticsTouchpad et suivre les instructions.
Installer aussi : xrootconsole xscreensaver Eterm
/etc/rc.conf overrides /etc/defaults/rc.conf. Faire les modifs dans ce dernier.

  • Ne pas lancer sendmail : #echo sendmail_enable="NO" > /etc/rc.conf
    • Ne pas lancer sendmail ni son listener : #echo sendmail_enable="NONE" > /etc/rc.conf

  • X11, souris et clavier. Avec Xorg et les version 7, on peut utiliser une de 2 solutions suivantes
    • sans hal : dans /etc/X11/xorg.conf :
 Section "serverLayout"
 .. 
  Option "AutoAddDevices?" "off"
 ..
 Section "InputDevice?"
  Identifier "mouse0"
  Driver,"mouse"
  Option "protocol' "auto"
  option "device" "/dev/sysmouse"
 ..
 Section "InputDevice?"
  Identifier "Keyboard0"
  Option "KbModel?" "PC105"
  Option "xkbVariant" "latin9"
  Option "Xkblayout" "fr"
 ..

    • avec hal :

dans xorg.conf, modifier la section ServerLayout?

 Section "serverLayout"
   .. 
   Option "AutoAddDevices?" "on"

dans /etc/rc.conf, ajouter les 2 lignes suivantes :

 dbus_enable="YES"
 hald_enable="YES"

puis recopier :

 #cp /usr/local/share/hal/fdi/policy/10osvendor/10-x11-input.fdi /usr/local/etc/hal/fdi/policy

Dans le fichier recopié, modifier ensuite les lignes :

 <merge key="input.xkb.Layout" type="string">fr</merge>
 <merge key="input.xkb.Variant" type="string">latin9</merge>
 <merge key="input.xkb.Option" type="string">compose:rwin</merge>

enfin redemarrer hald et dbus

 #service hald start
 #service dbus start

<2009-11-18 14:08:04 cmic> fixed on 2014-04-16 17:31:24

Installation de flashplayer (sur FreeBSD? 8.0 release)

En fait il faut installer l'emulateur Linux (c'est un gros port) et ensuite le plugin linux flashplayer pour le Web Browser. Chaque utilisateur doit charger le plugin avec la commande :

 prompt>nspluginwrapper -v -a i

On peut alors vérifier les plugins chargés en tapant "about:plugins" dans la barre d'adresse de FF par exemple.

Toutes infos ici : http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/desktop-browsers.html

-- Cmic 2010-07-07 21:53:46

Installation Carte son

Je ne sais pas le type de la carte installée (DELL D600). alors je charge tous les drivers son:

 #kldload snd_driver

et je vérifie avec kldstat, puis avec dmesg et enfin je verifie le pîlote installé :

 #cat /dev/sndstat
 FreeBSD? Audio Driver (newpcm: 32 bit 2009061500/i386)
 Installed devices:
 pcm0: <Intel ICH4 (82801DB)>
 at io 0xf4fff800 irq9 bufsz 16384 kld snd_ich [MPSAFE] 
 (1p:1v/1r:1v channels duplex default)

Manuel FreeBSD? Install parag. 7.2

-- Cmic 2010-07-08 19:04:17

+Jails & vms
Using ZFS inside a jail https://github.com/DtxdF/AppJail/wiki/zfs
FreeBSD? 12 VNET jail with NFS https://www.cyberciti.biz/faq/configuring-freebsd-12-vnet-jail-using-bridgeepair-zfs/#Test_your_setup
using ZFS inside a jail with appjail https://github.com/DtxdF/AppJail/wiki/zfs
Another framework to create jails (sh and C) https://github.com/DtxdF/AppJail And appjail docs https://appjail.readthedocs.io/en/latest/
Jail tutorial classic, VNET, thin provisioning https://vermaden.wordpress.com/2023/06/28/freebsd-jails-containers/
Bhyve virtualization https://vermaden.wordpress.com/2023/08/18/freebsd-bhyve-virtualization/
Bhyve tutorial https://github.com/churchers/vm-bhyve
Bastille templates for jails https://byte-sized.de/linux-unix/bastille-templates-fuer-freebsd-jails/#english
FreeBSD? jails using vnet a free paper: https://rderik.gumroad.com/l/uwOLZ
Jails SANE conf. papers [implementation security, ..] https://docs.freebsd.org/44doc/papers/jail/jail.html
A tool (script) to create jails [not tested] https://github.com/cieplak/jz
Bastille networking [loopback, LAN, VNET] https://bastillebsd.org/blog/2020/02/17/bastille-networking-in-depth/
Bastille getting started https://bastillebsd.org/getting-started/
FreeBSD? Jails with ZFS and Vnet https://randomnixfix.wordpress.com/2022/01/15/freebsd-13-0-base-jails-with-zfs-and-vnet/
VNET Jails with iocage https://www.ccammack.com/posts/create-vnet-jails-in-freebsd-12-using-iocage/
Route and Firewall vlan https://klarasystems.com/articles/routing-and-firewalling-vlans-with-freebsd/
Virtualize network with VNET https://klarasystems.com/articles/virtualize-your-network-on-freebsd-with-vnet/
A jail setup w/ vnet: https://briskreader.com/read?link=https://blog.uidrafter.com/engineering/freebsd-jails-network-setup
VNET jail howto https://antranigv.am/weblog_en/posts/vnet-jail-howto/
Runnig a Webserver in Jail https://rderik.com/notes/running-a-web-server-on-freebsd-inside-a-jail/
Installing Jails and VNET [many different VNET configs] https://genneko.github.io/playing-with-bsd/system/learning-notes-on-jails/
A jail (FreeBSD? 12) with ZFS and VNET https://www.cyberciti.biz/faq/configuring-freebsd-12-vnet-jail-using-bridgeepair-zfs/
idem. https://sxi.io/how-to-configure-a-freebsd-jail-with-vnet-and-zfs/
CloneOS? for FreeBSD? jails https://clonos.tekroutine.com/
Iocage tutorial https://dan.langille.org/2015/03/07/getting-started-with-iocage-for-jails-on-freebsd/
Iocage and Ezjail tutorials in FreeBSDJournal?-2019-07.pdf
Creating a jail with VNET and ZFS https://www.cyberciti.biz/faq/how-to-configure-a-freebsd-jail-with-vnet-and-zfs/
Creating a jail with VNET and ZFS https://www.reddit.com/r/freebsd/comments/ahdbbq/howto_jails_freebsd_12_vnet_zfs/
A script to administer a jail https://github.com/bwmarrin/jcmd
Crer une jail avec iocage https://utux.fr/index.php?article180/jouons-avec-iocage
FreeBSD? introduction to jails https://www.skyforge.at/posts/an-introduction-to-jails-and-jail-networking/
Install FreeBSD? Jails the hard way https://clinta.github.io/freebsd-jails-the-hard-way/
+Misc
Nexcloud on FreeBSD? 13 https://vermaden.wordpress.com/2018/04/04/nextcloud-13-on-freebsd/
Wireguard on FreeBSD? https://vlads.me/post/create-a-wireguard-server-on-freebsd-in-15-minutes/ and https://www.zenarmor.com/docs/network-security-tutorials/how-to-install-wireguard-on-freebsd
How to reboot FreeBSD? a hardway in case a awry filesystem: sysctl debug.kbd.panic=1
FreeBSD? Architecture Handbook http://docs.freebsd.org/en/books/arch-handbook
FreeBSD? Performance Observability tools [gstat, iostat, dtrace, vm, ..] https://klarasystems.com/articles/freebsd-performance-observability/
Hardware info base [find a driver for X] https://bsd-hardware.info/
FreeBSD? Journal https://www.freebsdfoundation.org/journal/browser-based-edition/
FreeBSD? on USB key or on HD http://nomadbsd.org/
utilisation de cpdup on FreeBSD? ?
FreeBSD? pf manual http://home.nuug.no/~peter/pf/en/unrouteables.html
A silent FreeBSD? Server DIY https://vermaden.wordpress.com/2019/04/03/silent-fanless-freebsd-server-redundant-backup/
Backup with ZFS and mbuffer and ssh w/ ZnapZend?: http://www.znapzend.org/
Power management [lots of usefull commands] article https://vermaden.wordpress.com/2018/11/28/the-power-to-serve-freebsd-power-management/
OpenBSD? Journal [with archives] https://undeadly.org/cgi?action=front
FreeBSD? Architecture handbook https://www.freebsd.org/doc/en/books/arch-handbook/index.html
A redundant load-balancing firewall system, using FreeBSD? http://redundancy.redundancy.org/fbsd_lb.html
All FreeBSD? sources [from BSD 4 to FreeBSD? 11.x] https://svnweb.freebsd.org/base
Disk setup on FreeBSD? [BPT, MBR, UEFI boot] http://www.wonkity.com/~wblock/docs/html/disksetup.html
FreeBSD? UEFI root ZFS ans Windows install with http://kev009.com/wp/2016/07/freebsd-uefi-root-on-zfs-and-windows-dual-boot/
Creating a Wifi Access Point (WAP) witg FreeBSD? https://calomel.org/freebsd_wireless_access_point.html
A FreeBSD? 11 Desktop How-to, a complete article https://cooltrainer.org/a-freebsd-desktop-howto/
L'auto-hébergement facile et sécurisé avec OpenBSD? https://yeuxdelibad.net/ah/
many articles [writing rc, etc] https://www.freebsd.org/doc/en/articles/
Soft update article [and ref to PDF paper] https://lwn.net/Articles/339337/
Cloning a live FreeBSD? ZFS system [and other ZFS admin tasks] http://daemon-notes.com/articles/system/zfs-maintenance/clonezfs
cflags to make files undeletables [linux chattr] man chflags(1)
Installation, gestion, trucs et astuces sur OpenBSD? http://obsd4a.net/wiki/doku.php?id=start
installation FreeBSD? http://olivier.cochard.me/bidouillage/installation-et-configuration-de-freebsd-comme-poste-de-travail
DragonFly BSD Handbook http://www.dragonflybsd.org/docs/newhandbook/
OpenBSD? errata (security patches) http://www.openbsd.org/errata.html
+Mounting CDROM and USB for a user

Utiliser devfs.conf(5). Exemple de fichier /etc/devfs.conf.

 own acd0 root:cdrom
 perm acd0 0660
 own cdrom root:cdrom
 perm cdrom 0660
 own     fd0 root:floppy
 perm    fd0     0660

Le propriétaire root ou le goupe floppy (:floppy) ont la permission d'écrire sur le floppy.

Pour que le montage d'un périphérique puisse être fait par un user :

 #sysctl vfs.usermount=1

Ou bien dans /etc/syysctl.conf. Mais le point de montage doit appartenir au user.

Pour une clef USB, utiliser devfs.rules(5). Exemple de fichier /etc/devfs.rules

 [usb_key=1]
 add path 'da2*' mode 0660 user root group cdrom

A la detection, le /dev/da2s1 est cree (puis /dev/das2, ..),

Mieux : utiliser le montage automatique avec le daemon amd. Instalkler puis activer avec automounter_enable=yes dans /etc/rc.conf

Montage d'image iso avec mdconfig (vn et vnconfig sur les FreeBSD? < 5 ). A noter que les images Nero (extension .nrg) ont un entete de 150 blocks de 2048 qu'il faut supprimer pour transformer en format iso.

ref: http://www.diablotins.org/index.php/Media_amovibles

2011-02-10 10:03:22 -- Cmic

+Mounting an ISO image
1.Create a loop-back device with mdconfig

 #mdconfig -a -t vnode -f PATH_TO_YOUR_ISO/ISOFILE.iso

2.Mount the created vnode to a folder (Replace /dev/mdX with your device node!).

 #mount -t cd9660 /dev/mdX /cdrom

NB: See another example in mdconfig(8)

+Retrouver un boot BSD
Perdu le boot FreeBSD? (OpenBSD? ??) suite a install de windows
  1. fdisk -B -b /boot/boot0 device
  2. ou ceci, à vérifier ...
  3. boot0cfg -B ad0
+Snapshot et mdconfig FreeBSD?

1-Pour créer des snapshots de la partition /home seulement :

/home est en fait un lien vers /usr/home. Je reduis la partition usr (/dev/ad0s1f) de 5GB, je cree une nouvelle partition home de 5GB (/dev/ad0s1g). Puis sauvegardes dump, restauration, et zou !

  • Ajout d'un disque externe usb en /dev/da0 pour dumper /usr

 #bsdlabel /dev/da0 ; newfs -U /dev/da0 ; mount !$ /mnt
 #/sbin/init 1 
 #umount /usr ; dump 0sf 500000 /dev/ad0s1f /dev/da0s1/usrdump 
 #bsdlabel -e /dev/ada0 ==> calcul des tailles des nouvelles partition f et g et mise en place...

Partitionnment avant de /dev/ad0s1 ...

6 partitions:

         size   offset    fstype   [fsize bsize  bps/cpg]
  a:  1048576        0    4.2BSD     2048 16384     8 
  b:  4125280  1048576      swap                    
  c: 78140097        0    unused        0     0         # "raw" part, don't edit
  d:  4159488  5173856    4.2BSD     2048 16384 28552 
  e:  1048576  9333344    4.2BSD     2048 16384     8 
  f: 67758177 10381920    4.2BSD     2048 16384 28552 

Partitionnement apres de /dev/ad0s1 ...

7 partitions:

        size    offset    fstype   [fsize bsize  bps/cpg]
  a:  1048576        0    4.2BSD     2048 16384     8 
  b:  4125280  1048576      swap                    
  c: 78140097        0    unused        0     0         # "raw" part, don't edit
  d:  4159488  5173856    4.2BSD     2048 16384 28552 
  e:  1048576  9333344    4.2BSD     2048 16384     8 
  f: 57272417 10381920    4.2BSD     2048 16384 28552 
  g: 10485760 67654337    4.2BSD     2048 16384 28552 

 #newfs -U /dev/ad0s1f ; newfs -U /dev/ad0s1g
 #etc..

2-Creation d'un memory disque sauvegardé dans un fichier (de nom "newimage")

mdconfig attach a memory disk (-a) (the /dev/md0) type (-t) vnode from file newimage, unit (-u) 0. Disklabel writes (-w) labels on md0 type auto. Newfs on /dev/md0.

 # dd if=/dev/zero of=newimage bs=1k count=5k 
 # mdconfig -a -t vnode -f newimage -u 0 
 # disklabel -w md0 auto 
 # newfs md0
 ...
 # mount /dev/md0 /mnt 
 ... copies -> /mnt

et démontage, puis supression

 # umount /mnt
 # mdconfig -d -u 0

3-creation et montage d'un disque sur fichier avec mdmfs. Idem ci-dessus, mais mdmfs utilise mdconfig, newfs et mount.

 # dd if=/dev/zero of=newimage bs=1k count=5k 
 # mdmfs -F newimage -s 5m md0 /mnt 
 ....operations sur /mnt
 #umount ...

4-Creation d'un disque RAM md1 de 5MB, label MonDisque?

 #mdconfig -a -t malloc -s 5m -u 1
 #newfs -L MonDisque? /dev/md1

5- Snapshots:

5.1- creer un snapshot avec mount option snapshot.

NB: Par defaut le file system est soft-updates UFS et journaled. Or le journaling est incompatible avec snapshot.

NB: le snap et son répertoire doivent etre sur le meme systeme de fichier

/dev/ada1p1 on /attic (ufs, local)

 #mkdir /attic/.snap
 #cd /
 #mount -u -o snapshot /attic/.snap/test /attic

On peut monter le snapshot sur un vnode et extraire des fichiers :

 #mdconfig -a -t vnode -o readonly -f /attic/.snap/test -u 4
 #mount -r /dev/md4 /mnt
 #cp /mnt/file-x /tmp
 #umount /mnt && mdconfig -d -u 4

5.2- Creer un snaphot de /attic avec mksnap :

 #mksnap_ffs /attic /attic/.snap/test2

find permet de trouveer les snaps :

 #find /attic -flags snapshot 

a partir du snapshot : sauvegarde, fsck, dump, montage en read-only, etc.

5.3- Et enfin enlever le snapshot:

 #rm -rf /attic/.snap/test

+Upgrading to FreeBSD? X-release

  • first, upgrade to last patch
 #freebsd-update fetch install

  • Then upgrade to FreeBSD? XX.0-RELEASE

 # : > /usr/bin/bspatch
 # freebsd-update upgrade -r 11.0-RELEASE
 # freebsd-update install
 # reboot
 # freebsd-update install
  then rebuild third-party software --> see Upgrading ports & packages
+Upgrading ports & packages
After upgrading FreeBSD?, you have to update and upgrade packages and ports because the ABI has changed with the releaase change)

see https://docs.freebsd.org/en/books/handbook/cutting-edge/#updating-upgrading-freebsdupdate

particularly "24.2.3.2. Upgrading Packages After a Major Version Upgrade"

    • To update the package list and upgrade *all* (-f) packages:
 #pkg update
 #pkg upgrade -f
 ..
Ex: Emacs24 doesn't exists so emacs25 is proposed.
 ..
 Fetching libksba-1.3.4.txz: 100%  156 KiB? 160.0kB/s    00:01
 Fetching libidn-1.33_1.txz: 100%  202 KiB? 207.2kB/s    00:01
 Fetching libid3tag-0.15.1b_1.txz: 100%   57 KiB?  58.7kB/s    00:01
 ..

    • OBSOLETE If the ports are not yet installed (first install of FreeBSD?), update the "port collection" with this portsnap command:
 #portsnap fetch update
 #portsnap extract

    • NOTE: portsnap is obsolete. Now git is preferred tool for ports install & update
 #pkg install git
 #git clone https://git.FreeBSD.org/ports.git /usr/ports

 -and update the ports when needed
 #git -C /usr/ports pull

 Before upgrading take a look at the content of /usr/ports/UPDATING and follox instructions, if ever.

    • To upgrade all (-a) force (-f) whitout getting prompting for OK (-G) and no cleaning distfiles (-D) (or -d to clean distfiles):
 #portmaster -G -af

Note: portmaster is a shell script, portupgrade is a Ruby script which needs Ruby to be installed)

All ports are browsed and actions on options are asked

    • to upgade one port (this will upgrade and compile all dependancies)
 #portmaster emacs

    • After a portmaster command, you can delete distfiles which are not useful anymore
 #portmaster --clean-distfiles

    • After upgrading ports, do a freebsd-update to tie up all the loose ends in the upgrade process:

 #freebsd-update install

Pour comparer les programmes installés aux versions dans les ports :

 #portmaster -L --index-only  | egrep '(ew|ort) version|total install'
         ===>>> New version available: bash-4.1.10
 ===>>> 674 total installed ports

    • Ex: Mise a jour de perl5.10 vers perl5.12:
 #portmaster -o lang/perl5.12 lang/perl5.10

When the port database index is corrupted :

NB: durant la manip j'ai une erreur "Updating the portsdb ..... 22713 port entries found error] remove and try again. Ce qui signifie que la bd index des ports est corrompue. La reconstruire :

 #cd /usr/ports
 #rm -rf INDEX*
 #make index
 #portsdb -Uu

-- 2024-01-31T21:32:15 maj -- Cmic maj 2016-11-08 11:29:06

+WIFI natif and with ndis
Manuel FreeBSD? ici : http://www.freebsd.org/doc/en/books/handbook/network-wireless.html et docs FreeBSD? wifi la http://www.linuxpedia.fr/doku.php/bsd/freebsd-wifi

Cas d'un Dell Latitude D600 FreeBSD? 8.0 avec une carte Wifi Intel wm3B2100. Il faut charger le module if_ipw avec kldload ou dans loader.conf en n'oubliant pas la license Intel (sinon erreur SIOCIFADDR2 !) :

 ...
 if_ipw_load="YES"       #Intel wireless
 legal.intel_ipw.license_ack="1" 
 ...

NB: a partir de FreeBSD? 8.0, le driver wlan est automatiquement chargés avec le driver hardware if_ipw. Les modules wlan_scan_ap_load wlan_scan_sta_load sont inclus dans wlan.

Toujours dans /boot/loader.conf :

 ...
 wlan_wep_load="YES"
 wlan_ccmp_load="YES"   #load these 2 ones for
 wlan_tkip_load="YES"   #WAP security protocols
 ...

Ensuite configurer l'interface :

 #ifconfig wlan0 create wlandev ipw0 inet 192.168.0.10 netmask 255.255.255.0
 #ifconfig wlan0 list scan
 SSID/MESH ID    BSSID              CHAN RATE   S:N     INT CAPS
 A9F1BDF1DAB...  de:8f:59:65:5c:35   10   11M -95:-95  100 IP  
 NEUF_89C8       00:17:33:56:89:cc   11   54M -95:-95  100 EP   WPA WME
 Neuf Wifi       00:17:33:56:89:cd   11   54M -95:-95  100 E    WME
 SFR Wifi Pu...  00:17:33:56:89:ce   11   54M -95:-95  100 E    WME

Legende CAPS : voir http://www.freebsd.org/doc/en/books/handbook/network-wireless.html

E
extended service (BSS not IBSS)
I
IBSS Had hoc network
P
privacy required (WEP or WAP or..)
S
Short preambe (56 bits)
s
short slot time

WIFI with NDIS

Cas d'un Dell Latitude D600 avec une carte Wifi Intel wm3a2100. Cette carte ne possède pas de driver pour FreeBSD?. On va donc utiliser les pilotes Windows et les fichier NDIS. On récupère les fichier .sys et .inf de la carte, puis on compile le pilote :

 #ndisgen w70n501.inf w70n51.sys
 ...

NB: il y a peut-être un driver pour Intel mini PCI 2100 : if_ipw (cf man ipw) FIXME

Ce qui génère le fichier w70n51_sys.ko que l'on peut charger immédiatement avec kldload. Pour que ce chargement se fasse au boot, placer ce fichier dans le répertoire /boot/modules et modifier le fichier /boot/loader.conf :

 ..
 ndisload="YES"
 if_ndis_load="YES"
 wlan="YES"
 wlan_scan_ap_load="YES"
 wlan_scan_sta_load="YES"
 w70n51_sys.ko_load="YES"
 ...

Au boot, on doit avoir la ligne ndis0 :

 #ifconfig ndis0
 ndis0: flags=8843<....
        ether 00:0c:f1:43::d6:38
        media: IEEE 802.11 Wireless ...
        status: no carrier

Il faut ensuite associer ce device a un pseudo device wlan ;

 #ifconfig wlan create wlandev ndis0 up
     ....ifconfig montre alors maintenant wlan0 
 #ifconfig wlan0 list scan
   .. afichage de la liste de tous les spots visibles

 #ifconfig wlan0 inet 192.168.1.5
 #ifconfig wlan0 ssid chipmunk

Remplir le fichier /etc/wap_supplicant.conf :

 network={
	ssid="chipmunk"
	scn_ssid=1
	psk="le motDePasseDeLaCLefWap?"
 }

L'interface wlan0 est toujours marquee "no carrier". Il faut l'associer au ssid de l'ap

 /etc/rc.d/wpa_supplicant start wlan0

ce qui lance la commande suivante :

 /usr/sbin/wpa_supplicant -s -B -i wlan0 -c /etc/wpa_supplicant.conf \ 
-D ndis -P /var/run/wpa_supplicant/wlan0.pid

Mais alors, il faut configurer l'adresse TCP/IP de wlan0 puisque le DHCP n'a pas été configuré.

 #ifconfig wlan0 192.168.1.2 netmask 255.255.255.0

On peut alors pinger l'AP.


Tester ci-dessous

Pour que l'interface soit configurée au démarrage, placer les lignes suivantes dans le fichier /etc/rc.conf :

 wlans_ndis0="wlan0"

 ifconfig_wlan0="ssid xxxxx DHCP"
ou
 ifconfig_wlan0="ssid xxxxx 192.168.0.5 mask 255.255.255.0"
 create_args_wlan0="wlanmode sta country FR"

Mais pour que DHCP fonctionne, il faut sans doute installer dhcpcd (/usr/ports/net/dcpcd)...

wlans_rum0="wlan0" ifconfig_wlan0="DHCP"

NB: see doc in the entry 20080420 in /usr/src/UPDATING

+ZFS
ZFS nfsv3 nfsv4 server and client and autofs https://geekandnix.com/freebsd/install-nfs/
ZFS draid online calculator
ZFS draid internals and calculator https://jro.io/truenas/openzfs/#draid
ZFS draid howto internals https://github.com/openzfs/zfs/wiki/dRAID-HOWTO/001b44728e1ac3329a4d91be97bcd565a8f351b7
ZFS draid performance reddit article https://www.reddit.com/r/zfs/comments/ydct9a/draid_performance_with_32_drives/
ZFS basis tutorial https://www.thomas-krenn.com/en/wiki/ZFS_dRAID_Basics_and_Configuration
ZFS space, efficiency calculator
read write stats iozstat tool https://github.com/jimsalterjrs/ioztat
Using ZFS NFS sharenfs https://klarasystems.com/articles/nfs-shares-with-zfs/
From Recovery Mode to Normal Operations with OpenZFS? Manipulating a Pool from the Rescue System https://klarasystems.com/articles/manipulating-a-pool-from-the-rescue-system/

Problem: ZFS loads before disks are ready
verify zfs_enable=YES in /etc/rc.conf
verify zfs_load="YES" in /boot/loader.conf
add 2 sysctl vars in boot/loader.conf:
kern.cam.boot_delay: ==>Bus registration wait time)
and kern.cam.scsi_delay ==>Delay to allow devices to settle after a SCSI bus reset (in ms)
To boot from another version of ZFS (present as old versin for ex.) with bectl