Compare commits
5 Commits
56dc2f85a6
...
edd104ed1c
Author | SHA1 | Date | |
---|---|---|---|
edd104ed1c | |||
9f0f19355e | |||
0b3f5b75dd | |||
04f206129f | |||
e42e92874e |
48
README.md
48
README.md
@@ -12,7 +12,7 @@ On a UEFI system ensure these conditions are met. See [How to prep](#how-to-prep
|
|||||||
|
|
||||||
- One GPT-partitioned disk
|
- One GPT-partitioned disk
|
||||||
- Arch Linux live CD ISO image sees exactly one partition with partition type code `BF00` ("Solaris root")
|
- Arch Linux live CD ISO image sees exactly one partition with partition type code `BF00` ("Solaris root")
|
||||||
- Arch Linux live CD ISO image sees exactly one partition with partition type code `EF00` ("EFI system partition")
|
- Arch Linux live CD ISO image sees exactly one partition with partition type code `EF00` ("EFI System Partition")
|
||||||
- The `EF00` EFI partition is mountable, in practical terms this usually only means it has a file system.
|
- The `EF00` EFI partition is mountable, in practical terms this usually only means it has a file system.
|
||||||
- No ZFS zpool exists
|
- No ZFS zpool exists
|
||||||
|
|
||||||
@@ -26,11 +26,17 @@ If you are instead running a legacy BIOS machine ensure these conditions are met
|
|||||||
- The `83` Linux partition is mountable, in practical terms this usually only means it has a file system.
|
- The `83` Linux partition is mountable, in practical terms this usually only means it has a file system.
|
||||||
- No ZFS zpool exists
|
- No ZFS zpool exists
|
||||||
|
|
||||||
|
Neither with a UEFI nor legacy BIOS system are any of these conditions a requirement from ZFSBootMenu. We're just setting requirements to easily identify if you intend to do a UEFI or a legacy BIOS install. Subsequently the script has no logic to detect UEFI or legacy BIOS mode, that's legwork left to the reader :) The Internet seems to agree that a good quick check is to see if your Arch Linux live CD ISO image has directory `/sys/firmware/efi`.
|
||||||
|
```
|
||||||
|
[ -d /sys/firmware/efi ] && echo 'Likely a UEFI system' || echo 'Probably a legacy BIOS system'
|
||||||
|
```
|
||||||
|
If you're unsure nothing's stopping you from just giving it a go with a best guess and if that fails you know you guessed wrong.
|
||||||
|
|
||||||
## How to prep
|
## How to prep
|
||||||
|
|
||||||
### UEFI
|
### UEFI
|
||||||
|
|
||||||
On a blank example disk `/dev/sda` you can fulfill the UEFI requirements (One `EF00` partition with a file system plus one `BF00` partition) for example like so:
|
On a blank example disk `/dev/sda` you can fulfill the UEFI requirements (one `EF00` partition with a file system plus one `BF00` partition) for example like so:
|
||||||
```
|
```
|
||||||
sgdisk --new '1::+512M' --new '2' --typecode '1:EF00' --typecode '2:BF00' /dev/sda
|
sgdisk --new '1::+512M' --new '2' --typecode '1:EF00' --typecode '2:BF00' /dev/sda
|
||||||
mkfs.vfat /dev/sda1
|
mkfs.vfat /dev/sda1
|
||||||
@@ -39,7 +45,7 @@ mkfs.vfat /dev/sda1
|
|||||||
>
|
>
|
||||||
> `--new '2'`: Create partition number `2`. Both field number 2, the start sector, and field number 3, the end sector, are unspecified, there's no field separator `:`. Field number 2 will be the first free sector - in this case right after partition 1 - and field number 3 will be end of disk. Thus partition `2` will fill the remaining free disk space.
|
> `--new '2'`: Create partition number `2`. Both field number 2, the start sector, and field number 3, the end sector, are unspecified, there's no field separator `:`. Field number 2 will be the first free sector - in this case right after partition 1 - and field number 3 will be end of disk. Thus partition `2` will fill the remaining free disk space.
|
||||||
>
|
>
|
||||||
> `--typecode '1:EF00'`: Partition 1 gets partition type code `EF00`, an EFI system partition.
|
> `--typecode '1:EF00'`: Partition 1 gets partition type code `EF00`, an EFI System Partition.
|
||||||
>
|
>
|
||||||
> `--typecode '2:BF00'`: Partition 2 gets partition type code `BF00`, a Solaris root partition.
|
> `--typecode '2:BF00'`: Partition 2 gets partition type code `BF00`, a Solaris root partition.
|
||||||
|
|
||||||
@@ -54,12 +60,12 @@ NAME SIZE FSTYPE PARTTYPE PARTTYPENAME PTTYP
|
|||||||
|
|
||||||
### Legacy BIOS
|
### Legacy BIOS
|
||||||
|
|
||||||
For a legacy BIOS machine you'll be using a master boot record (MBR) on your disk.
|
For a legacy BIOS machine you'll be using a Master Boot Record (MBR) on your disk.
|
||||||
```
|
```
|
||||||
printf -- '%s\n' 'label: dos' 'start=1MiB, size=512MiB, type=83, bootable' 'start=513MiB, size=+, type=bf' | sfdisk /dev/sda
|
printf -- '%s\n' 'label: dos' 'start=1MiB, size=512MiB, type=83, bootable' 'start=513MiB, size=+, type=bf' | sfdisk /dev/sda
|
||||||
mkfs.vfat /dev/sda1
|
mkfs.vfat /dev/sda1
|
||||||
```
|
```
|
||||||
> `label: dos`: Create the following partition layout in a master boot record.
|
> `label: dos`: Create the following partition layout in a Master Boot Record.
|
||||||
>
|
>
|
||||||
> `start=1MiB, size=512MiB, type=83, bootable`: Partition 1 begins 1 Mebibyte after disk start and is 512 Mebibyte in size. We're setting its bootable flag and setting partition type code `83` ("Linux").
|
> `start=1MiB, size=512MiB, type=83, bootable`: Partition 1 begins 1 Mebibyte after disk start and is 512 Mebibyte in size. We're setting its bootable flag and setting partition type code `83` ("Linux").
|
||||||
>
|
>
|
||||||
@@ -74,13 +80,15 @@ NAME SIZE FSTYPE PARTTYPE PARTTYPENAME PTTYPE
|
|||||||
└─/dev/sda2 9.5G 0xbf Solaris dos
|
└─/dev/sda2 9.5G 0xbf Solaris dos
|
||||||
```
|
```
|
||||||
|
|
||||||
## ZFS dataset layout
|
# Partition naming
|
||||||
|
|
||||||
The script will create a single ZFS zpool `zpool` on the `BF00` partition with dataset child `zpool/root` which itself has one child `zpool/root/archlinux`, that's where Arch Linux gets installed. Parallel to `zpool/root` it'll create `zpool/data` with a `zpool/data/home` child dataset that gets mounted at `/home`.
|
Since this script works with UEFI and legacy BIOS mode we'll be addressing both disk layout schemes with umbrella terms for better readability: "The zpool partition" will be GPT `BF00` partition and MBR `bf` partition. You'll parse the text accordingly. "The boot partition" will be GPT `EF00` partition as well as the MBR `83` partition.
|
||||||
|
|
||||||
The script will use the `EF00` partition to install a ZFSBootMenu EFI executable if `efibootmgr` says that no such `ZFSBootMenu` entry exists. If ZFSBootMenu gets added to the EFI partition it'll become primary boot option.
|
# ZFS dataset layout
|
||||||
|
|
||||||
## How to run this?
|
The script will create a single ZFS zpool `zpool` on the zpool partition with dataset child `zpool/root` which itself has one child `zpool/root/archlinux`, that's where Arch Linux gets installed. Parallel to `zpool/root` it'll create `zpool/data` with a `zpool/data/home` child dataset that gets mounted at `/home`.
|
||||||
|
|
||||||
|
# How to run this?
|
||||||
|
|
||||||
- Boot an Arch Linux live CD ISO image
|
- Boot an Arch Linux live CD ISO image
|
||||||
- Run:
|
- Run:
|
||||||
@@ -89,9 +97,9 @@ The script will use the `EF00` partition to install a ZFSBootMenu EFI executable
|
|||||||
```
|
```
|
||||||
During execution the script will call itself when it changes into its `chroot`, that's why we `export SCRIPT_URL`. Feel free to update `"${SCRIPT_URL}"` with whatever branch or revision you want to use from [quico.space/quico-os-setup/arch-zbm](https://quico.space/quico-os-setup/arch-zbm). Typically `.../branch/main/setup.sh` as shown above is what you want.
|
During execution the script will call itself when it changes into its `chroot`, that's why we `export SCRIPT_URL`. Feel free to update `"${SCRIPT_URL}"` with whatever branch or revision you want to use from [quico.space/quico-os-setup/arch-zbm](https://quico.space/quico-os-setup/arch-zbm). Typically `.../branch/main/setup.sh` as shown above is what you want.
|
||||||
|
|
||||||
### Options
|
## Options
|
||||||
|
|
||||||
#### Compression
|
### Compression
|
||||||
|
|
||||||
By default we create a zpool with ZFS property `compression=on`. If the `lz4_compress` pool feature is active this will by default enable `compression=lz4`. See `man 7 zfsprops` for example in ZFS 2.1.9 for details. See `zpool get feature@lz4_compress <pool>` to check this feature's status on your `<pool>`.
|
By default we create a zpool with ZFS property `compression=on`. If the `lz4_compress` pool feature is active this will by default enable `compression=lz4`. See `man 7 zfsprops` for example in ZFS 2.1.9 for details. See `zpool get feature@lz4_compress <pool>` to check this feature's status on your `<pool>`.
|
||||||
|
|
||||||
@@ -100,7 +108,7 @@ To get a zpool with uncompressed datasets export the shell variable `ARCHZBM_ZFS
|
|||||||
export ARCHZBM_ZFSPROPS_NO_COMPRESSION=yesplease
|
export ARCHZBM_ZFSPROPS_NO_COMPRESSION=yesplease
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Encryption
|
### Encryption
|
||||||
|
|
||||||
By default we encrypt the zpool with ZFS property `encryption=on`. In ZFS 2.1.9 this defaults to `encryption=aes-256-gcm`.
|
By default we encrypt the zpool with ZFS property `encryption=on`. In ZFS 2.1.9 this defaults to `encryption=aes-256-gcm`.
|
||||||
|
|
||||||
@@ -109,19 +117,23 @@ To get a zpool with unencrypted datasets export the shell variable `ARCHZBM_ZFSP
|
|||||||
export ARCHZBM_ZFSPROPS_NO_ENCRYPTION=yup
|
export ARCHZBM_ZFSPROPS_NO_ENCRYPTION=yup
|
||||||
```
|
```
|
||||||
|
|
||||||
## Steps
|
# Steps
|
||||||
|
|
||||||
The script takes the following installation steps.
|
The script takes the following installation steps.
|
||||||
|
|
||||||
1. Install ZFS tools and kernel module with [github.com/eoli3n/archiso-zfs](https://github.com/eoli3n/archiso-zfs)
|
1. Install ZFS tools and kernel module with [github.com/eoli3n/archiso-zfs](https://github.com/eoli3n/archiso-zfs)
|
||||||
1. Create one ZFS zpool on top of `BF00` partition, encrypted and compressed datasets, password `password`
|
1. Create one ZFS zpool on top of zpool partition, encrypted and compressed datasets, password `password`
|
||||||
1. _See paragraphs [Compression](#compression)/[Encryption](#encryption) to optionally disable properties_
|
1. _See paragraphs [Compression](#compression)/[Encryption](#encryption) to optionally disable properties_
|
||||||
1. Create dataset for Arch Linux and `/home`
|
1. Create dataset for Arch Linux and `/home`
|
||||||
1. Install Arch Linux into pool
|
1. Install Arch Linux into pool
|
||||||
1. Add ZFSBootMenu to `EF00` partition if it doesn't exist already
|
1. Add ZFSBootMenu to boot partition
|
||||||
|
1. Configure boot method
|
||||||
|
- Either an EFI image with EFI boot order entries on a UEFI machine
|
||||||
|
- Or Syslinux with `extlinux` for a legacy BIOS computer
|
||||||
|
1. Add `pacman` hooks to keep ZFSBootMenu images (and `extlinux`) updated
|
||||||
1. Exit into Arch Linux live CD ISO image shell for you to `reboot` and frolick
|
1. Exit into Arch Linux live CD ISO image shell for you to `reboot` and frolick
|
||||||
|
|
||||||
## Flavor choices
|
# Flavor choices
|
||||||
|
|
||||||
We make the following opinionated flavor choices. Feel free to change them to your liking.
|
We make the following opinionated flavor choices. Feel free to change them to your liking.
|
||||||
|
|
||||||
@@ -133,7 +145,7 @@ We make the following opinionated flavor choices. Feel free to change them to yo
|
|||||||
- Timezone is `Etc/UTC`
|
- Timezone is `Etc/UTC`
|
||||||
- Check `timedatectl set-timezone <tzdata-zone>`
|
- Check `timedatectl set-timezone <tzdata-zone>`
|
||||||
|
|
||||||
## Post-run manual steps
|
# Post-run manual steps
|
||||||
|
|
||||||
After installation you're going to want to at least touch these points in your new Arch Linux install:
|
After installation you're going to want to at least touch these points in your new Arch Linux install:
|
||||||
|
|
||||||
@@ -507,7 +519,7 @@ Explanation:
|
|||||||
zpool/root none off no
|
zpool/root none off no
|
||||||
zpool/root/archlinux /mnt noauto yes <-- Now mounted
|
zpool/root/archlinux /mnt noauto yes <-- Now mounted
|
||||||
```
|
```
|
||||||
- We lastly mount our EFI system partition (ESP), in this example it's living at `/dev/sda1` so adjust this path accordingly.
|
- We lastly mount our EFI System Partition (ESP), in this example it's living at `/dev/sda1` so adjust this path accordingly.
|
||||||
|
|
||||||
```
|
```
|
||||||
# df -hTP
|
# df -hTP
|
||||||
|
2
setup.sh
2
setup.sh
@@ -220,7 +220,7 @@ function select_part () {
|
|||||||
if [[ ! "${parts}" ]]; then
|
if [[ ! "${parts}" ]]; then
|
||||||
case "${part_type}" in
|
case "${part_type}" in
|
||||||
efi)
|
efi)
|
||||||
part_type_human_readable='EFI system partition (ESP) with partition type code EF00'
|
part_type_human_readable='EFI System Partition (ESP) with partition type code EF00'
|
||||||
;;
|
;;
|
||||||
zfs)
|
zfs)
|
||||||
if [[ "${part_schema}" = 'mbr' ]]; then
|
if [[ "${part_schema}" = 'mbr' ]]; then
|
||||||
|
Reference in New Issue
Block a user