I have a notebook with 3 GB RAM. I've recently purchased a 128 GB SSD from Samsung to replace my damaged hdd and decided to give more thoughts into the installation of FreeBSD rather than using the default installation settings. I wanted to use GELI to encrypt the entire hard drive and use usb key to boot. I am concerned on the best usage practice for SSD, TRIM, and what to do with SWAP. I've been giving thoughts on whether to use ZFS or UFS+J, but with just 3 GB RAM and only a single drive, using ZFS seemed bit pointless. Please correct me if I'm wrong, but self-healing wouldn't work with just single drive in the pool, and snapshots seem very useful but there seems to be other ways to go about to achieve functionally similar effect... I've read an article in this forum, which I can't seem to find right now, where one can set up two jails, one that apparently works as a main system while the other serving as a backup of sorts, and to upgrade, install all system stuff into the backup and simply switch the setting to boot from the other (backup) jail. anyways, ZFS seemed less than useful and would potentially hog much of the RAM compared to UFS+J.
Another thing I would like is labeling everything using GPT. I hope this would make things easier should I ever have to add/rearrange disks within the system.
And should I worry about 4k-alignment? and if so, how should I go about it? I think it had to do something with newfs...
I've been reading up on howto instructions on this forum for many of varying installation methods. I'm most uncertain about how GELI and GPT fits in together while booting from USB. I think I'd be taking pieces from several different instructions to suit my needs and the following is what I ended up with. I would appreciate if others could tell me what I'm doing wrong, or do something better, or point out flaws in my reasons to use UFS+J over ZFS, or anything else that would make my system set up better Oh, and thank you for reading anyways
Proposed Steps:
0. boot from usb live system and enter shell. Have another usb key da1 and SSD in ada0
1-1. Create a partition encompassing the entire SSD
1-2. Using gpart, create two partitions, freebsd-boot and freebsd-ufs labeled "boot", in the USB key. Install necessary bootcode into the freebsd-boot.
2. Create a 256-bit key file using outputs from /dev/random to be used with GELI. This file should be placed in /boot folder in the usb. make backup to /root just in case. Add necessary lines to /mnt/usb/boot/loader.conf
3. Encrypt the SSD using geli with the key file and a password.
4. using gpart and newfs, create GPT partition on the /dev/gpt/local0.eli and add containers and format (with journal and TRIM) for /, swap, /var, /usr, /usr/home. /tmp will either be a symlink from /var/tmp or will be created using tmpmfs setting in the /etc/rc.conf. Which would be better for this setup?
By the way, what's the difference between -j and -J fags for newfs?
6. mount all file systems appropriately with root on /mnt/system. Mount the /boot in /dev/gpt/boot (from the usb key) to /mnt/system/boot
7. Install FreeBSD
8. Setup /mnt/etc/rc.conf, /mnt/etc/fstab, /mnt/etc/pf.conf
9. Reboot, add users, setup user environments, install ports, etc.
Another thing I would like is labeling everything using GPT. I hope this would make things easier should I ever have to add/rearrange disks within the system.
And should I worry about 4k-alignment? and if so, how should I go about it? I think it had to do something with newfs...
I've been reading up on howto instructions on this forum for many of varying installation methods. I'm most uncertain about how GELI and GPT fits in together while booting from USB. I think I'd be taking pieces from several different instructions to suit my needs and the following is what I ended up with. I would appreciate if others could tell me what I'm doing wrong, or do something better, or point out flaws in my reasons to use UFS+J over ZFS, or anything else that would make my system set up better Oh, and thank you for reading anyways
Proposed Steps:
0. boot from usb live system and enter shell. Have another usb key da1 and SSD in ada0
1-1. Create a partition encompassing the entire SSD
Code:
gpart destroy -F ada0
gpart create -s GPT ada0
gpart add -a128k -t freebsd-ufs -l local0 ada0
1-2. Using gpart, create two partitions, freebsd-boot and freebsd-ufs labeled "boot", in the USB key. Install necessary bootcode into the freebsd-boot.
Code:
gpart destroy -F da1
gpart create -s GPT da1
gpart add -t freebsd-boot -l bootcode -s 512k da1
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da1
gpart add -t freebsd-ufs -l note1-boot da1
newfs /dev/gpt/note1-boot
2. Create a 256-bit key file using outputs from /dev/random to be used with GELI. This file should be placed in /boot folder in the usb. make backup to /root just in case. Add necessary lines to /mnt/usb/boot/loader.conf
Code:
mkdir /mnt/usb
mount /dev/da1 /mnt/usb
mkdir -p /mnt/usb/boot/keys
dd if=/dev/random of=/mnt/usb/boot/keys/local0.key bs=256k count=1
cp /mnt/usb/boot/keys/local0.key /root/local0.key
cat << EOF >> /mnt/usb/boot/loader.conf
#Delay boot to make sure USB key is detected before rushing into the boot process.
kern.cam.boot_delay="6000"
#Encryption
geom_eli_load="YES"
geli_local0_keyfile0_load="YES"
geli_local0_keyfile0_type="gpt/local0:geli_keyfile0"
geli_local0_keyfile0_name="/boot/keys/local0.key"
vfs.root.mountfrom="ufs:/dev/gpt/note1-root0"
EOF
umount /mnt/usb
3. Encrypt the SSD using geli with the key file and a password.
Code:
geli init -b -s 4096 -l 256 -K /mnt/usb/boot/keys/local0.key /dev/gpt/local0
geli attach -k /mnt/usb/boot/keys/local0.key /dev/gpt/local0
4. using gpart and newfs, create GPT partition on the /dev/gpt/local0.eli and add containers and format (with journal and TRIM) for /, swap, /var, /usr, /usr/home. /tmp will either be a symlink from /var/tmp or will be created using tmpmfs setting in the /etc/rc.conf. Which would be better for this setup?
Code:
gpart create -s GPT /dev/gpt/local0.eli
gpart add -a128k -t freebsd-swap -l note1-swap0 -s 4G gpt/local0.eli
gpart add -a128k -t freebsd-ufs -l note1-root0 -s 512M gpt/local0.eli
gpart add -a128k -t freebsd-ufs -l note1-var0 -s 2G gpt/local0.eli
gpart add -a128k -t freebsd-ufs -l note1-usr0 -s 10G gpt/local0.eli
gpart add -a128k -t freebsd-ufs -l note1-home0 gpt/local0.eli
newfs -t -U /dev/gpt/note1-root0
newfs -t -U /dev/gpt/note1-var0
newfs -t -U /dev/gpt/note1-usr0
newfs -t -U /dev/gpt/note1-home0
6. mount all file systems appropriately with root on /mnt/system. Mount the /boot in /dev/gpt/boot (from the usb key) to /mnt/system/boot
Code:
mkdir /mnt/system
mount /dev/gpt/note1-root0 /mnt/system
mount /dev/gpt/note1-var0 /mnt/system/var
mount /dev/gpt/note1-usr0 /mnt/system/usr
mount /dev/gpt/note1-home0 /mnt/system/usr/home
mount /dev/gpt/note1-boot /mnt/usb
mount /mnt/usb/boot /mnt/system/boot
7. Install FreeBSD
Code:
for I in base.txz kernel.txz; do
tar --unlink -xvpJf ${I} -C /mnt/system
done
8. Setup /mnt/etc/rc.conf, /mnt/etc/fstab, /mnt/etc/pf.conf
Code:
cat << EOF >> /mnt/etc/fstab
/dev/gpt/note1-root0 / ufs rw 1 1
/dev/gpt/note1-swap0 none swap sw 0 0
/dev/gpt/note1-var0 /var ufs rw 2 2
/dev/gpt/note1-usr0 /usr ufs rw 2 2
/dev/gpt/note1-home0 /usr/home ufs rw 2 2
cat << EOF >> /mnt/etc/rc.conf
# Add lines for:
# tmpmfs
# Firewall - pf
# ntpd
# Power Saving Features
# anything else needed in rc.conf
EOF
cat << EOF >> /mnt/etc/pf.conf
#Insert your rules
EOF
9. Reboot, add users, setup user environments, install ports, etc.