Created
December 3, 2020 02:13
-
-
Save richlamdev/562c46c4476189a27780707b585160c0 to your computer and use it in GitHub Desktop.
freebsd random notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSH key bindings | |
/home/homedir/.cshrc | |
bindkey "^R" i-search-back | |
bindkey "^S" i-search-fwd | |
alias ls ls -G | |
GRUB2 - Multiboot | |
menuentry "FreeBSD 11.0 x64" --class freebsd --class bsd --class os { | |
insmod ufs2 | |
insmod bsd | |
set root=(hd0,2) | |
kfreebsd /boot/kernel/kernel | |
kfreebsd_loadenv /boot/device.hints | |
set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0s2a | |
set kFreeBSD.vfs.root.mountfrom.options=rw | |
set kFreeBSD.hw.psm.synaptics_support=1 | |
} | |
INSTALL PKG | |
pkg install vim | |
/boot/loader.conf.local | |
aesni_load="YES" | |
geom_eli_load="YES" | |
geom_zero_load="YES" | |
zfs_load="YES" | |
ENABLE NORMAL USER TO SU | |
pw usermod <username> -G wheel | |
#Geli w/o keys - no ZFS | |
sysctl kern.geom.debugflags=16 | |
#TO VIEW DISK INFO | |
geom disk list | |
camcontrol devlist | |
gpart list | |
gpart destroy -F adaX | |
gpart create -s gpt ada1 | |
gpart add -t freebsd-ufs -a 1M ada1 | |
gpart show | |
gpart show ada1 | |
geli init -s 4096 -l 256 /dev/ada1p1 | |
geli attach /dev/ada1p1 | |
newfs /dev/ada1p1.eli | |
mount -t ufs/dev/ada1p1.eli /export | |
geli detach /dev/ada1p1 | |
#Geli w/ keys + ZFS | |
camcontrol devlist | |
chmod 700 /root | |
cd /root | |
mkdir geli | |
cd geli | |
dd if=/dev/random of=/root/geli/adaX.key bs=64 count=1 | |
gpart destroy -F adaX | |
geli init -s 4096 -K "/root/geli/adaX.key" "/dev/adaX" | |
geli attach -k "/root/geli/adaX.key" "/dev/adaX" | |
zpool create thenameofthepool mirror/raidz1/raidz2 /dev/adaX.eli /dev/adaX.eli | |
zfs set compression=lz4 thenameofthepool | |
after reboot | |
geli attach -k "/root/geli/adaX.key" "/dev/adaX" | |
zfs mount -a (critical step) | |
#Geli w/o keys + ZFS | |
camcontrol devlist | |
gpart destroy -F adaX (repeat for all disks) | |
gpart create -s gpt adaX (for all log/cache devices) | |
gpart show | |
gpart add -t freebsd-zfs -b 2048 -a 4k -l log0 -s 8G adaX (for log device) | |
#gpart add -t freebsd-zfs -a 4k -l cache0 ada (for cache) | |
geli init -s 4096 -l 256 /dev/adaX (repeat for all disks in data pool) | |
geli init -s 4096 -l 256 /dev/adaXpX (repeat for all log and/or cache disks) | |
geli attach /dev/adaX (repeat for all data disks) | |
geli attach /dev/adaXpX (repeat for all log and/or cache disks) | |
zpool create <nameofpool> mirror/raidx /dev/adaX.eli /dev/adaX.eli | |
zpool add <nameofpool> log /dev/adaXpX.eli | |
#zpool add <nameofpool> log mirror /dev/adaXpX.eli /dev/adaXpX.eli | |
#zpool add <nameofpool> cache /dev/adaXpX.eli | |
zfs set compression=lz4 thenameofthepool | |
geli attach /dev/adaX (repeat for all disks in data pool) | |
geli attach /dev/adaXpX (repeat for all log/cache devices) | |
zfs mount -a (on reboot) | |
zpool status (check on the status) | |
#attach disks and mount pool | |
geli attach /dev/ada2 | |
geli attach /dev/ada3 | |
geli attach /dev/ada1p1 | |
zpool import richdisk | |
zpool status | |
#zfs mount -a | |
df -h | |
#detach disks and umount pool | |
zpool export richdisk | |
geli detach /dev/ada2 | |
geli detach /dev/ada3 | |
geli detach /dev/ada1p1 | |
SAMBA | |
pkg search samba | |
pkg install samba411 | |
MOUNT SHARE from Ubuntu Nautilus: | |
Connect to Server: | |
smb://192.168.x.x/<sharename> | |
MOUNT/ UNMOUNT SHARE FROM CLI: | |
sudo mount -t cifs -o user=<username>,uid=<uid>,gid=<gid> //hostname/share /mnt/<sharename> | |
sudo umount /mnt/<sharename> | |
MOUNT SHARE WITH FREEBSD | |
mount_smbfs -l 192.168.x.x //<username>@samba/<sharename> /<folder>/<sharename> | |
#configuration file location | |
/usr/local/etc/smb4.conf | |
#add samba user | |
smbpasswd -a username | |
#sysrc samba_server_enable=YES | |
#service samba_server start | |
#Add a new group: | |
pw groupadd GROUPNAME | |
#Add user to group: | |
pw groupmod GROUPNAME -m USERNAME | |
#Show group information: | |
pw groupshow GROUPNAME | |
#geli + freebsd-ufs | |
gpart destroy -F adaX (repeat for all disks) | |
gpart create -s gpt adaX | |
gpart add -t freebsd-ufs -b 2048 -a 4k -l labelhereifyouwant -s 8G adaX | |
geli init -s 4096 -l 256 /dev/adaXpX (repeat for all log and/or cache disks) | |
geli attach /dev/adaXpX | |
newfs -j -U /dev/adaXpX.eli | |
#start_share.csh | |
geli attach /dev/ada1p1 | |
mount -t ufs /dev/ada1p1.eli /export | |
service samba_server restart | |
**** NOTE mkdir /export first ***** | |
#ADD USER GROUP | |
groupadd users | |
#ADD USER TO users GROUP | |
usermod -a -G users <username> | |
PATCHING | |
freebsd-update fetch | |
freebsd-update install | |
#list vulnerable packages | |
pkg audit -F | |
#Update all FreeBSD packages database | |
pkg update | |
#Apply all outstanding packages security upgades | |
pkg upgrade | |
AFTER MAJOR UPGRADE (PATCH) | |
pkg-static install -f pkg | |
pkg upgrade -f | |
FORCE NTP UPDATE | |
ntpdate -v -b in.pool.ntp.org | |
SET CLOCK | |
tzsetup | |
FREEBSD RECOVERY | |
1. Restart the system. | |
2. At the boot: prompt, enter boot -s to enter Single User Mode. | |
3. When asked what shell to use, press the Enter key. | |
4. Because the root filesystem will be mounted read-only by default, you will need to remount it using the mount -ruw / command to give yourself read/write access. | |
5. Run mount -a to remount all filesystems specified in the /etc/fstab file. | |
6. Run passwd root to set a new root password. | |
7. Run exit to continue booting normally. | |
FREEBSD GUI SETUP | |
pkg install org | |
pkg install mate mate-desktop | |
pkg install slim | |
/etc/rc.conf | |
zfs_enable="YES" | |
hald_enable="YES" | |
dbus_enable="YES" | |
slim_enable="YES" | |
home folder .xinitrc | |
exec mate-session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment