Hello everybody,
I'm trying to reinstall FreeBSD on a Thinkpad T420 (I'm not planning on using GPT since it doesn't work on this Laptop), with full disk encryption + a 32GB mmcsd Card (for the moment, until I get my 1gb SD card) with the /boot partition.
I used those 2 "tutorials":
1) HOWTO: Quick GELI encryption guide ==> Using MBR but not a separate key to boot from
2) Help on installing with UFS+J, GELI, GPT, and boot from USB ===> Usin separate key to boot BUT with GPT solution.
Here is what i'm planning to do:
* Start FreeBSD Live CD
* Destroy previous partitionning (when i get the correct method, I'll use /dev/urandom)
* Prepare and mount MMC/SD card (will have /boot partition)
(I've read somewhere that 768MB would be more than enough)
===> I'm getting this message:
I can't find a way to avoid this alignement error. Do you have any idea about how I could fix this?
Answer: Can be disregarded
* Create the encrypted slice (using the whole HDD) + label it
* Create the 256-bit key.
* Encrypt entire HDD using GELI with key file and password
* Partition the encrypted HDD (/tmp will be created using tmpfs in /etc/rc.conf)
* Newfs Everything except swap
* Mount base system on /mnt/inst
* Install FreeBSD
* Add those lines to /mnt/inst/boot/loader.conf
* Add those lines to /mnt/inst/etc/rc.conf (I'm not sure if there is enough space for /tmp though, could you help me?)
* Add those lines to /mnt/inst/etc/fstab
* Copy /mnt/inst/boot to /mnt/sd/boot
Reboot and I think that's it.
Could you please check the whole thing and tell me what I'm doing wrong?
I tried with a USB instead of a MMCSD card: The laptop booted on thanks to the USB as planned but stopped with a "mountfrom" error. I haven't tried it again with a different "vfs entry" as I'm trying to get this to work with a SD Card. I won't be able to go forward until I solve the alignment issue.
Thank you very much!
I'm trying to reinstall FreeBSD on a Thinkpad T420 (I'm not planning on using GPT since it doesn't work on this Laptop), with full disk encryption + a 32GB mmcsd Card (for the moment, until I get my 1gb SD card) with the /boot partition.
I used those 2 "tutorials":
1) HOWTO: Quick GELI encryption guide ==> Using MBR but not a separate key to boot from
2) Help on installing with UFS+J, GELI, GPT, and boot from USB ===> Usin separate key to boot BUT with GPT solution.
Here is what i'm planning to do:
* Start FreeBSD Live CD
Code:
mount -u -o rw /
kldload sdhci mmc mmcsd
Code:
dd if=/dev/zero of=/dev/ada0 bs=1m count=1
dd if=/dev/zero of=/dev/mmcsd0 bs=1m count=1
(I've read somewhere that 768MB would be more than enough)
Code:
gpart create -s mbr mmcsd0
gpart add -t freebsd -a 4k -s 768m mmcsd0
Code:
mmcsd0s1 added, but partition is not aligned on 4194304 bytes
Answer: Can be disregarded
Code:
gpart create -s bsd mmcsd0s1
gpart add -t freebsd-ufs -a 4k mmcsd0s1
gpart bootcode -b /boot/mbr mmcsd0
gpart bootcode -b /boot/boot mmcsd0s1
gpart set -a active -i 1 mmcsd0
newfs -L sdboot /dev/mmcsd0s1a
Code:
gpart create -s mbr ada0
gpart add -t freebsd -a 4k ada0
glabel label -v thinkpad /dev/ada0s1
Code:
mkdir /mnt/sd
mount /dev/mmcsd0 /mnt/sd
mkdir -p /mnt/sd/boot/keys
dd if=/dev/urandom of=/mnt/sd/boot/keys/label_thinkpad.key bs=256k count=1
Code:
kldload geom_eli
geli init -b -s 4096 -l256 -K /mnt/sd/boot/keys/label_thinkpad.key /dev/label/thinkpad
geli attach -k /mnt/sd/boot/keys/label_thinkpad.key /dev/label/thinkpad
Code:
gpart create -s bsd /dev/label/thinkpad.eli
gpart add -t freebsd-ufs -s 2G /dev/label/thinkpad.eli // /
gpart add -t freebsd-swap -s 4G /dev/label/thinkpad.eli // swap
gpart add -t freebsd-ufs -s 6G /dev/label/thinkpad.eli // /var
gpart add -t freebsd-ufs -s 35G /dev/label/thinkpad.eli // /usr
gpart add -t freebsd-ufs /dev/label/thinkpad.eli // /home
Code:
glabel label -v swapfs /dev/label/thinkpad.elib
newfs -L rootfs -U -j /dev/label/thinkpad.elia
newfs -L varfs -U -j /dev/label/thinkpad.elid
newfs -L usrfs - U -j /dev/label/thinkpad.elie
newfs -L homefs -U -j /dev/label/thinkpad.elif
Code:
mkdir /mnt/inst
mount /dev/ufs/rootfs /mnt/inst
mkdir /mnt/inst/var
mount /dev/ufs/varfs /mnt/inst/var
mkdir /mnt/inst/usr
mount /dev/ufs/usrfs /mnt/inst/usr
mkdir /mnt/inst/home
mount /dev/ufs/homefs /mnt/inst/home
mkdir /mnt/inst/boot
* Install FreeBSD
Code:
cd /usr/freebsd-dist
sh
for file in base.txz kernel.txz; do tar --unlink -xpvJf ${file} -C /mnt/inst done
Code:
# Delay boot to be sure the MMC/SD card is detected in order to boot
kern.cam.boot_delay = "10000"
# Encryption
geom_eli_load = "YES"
geli_label_thinkpad_keyfile0_load="YES"
geli_label_thinkpad_keyfile0_type="label/thinkpad:geli_keyfile0"
geli_label_thinkpad_keyfile0_name="/boot/keys/label_thinkpad.key"
vfs.root.mountfrom="ufs:/dev/ufs/rootfs"
Code:
tmpmfs="YES"
tmpsize="500M"
Code:
/dev/ufs/rootfs / ufs rw 1 1
/dev/label/swapfs none swap sw 0 0
/dev/ufs/varfs /var ufs rw 2 2
/dev/ufs/usrfs /usr ufs rw 2 2
/dev/ufs/homefs /home ufs rw 2 2
* Copy /mnt/inst/boot to /mnt/sd/boot
Code:
mount /dev/ufs/sdboot /mnt/sd
cp -Rvp /mnt/inst/boot /mnt/sd
Reboot and I think that's it.
Could you please check the whole thing and tell me what I'm doing wrong?
I tried with a USB instead of a MMCSD card: The laptop booted on thanks to the USB as planned but stopped with a "mountfrom" error. I haven't tried it again with a different "vfs entry" as I'm trying to get this to work with a SD Card. I won't be able to go forward until I solve the alignment issue.
Thank you very much!