User:Bugalo/Supermicro A2SDi-4C-HLN4F

The Supermicro A2SDi-4C-HLN4F is a low-power server Mini-ITX motherboard. It is fully functional with the latest Linux kernel versions.

Summary
This document will serve as a guide on how to install on the Supermicro A2SDi-4C-HLN4F, to use is as a home  server, with the following configuration:
 * Single boot, in Handbook:AMD64/Installation/Disks with Handbook:AMD64/Installation/Disks mode, using GRUB2 as a boot loader.
 * ZFS on all partitions, except the EFI_System_Partition, including root, with native transparent compression and encryption. Deduplication will not be configured:
 * for all system partitions. Those will be located in two 64GB flash drives.
 * One for data. It will be located in six 8TB hard drives.
 * GNOME with systemd profile.

Bios
...

Preparing the Ubuntu Live Environment
Review the boot process...


 * 1) Create an Ubuntu bootable USB using, for example using UNetbootin.
 * 2) Plug the USB and boot the computer.
 * 3) Access the One-time boot menu of the  by pressing.
 * 4) Choose the appropriate entry to boot from the live USB.
 * 5) In the  menu, choose Try Ubuntu without installing.
 * 6) Connect to the internet through ethernet.
 * 7) Upgrade Ubuntu to use the latest  modules availabe.
 * 8) Verify that  is loaded
 * 9) Create a folder for the Gentoo install.
 * 10) Install the text editor of your choice, e.g. Vim.

Create the ZFS layout
All the partitions of the system will use the Filesystem. allows the use of whole disks, without partitioning, to install the different parts of the system. In this case, the whole disk would be a, and we would create different in it that would be conceptually similar to traditional partitions, but they don't need to have a fixed predetermined size. However, the choice of as a boot manager requires partitioning the disk, i.e a  needs to be created in a partition, not in the whole disk. cannot currently reside in a with advanced features activated, such as encryption. In order to satisfy both requirements of using as a  and having the system residing in  with native encryption, we need to create a  compatible with. Furthermore, a FAT formatted EFI_System_Partition needs to be created.


 * 1) Open.
 * 2) Go to Device / Create Partition Table ... / gpt / Apply.
 * 3) Delete any partition of the USB flash drive.
 * 4) Create a new partition, , in the unallocated space, formatted in , named EFI system partition, with label ESP, of 128MB, and with flags "boot" and "esp".
 * 5) Create an unformatted partition, , in the unallocated space, named Gentoo-Boot, of 896MB.
 * 6) Create an unformatted partition, , in the unallocated space, named Gentoo-Root, occupying the remaining space.
 * 7) Apply all operations and exit.
 * 8) Create a, with all 's unsupported features disabled, in.
 * 9) Create a, for the Gentoo system, in.
 * 10) The status and properties of the pools created above can be checked with the following commands:
 * 11) Create the  where  will reside:
 * 12) Create the  where  will reside:
 * 13) Create the  where  will reside:
 * 14) Mount all the :
 * 15) Check that the  layout is correct:
 * 16) Set the  used for booting:  Check that the   property has been properly set:

Install the Gentoo base system
This section will closely follow Gentoo's AMD64 Handbook, with adjustments where appropriate.


 * 1) Verify that the date and time of the system is correct. If not, fix it:
 * 2) Choose a stage tarball:.
 * 3) Move to the root installation directory:
 * 4) Find the name of the latest amd64 systemd stage3 at http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-amd64-systemd.txt and download it:
 * 5) Unpack the stage3 tarball:
 * 6) Edit make.conf to configure:
 * 7) * The compile options to optimize compiled code, including the CPU_FLAGS_X86.
 * 8) * The global Handbook:Parts/Working/USE variable to specify system-wide package support.
 * 9) * The Handbook:AMD64/Installation/Base variable to select the license group automatically accepted.
 * 10) Configure the Gentoo ebuild repository:
 * 11) Copy the DNS info:
 * 12) Mount the necessary filesystems:
 * 13) Copy the  to the installation directory:
 * 14) Copy, Genkernel will later complain if it does not exist :
 * 15) Chroot into the new environment:
 * 16) Update the Gentoo Ebuild_repository:
 * 17) Choose the appropriate Profile_(Portage):
 * 18) Select fast mirrors available for source code download, by using mirrorselect:
 * 19) Emerge Vim to be used as a text editor:
 * 20) Set the timezone and reconfigure the :
 * 21) Configure the locales to use, at leaset, one UTF-8 locale:
 * 22) * Edit : and uncomment the line referencing  :
 * 23) * Generate the locales:
 * 24) * Reload the environment:
 * 25) Unmask the latest versions of  and :
 * 26) Unmask the latest versions of  and add  support:
 * 27) Update the World_set_(Portage):

Configuring, building and installing the Linux kernel

 * 1) Unmask the latest Kernel versions:
 * 2) Install the Kernel and Genkernel:
 * 3) Add compression support to  in order to be able to load compressed modules:
 * 4) Configure the :
 * 5) * Enable Linux_firmware loading support:
 * 6) * Architecture specific kernel configuration:
 * 7) * Enable support:
 * 8) * Enable Intel Technology support:
 * 9) * Enable support, needed if using a  hard drive;, needed for  devices,  external hard drives and optical drives, etc.:
 * 10) * Enable NVMe device support:
 * 11) * Enable compressed kernel modules:
 * 12) * Enable Device_file support:
 * 13) * Enable support for the Filesystem used:
 * 14) * Enable support for Filesystem_in_Userspace:
 * 15) * Enable support:
 * 16) * Enable support:
 * 17) * Configure USB support:
 * 18) * Configure USB support for input devices:
 * 19) * Enable audio:
 * 20) * Enable Systemd support:
 * 21) * Configure the Aspeed AST2400:
 * 22) * Configure the Ethernet support:
 * 23) * Configure the Xorg support:
 * 24) * Enable NetworkManager support:
 * 25) * Enable System_time support:
 * 26) * Enable Microcode for the Intel_microcode loading support:
 * 27) * Enable NTFS read and write support:
 * 28) * Enable Tmpfs support:
 * 29) * Enable ALSA and PulseAudio sound support:


 * 1) Prepare the kernel for module compilation:
 * 2) Compile the kernel:
 * 3) Install the kernel modules:
 * 4) Install the kernel:
 * 5) Rebuild the installed Kernel_Modules:
 * 6) Use Genkernel to generate an Initramfs:

Install Firmware for Intel QuickAssist

 * 1) Edit, as explained above, to enable  loading support.
 * 2) Update the Kernel, as explained below.
 * 3) Install the Linux_firmware:
 * 4) Add support for individual selection of firmware files to :
 * 5) Comment everything in  except the actual firmware files needed by the system:
 * 6) Re-emerge :
 * 7) After reboot, check that the correct  firmware has been loaded

Configure fstab
With the use of, modifying the fstab file is not strictly needed. However, by editing, an easy way to mount and  will be provided (note the   option.
 * 1) Edit :

Configure the Network

 * 1) Set the computer's name:
 * 2) Install a  client:

Install systemd

 * 1) Edit, as explained above, to enable  support.
 * 2) Update the Kernel, as explained below.
 * 3) Edit make.conf to enable  support:
 * 4) Update the system with  support:
 * 5) Create  as a symlink to :
 * 6) Create a machine ID:
 * 7) Create a hostname:
 * 8) Enable the services needed to mount  filesystems automatically:
 * 9) Create a service to import  automatically and enable it:
 * 10) Create a service to mount  automatically and enable it:

Install GRUB
This guide uses GRUB2 as a boot loader.


 * 1) Edit make.conf to install  for the   platform:
 * 2) Emerge :
 * 3) Get  to probe the  partition:
 * 4) Add parameters to the kernel command line in order to boot from a  partition:
 * 5) Create the  directory:
 * 6) Generate the  configuration file:
 * 7) Check that the configuration file includes instructions to load the  module:
 * 8) Install the bootloader:
 * 9) Check if the  module for  has been installed:
 * 10) Unmount the boot partitions:
 * 11) Allow  to be managed by legacy tools, such as  and the :

User Accounts

 * 1) Secure the  account with a strong password:
 * 2) Create a regular user:

First ZFS snapshot
Create a first. If anythong goes wrong afterwards, it will serve as a backup of a the freshly installed system.
 * 1) Create a snapshot of the boot filesystem:
 * 2) Create a snapshot of the root filesystem:
 * 3) Create a snapshot of the home filesystem:

Rebooting

 * 1) Exit the  environment:
 * 2) Unmount all mounted partitions:
 * 3) Change the mountpoint of the :
 * 4) Reboot into the Gentoo environment:
 * 5) Remove the downloaded  files:
 * 6) If  gives errors regarding the locales, run:

FUSE

 * 1) Edit, as explained above, to enable  support.
 * 2) Update the Kernel, as explained below.
 * 3) Install the userspace  tools:

Sudo

 * 1) Enable the    flag to get funny replies when typing in wrong passwords:
 * 2) Install Sudo:
 * 3) Grant administrator privileges to all the users of the   group by editing the  file:
 * 4) Enable bash completion with sudo:
 * 5) Allow X applications to be run with sudo:

Aspeed AST2400 Graphics
Configure the drivers for the Aspeed AST2400 Graphics.


 * 1) Edit, as explained above, to enable the Aspeed AST2400 graphics support.
 * 2) Update the Kernel, as explained below.
 * 3) Edit make.conf to globally enable Aspeed AST2400 graphics and disable  support:
 * 4) Update the system to reinstall packages with AST graphics support:

Xorg
Configure the Xorg X server.


 * 1) Edit, as explained above, to enable  support.
 * 2) Update the Kernel, as explained below.
 * 3) Edit make.conf to enable  support and set the drivers for input devices:
 * 4) Install :
 * 5) Update the environment settings and source the profile:
 * 6) Install packages to test if the  is working:
 * 7) Install package to test if the 3D acceleration is working:
 * 8) Test if the  is working:
 * 9) Test if the 3D acceleration is working:
 * 10) Exit the X environment:
 * 11) Remove the packages installed for testing:
 * 12) Update the system to reinstall packages with  support:

NetworkManager
Configure NetworkManager support.


 * 1) Edit, as explained above, to enable  support.
 * 2) Update the Kernel, as explained below.
 * 3) Edit make.conf to enable  support:
 * 4) Remove the  support:
 * 5) Update the system to reinstall packages with  support:
 * 6) Enable  to be started at boot time:

GNOME Light
Install a minimal GNOME/Guide Desktop_environment.


 * 1) Edit make.conf to enable  support:
 * 2) Emerge :
 * 3) Update the environment variables and reload the environment
 * 4) Verify that the   group exists and add each  user to it:
 * 5) Enable GNOME/GDM on boot:
 * 6) Install GNOME tweaks and shell extensions for  customization:
 * 7) Provide admin privileges in system dialogs to the users in the wheel group:
 * 8) Allow the  user to launch X window applications:
 * 9) Enable tap to click in GNOME/GDM:

GNOME
From the packages not installed by, install those that are really needed.


 * 1) Install :
 * 2) Install :

Chromium
Install the Chromium web browser.


 * 1) Unmask the latest Chromium ebuild:
 * 2) Emerge Chromium:
 * 3) Open Chromium in incognito mode by default:
 * 4) Enable click-to-install  Shell Extensions through Chromium:
 * 5) * Install the required browser add-on through the Chrome store.
 * 6) * Emerge the backend:

Firefox
Install the Firefox web browser.


 * 1) Unmask the latest Firefox ebuild:
 * 2) Emerge Firefox:
 * 3) Open Firefox in incognito mode by default:
 * 4) Enable click-to-install  Shell Extensions through Firefox:
 * 5) * Install the required browser add-on through Add-ons for Firefox.
 * 6) * Emerge the backend:

Hardware Clock
Configure System_time support.


 * 1) Edit, as explained above, to enable  support.
 * 2) Update the Kernel, as explained below.
 * 3) Check that the  is in use:
 * 4) Configure  automatically update the  from online servers: gnome-control-center > Details > Date & Time > Automatic Date & Time (set on).

Localization
Change some language specific settings.


 * 1) Modify the keyboard layout for the console:
 * 2) Modify the keyboard layout for the X server:
 * 3) Edit make.conf to enable systemwide localization:
 * 4) Update the system with with systemwide localization:

Loading of CPU microcode
Microcode for the Intel_microcode will be loaded by GRUB at boot time.


 * 1) Edit, as explained above, to enable  loading support.
 * 2) Update the Kernel, as explained below.
 * 3) Install the microcode firmware package and the manipulation tool:
 * 4) Mount the  and  partitions:
 * 5) Manually generate the microcode cpio archive:
 * 6) Regenerate the  configuration file:
 * 7) After reboot, check that the microcode has been loaded:

USB support
Configure support for USB devices.


 * 1) Edit, as explained above, to enable  support.
 * 2) Update the Kernel, as explained below.
 * 3) Install the Usbutils to be able to query the  interfaces:

NTFS support
Configure NTFS read and write support.


 * 1) Edit, as explained above, to enable in-kernel  read and  write support.
 * 2) Update the Kernel, as explained below.
 * 3) Enable  flags as needed:
 * 4) Emerge :

tmpfs support
Configure Tmpfs support.


 * 1) Edit, as explained above, to enable  support.
 * 2) Update the Kernel, as explained below.
 * 3)  will automatically mount  as . Place Portage_TMPDIR_on_tmpfs inside :
 * 4) Mount as Tmpfs any other appropriate directory, by using :

ALSA and PulseAudio support
Configure ALSA and PulseAudio support.


 * 1) Edit, as explained above, to enable  and  support.
 * 2) Update the Kernel, as explained below.
 * 3) Edit make.conf to enable  and  support:
 * 4) Update the system to reinstall packages with  and  support:
 * 5) Emerge :
 * 6) Add ffmpeg support to  and emerge it:

S.M.A.R.T. support
Configure Smartmontools support.


 * 1) Install
 * 2) Check if the device has  support
 * 3) Print the health status of a drive
 * 4) Perform a short  test
 * 5) Perform a long  test
 * 6) Show the results of the  tests
 * 7) Print the  error log

Automatic S.M.A.R.T. scans
Configure the Smartmontools to monitor the S.M.A.R.T. information of the drives :


 * 1) Edit   to perform scheduled self-tests. Modify as needed:


 * 1) Enable the  daemon:

ZFS Mirrors
All of the system partitions are set in a  configuration. The following steps can be performed at any point of the installation. However, if only two flash drives are available and one is used for the live environment, it cannot be done until the  system is bootable.


 * 1) Open.
 * 2) Go to Device / Create Partition Table ... / gpt / Apply.
 * 3) Delete any partition of the USB flash drive.
 * 4) Create a new partition, , in the unallocated space, formatted in , named EFI system partition 2, with label ESP_2, of 128MB.
 * 5) Create an unformatted partition, , in the unallocated space, named Gentoo-Boot-2, of 896MB.
 * 6) Create an unformatted partition, , in the unallocated space, named Gentoo-Root-2, occupying the remaining space.
 * 7) Apply all operations and exit.
 * 8) Create a  with   and  :
 * 9) Create a  with   and  :
 * 10) Check the status of the Zpools:
 * 11) Scrub the Zpools:
 * 12) Check the status of the Zpools:

RaidZ2 ZFS data pool
The data set will be in a  configuration. It will consist of 6x8TB hard drives. The following steps have this particularity: two currently filled up hard drives will be part of the array. In order to do that, the array we be created degraded, i.e. without redundancy. The data of one hard drive will be copied over, and then this hard drive will be added to the array, providing a single-drive redundancy. After this, the data of the second drive will be copied to the array, and then the hard drive will be added to the array. The rationale of this procedure is that, at the time of writing this, does not allow for array expansion.


 * 1) The four  hard drives will be tested with a Smartmontools test and a E2fsprogs/badblocks test:
 * 2) * Perform a short and a long test and check the results. Change   appropriately for each disk
 * 3) * Perform a test. Change   appropriately for each disk
 * 4) Open.
 * 5) Go to Device / Create Partition Table ... / gpt / Apply. Repeat for the four hard drives ,  ,   and.
 * 6) Delete any partition of the hard drives ,  ,   and.
 * 7) Create an unformatted partition ,  ,   and  . in each hard drive  ,  ,   and   respectively, in their unallocated space, named Data-1, Data-2, Data-3 and Data-4 respectively, occupying all their available space.
 * 8) Apply all operations and exit.
 * 9) Create the folder where the array will be mounted
 * 10) Create six 7TGB sparse image files in /tmp/zfs_img/ to use as initial hard drives. This will not occupy the whole 30TB because only written areas are allocated
 * 11) Create the  with the six sparse image files, enabling
 * 12) Replace four of the files with the four hard drives
 * 13) Take the remaining two files offline
 * 14) Create any  where the data will reside
 * 15) Check the status of the Zpool:
 * 16) Mount the
 * 17) Copy all the data from one of the extra, full hard drives
 * 18) Scrub the Zpool:
 * 19) Check the status of the Zpools:
 * 20) Perform a short and a long  test and check the results. Change   appropriately
 * 21) Perform a  test. Change   appropriately
 * 22) Open.
 * 23) For , go to Device / Create Partition Table ... / gpt / Apply. Change   appropriately.
 * 24) Delete any partition of the hard drive  . Change   appropriately.
 * 25) Create an unformatted partition   in the unallocated space of , named Data-5, occupying all its available space.
 * 26) Apply all operations and exit.
 * 27) Replace the fifth file with the new hard drive
 * 28) Check the status of the Zpool:
 * 29) Scrub the Zpool:
 * 30) Check the status of the Zpools:
 * 31) Copy all the data from the other extra, full hard drive
 * 32) Scrub the Zpool:
 * 33) Check the status of the Zpools:
 * 34) Perform a short and a long  test and check the results. Change   appropriately
 * 35) Perform a  test. Change   appropriately
 * 36) Open.
 * 37) For , go to Device / Create Partition Table ... / gpt / Apply. Change   appropriately.
 * 38) Delete any partition of the hard drive  . Change   appropriately.
 * 39) Create an unformatted partition   in the unallocated space of , named Data-6, occupying all its available space.
 * 40) Apply all operations and exit.
 * 41) Replace the sixth file with the new hard drive
 * 42) Check the status of the Zpool:
 * 43) Scrub the Zpool:
 * 44) Check the status of the Zpools:

ZFS automatic snapshots
provides scripts used to rotate periodic snapshots through Cron jobs.


 * 1) Install  and :
 * 2) Disable the default cron job that would create a frequent snapshot each 15 minutes:
 * 3) Enable and start the cronie systemd service:
 * 4) Set the   property to   for each  of interest:
 * 5) Enable the desired periodic auto-snaphot jobs on each pool:
 * 6) Modify the cron jobs as needed:

To Do...
Aspeed IPMI in the kernel.

Fan speed:

Fan_speed_control

https://wiki.archlinux.org/index.php/Fan_speed_control

3D acceleration

Xorg/Hardware_3D_acceleration_guide

Sensors

lm_sensors Lm_sensors

https://wiki.archlinux.org/index.php/S.M.A.R.T.

hddtemp https://packages.gentoo.org/packages/app-admin/hddtemp

https://wiki.archlinux.org/index.php/Hddtemp

SSH server: SSH NFS server: Nfs-utils https://wiki.archlinux.org/index.php/NFS Samba server: Samba/Guide

Gparted reporting the whole disk as a single Zpool
At the time of writing this, reports the whole disk as a single  when any of its partitions is formatted with. This is not happening in other disk utilities such as, or. This is due to a bug of the utility, in its stable version, which wrongly reports the disk type. Updating to its latest version fixes this problem:

Wayland
At the time of writing this, the graphics does not support Wayland. If is compiled with  support, the computer will freeze upon booting, before even the login screen.


 * 1) To fix the issue, boot in  and edit   to disable :
 * 2) Disable  support in the system:
 * 3) Re-emerge :

External resources

 * https://github.com/bugalo/gentoo_Supermicro_A2SDi-4C-HLN4F
 * https://github.com/zfsonlinux/zfs/wiki/Debian-Buster-Root-on-ZFS
 * https://wiki.archlinux.org/index.php/ZFS#GRUB-compatible_pool_creation
 * https://www.funtoo.org/ZFS_as_Root_Filesystem
 * https://www.reddit.com/r/zfs/comments/bnvdco/zol_080_encryption_dont_encrypt_the_pool_root/
 * https://wiki.archlinux.org/index.php/ZFS
 * https://github.com/zfsonlinux/zfs/issues/8810
 * https://github.com/HankB/Linux_ZFS_Root/tree/master/Debian
 * https://wiki.archlinux.org/index.php/ZFS#Native_encryption