Skip to content

Partitioning

unicorn edited this page May 14, 2021 · 1 revision

The Partition layout will be as follows:

Partition Filesystem Size Partition type Mount point
DISKp1 FAT32 512MiB - 1GiB ef00 /boot
DISKp2 ZFS REST bf00 /

First, boot from the PC you are going to install ArchLinux to, and boot from the USB Stick. I would recommend starting an ssh server, to do that type systemctl start sshd.service then set a root password with passwd. To connect to the server type ssh root@IP where IP is the IP of your ssh server, to find it, type ip addr.

To start Partitioning type lsblk to find the device you want to partition. It will be referenced with DISK from now on. \

start partitioning with gdisk /dev/DISK (or any other tool)
in gdisk type:

>o => to start new gpt partition scheme
>y => to confirm
>n => to create a new partition (this will be our /boot partition)
> or 1 => to make it the first partition ( means nothing e.g. just press ENTER)
> => to start at the first usable sector
>+xGiB or +xMiB => to make the partition x GiB/MiB
>ef00 => to set the partition type to EFI system partition

now create the second partition for the system

>n => to create a new partition (this will be our / partition)
> or 2 => to make it the second partition ( means nothing e.g. just press ENTER)
> => to make it start at the first usable sector > => to make it end at the last usable sector >bf00 => to set the partition type to Solaris root

then type p to check the partition layout and then type w and y to confirm.

and format the /boot partition to FAT32 with mkfs.vfat -F 32 /dev/DISKp1,
for zfs we need to reference the disk by its id, to get it type ls -al /dev/disk/by-id and remember the id of your root partition e.g. DISK.xxxxxxxxxxxxxxxx-part2 (can have a different format depending on your disk)

now create the pool for your root with: \

zpool create -f -o ashift=X         \
       -O acltype=posixacl       \
       -O relatime=on            \
       -O xattr=sa               \
       -O dnodesize=legacy       \
       -O normalization=formD    \
       -O mountpoint=none        \
       -O canmount=off           \
       -O devices=off            \
       -R /mnt                   \
       -O encryption=aes-256-gcm \
       -O keyformat=passphrase   \
       -O keylocation=prompt     \
       zroot /dev/disk/by-id/DISK.xxxxxxxxxxxxxxxx-part2
X = 9 for 512 bit or 12 for 4096 bit sector size, 
find the sector size with "lsblk -o NAME,PHY-SEC"
​
​
​
​
​
​
​
​
< remove if you don't want encryption
<
<
replace with your root partition id

Note that in this case the root pool is called zroot, same as in the arch wiki. But one may change it to something like rpool, like its typically called in solaris systems.

create the root and home datasets for zroot with

zfs create -o mountpoint=none zroot/data; \
zfs create -o mountpoint=none zroot/ROOT; \
zfs create -o mountpoint=/ -o canmount=noauto zroot/ROOT/default; \
zfs create -o mountpoint=/home zroot/data/home; \
zfs create -o mountpoint=/root zroot/data/home/root;

now check if the any datasets are mounted with zfs get mounted and if so unmount them with zfs umount -a and optionally delete the created folders with rm -rf /mnt/*, then check if everything worked so far with zfs list. The output should look similar to this:

NAME                   USED  AVAIL     REFER  MOUNTPOINT
zroot                  xxxK   xxxG       xxK  none
zroot/ROOT             xxxK   xxxG       xxK  none
zroot/ROOT/default     xxxK   xxxG       xxK  /mnt
zroot/data             xxxK   xxxG       xxK  none
zroot/data/home        xxxK   xxxG       xxK  /mnt/home
zroot/data/home/root   xxxK   xxxG       xxK  /mnt/root
Clone this wiki locally