Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

First of all you need to create a virtual machine with specified parameters. There are some minimal requirements for them, but it is recommended to use the following parameters:

  • Memory - 8 GB

  • CPUs - 4

  • 2 hard drives - 16 GB each

UEFI should be supported. You have to turn this option in WM settings like this:

You also need to connect the Debian 11 ISO image. We will show how to do everything in SPB labs. Here you have to connect this ISO file (debian-11.1.0.-amd64-netinst.iso):

After this you are ready to install Debian. Turn on power on your newly created Virtual Box and launch Web Console. Installation will be in progress and you will just follow the instructions on the screen.

If during the installation you need to setup network manually then in SPB Labs you can do the following steps:

  • after selection the “manual” mode you have to put your IP address for connecting the virtual machine like this:

  • then you need to enter the network mask

  • a gateway address for SPB Labs is:

  • and the name server address is:

Now your local network is ready to use. One another step is important among others. It is hard drives configuration. When the installation procedure asks you - enter the Manual mode:

You will see something like this:

Select the second (sdb) drive and create the new partition there. It will be used for EFI an it’s recommended to allocate 128 Mb for this partition from the beginning of the drive:

You can give it any reasonable name (for example, esp, which means “EFI system partition“) and select EFI System Partition type. And don’t forget to set Bootable flag on.

Then it’s all for the first partition. All other space you have to allocate for the partition that will be used for logical drive. So create the second partition on free space of sdb, allocate all remaining space for it, give it any reasonable name (for example, lvm) and select its type like physical volume for LVM:

Now partitions on the second drive are created and you need to create the logical volume structure. To do this select please the Configure the Logical Volume Manager options:

The installation procedure will offer you to save the partition information before continue:

After saving you’ll see the following menu. Select the Create volume group item please:

Name it, for example, vg0 (volume group 0) and select sdb2 (that is intended for LVM) for this group:

After this you are ready to create the logical volume on your new group. To do this select please the Create logical volume item in the appeared menu:

This volume will be used for the base Debian 11 system that will be later transferred to ZFS. Name it, for example, debian:

You should leave approximately 8 Gb of free space - so, you have to allocate to your logical volume (all free space - 8 Gb):

And write this information by clicking the Finish item:

Then select your new logical volume:

and assign Ext4 journaling file system type and root mount point / for this volume:

Then your HD configuration is ready and you should save all these changes:

Swap space will be defined later. So you have to finish the partition configuration:

Then installation will be continued. Don’t forget please to select the SSH server option in the installed components list if you plan to use remote connection to your Virtual Box in the future:

And after installation is finished just disconnect you ISO image from the Virtual Box and reboot.

After system is restarted you can continue with Web Console or with remote terminal.

Enter superuser mode and install missing packages:

Code Block
su -
echo "deb http://deb.debian.org/debian bullseye-backports main contrib" >> /etc/apt/sources.list.d/backports.list
apt update
apt install linux-headers-$(uname -r) linux-image-amd64 dkms parted rsync dosfstools
apt install zfs-dkms zfs-initramfs zfs-zed zfsutils-linux

Now you can prepare the first hard drive sda for the system installation. To do this run the parted utility and do the following:

Code Block
parted /dev/sda

(parted) unit mib
(parted) mklabel gpt

(parted) mkpart
Partition name?  []? esp
File system type?  [ext2]? fat32
Start? 1
End? 129
(parted) set 1 esp on

(parted) mkpart
Partition name?  []? boot
File system type?  [ext2]?
Start? 129
End? 2177

(parted) mkpart
Partition name?  []? zp0
File system type?  [ext2]?
Start? 2177
End? -1

(parted) q

And then, when partitions are ready, format them please:

Code Block
mkfs.vfat /dev/sda1
mkfs.ext4 /dev/sda2

After format you have to prepare directory structure, ZFS file structure and transfer Debian system to ZFS environment. It’s important to do everything step-by-step in the following order:

Code Block
mkdir /mnt/zpool
zpool create -o ashift=12 -o altroot=/mnt/zpool -O relatime=off -O atime=off -O canmount=off -O compression=lz4 -O xattr=sa -O normalization=formD -O acltype=posixacl -m none -f rpool /dev/sda3
zfs create -o mountpoint=none rpool/ROOT
zfs create -o mountpoint=legacy rpool/ROOT/debian
mount -t zfs rpool/ROOT/debian /
zfs create -o setuid=off -o mountpoint=/home rpool/home
zfs create -V 8G -b $(getconf PAGESIZE) -o logbias=throughput -o sync=always -o primarycache=metadata -o secondarycache=none -o compression=zle -o com.sun:auto-snapshot=false rpool/swap
mkswap /dev/zvol/rpool/swap
mkdir /mnt/zpool/boot
mount /dev/sda2 /mnt/zpool/boot/
mkdir /mnt/zpool/boot/efi
mount /dev/sda1 /mnt/zpool/boot/efi
mkdir /mnt/root
lvcreate -s -n root_snap -L256M /dev/vg0/debian
mount /dev/vg0/root_snap /mnt/root
mount /dev/sdb1 /mnt/zpool/boot/efi
rsync -avPX /mnt/root/* /mnt/zpool/

After this the system is transferred and you can remove snapshot that has been used for system transferring and mount required folders:

Code Block
umount /mnt/zpool/boot/efi
umount /mnt/root
lvremove /dev/vg0/root_snap
mkdir /mnt/zpool/run/udev
mount -t proc none /mnt/zpool/proc
mount --rbind /sys /mnt/zpool/sys
mount --rbind /dev /mnt/zpool/dev
mount --rbind /run/udev /mnt/zpool/run/udev
chroot /mnt/zpool /bin/bash

Then you need to update /etc/fstab file to make boot process correct. Open please this file with any editor. It will look like this:

Code Block
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/vg0-debian /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation
UUID=AAAA-BBBB  /boot/efi       vfat    umask=0077      0       1
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

Run the blkid command to get correct UUIDs for your drives:

Comment “/dev/mapper/vg0-debian …“ line:

Code Block
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
#/dev/mapper/vg0-debian /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation
UUID=AAAA-BBBB  /boot/efi       vfat    umask=0077      0       1
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

Then change UUID for sda1 (UUID=”XXXX-XXXX” in the blkid output):

Code Block
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
#/dev/mapper/vg0-debian /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation
UUID=EBBE-86E5  /boot/efi       vfat    umask=0077      0       1
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

Then add a line for sda2 with correct UUID:

Code Block
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
#/dev/mapper/vg0-debian /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation
UUID=2b1eccc2-a7e5-4984-8d97-e430d94a426f  /boot       ext4    defaults      0       0
UUID=EBBE-86E5  /boot/efi       vfat    umask=0077      0       1
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

And finally add a line for swap, save file and exit editor:

Code Block
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
#/dev/mapper/vg0-debian /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation
UUID=2b1eccc2-a7e5-4984-8d97-e430d94a426f  /boot       ext4    defaults      0       0
UUID=EBBE-86E5  /boot/efi       vfat    umask=0077      0       1
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/zvol/rpool/swap   none       swap    sw      0       0

And finally update GRUB:

Code Block
update-initramfs -u -k all
grub-install /dev/sda
update-grub

Reboot. Congratulations, you Debian 11 is installed on ZFS with UEFI (smile)

After reboot you don’t need auxiliary drives and partitions any more and you can remove them if you’d like:

Code Block
lvremove /dev/vg0/debian
vgremove vg0
pvremove /dev/sdb2

And as a last step run this command to let BeAdm utility working properly (if it exists in your system):

Code Block
echo "BE_LOADER=grub2" >> /etc/defaults/be

The final structure should look like this:

Image Modified