- Update README setup distro list - Show battery percentage in GNOME - Fix `full-script` not exiting on failure - Add manual script for Zellij - Rename ab-av1 aliases - Fix fish setup - Change SSH port - Include JXL, date tools, tokei, f3 - Update setup guide to Fedora 42
191 lines
8.3 KiB
Markdown
191 lines
8.3 KiB
Markdown
# Fedora Installation
|
|
|
|
Here is how I installed Fedora. I chose to migrate from ext4 to btrfs, the
|
|
default file system for Fedora. I also bought a new disk, which means that I
|
|
needed to create everything from scratch.
|
|
|
|
_Note: This document details the installation only. For setup, see
|
|
[Fedora System Setup](fedora-system-setup.md) or
|
|
[Fedora User Setup](fedora-user-setup.md). This is originally written
|
|
for Fedora 39 and updated to Fedora 41._
|
|
|
|
By following these steps, you will be able to install Fedora with:
|
|
- `/` as a btrfs subvolume using xxhash as the checksum function on LUKS2 (an
|
|
encryption layer)
|
|
- `/home` as another subvolume on the same btrfs (which means it's also
|
|
encrypted)
|
|
- `/boot` as ext4
|
|
- `/boot/efi` as System EFI Partition
|
|
|
|
A disk password will be required upon boot and a separate user password will be
|
|
required. `/boot` is not encrypted because it contains only the kernel files
|
|
and are public and the same for all Fedora installations -- there's nothing
|
|
worth encrypting here. Benchmarking shows that there's a negligible performance
|
|
overhead.
|
|
|
|
After extensive benchmarking, I found SHA-256 to be too slow for practical use
|
|
even with the sha_ni kernel module for acceleration. Without acceleration the
|
|
speed was ~400 MB/s, and with acceleration the speed was ~1500 MB/s, but my disk
|
|
is capable of ~6000 MB/s. crc32c gave me ~5000 MB/s, and xxhash gave me ~4500
|
|
MB/s, which I found acceptable, so that's what I went with.
|
|
|
|
## Making a Fedora Live USB
|
|
|
|
Simply go to the Fedora project website and download Fedora Media Writer or the
|
|
ISO. I sometimes opt not to use the Fedora Media Writer because I like
|
|
collecting Linux ISOs. It shouldn't impact the result.
|
|
|
|
### Fedora Media Writer
|
|
|
|
Pick automatic download and select Fedora Workstation. Flash your USB stick.
|
|
|
|
### ISO
|
|
|
|
After the download you may find the GPG-signed SHA256 checksum file from the
|
|
icon next to the ISO download. You may find the GPG key fingerprints and
|
|
instructions to verify via the links there.
|
|
|
|
Simply `dd` it to the disk and `sync` before pulling the USB out. _Make sure
|
|
you have backups and are using the right disk! A friend of mine didn't and
|
|
corrupted his disk._
|
|
|
|
## Preparing the SSD
|
|
|
|
Boot the USB. Open Disks by typing its name and pressing enter. Make a GPT
|
|
partition table by using the three dots at the top right.
|
|
|
|
(If you have plaintext data on the drive, you really should do a NVMe sanitize.
|
|
You may find instructions on doing that by looking up the man page for the
|
|
`nvme` command.)
|
|
|
|
Make a large empty partition with no file system (choose "unformatted") leaving
|
|
10240 MiB at the end of the drive. You can do this by typing 10240 into the
|
|
bottom text box (free space at the end) and clicking into the top box to refresh
|
|
its calculation.
|
|
|
|
Make a 1024 MiB partition at the very end of the drive and format with ext4,
|
|
then make another one right before it and also format with ext4.
|
|
This is easier on gparted then GNOME Disks, but you can accomplish the same
|
|
thing by making a 8192 MiB temporary partition then deleting it after making the
|
|
two 1024 MiB partitions at the end.
|
|
|
|
Formatting here really isn't necessary if not for the Fedora installer graying
|
|
out all the fields when it doesn't detect a file system (bug?).
|
|
|
|
I assume that you are using an UEFI system as almost all modern x86_64 systems
|
|
have that, but you could verify that with `[ -d /sys/firmware/efi ] && echo UEFI
|
|
|| echo BIOS`.
|
|
|
|
Now, make the LUKS2 layer by opening a terminal and typing:
|
|
|
|
`sudo cryptsetup luksFormat --use-random /dev/<root-partition>`
|
|
|
|
...where `<root-partition>` is the big partition you made first and should look
|
|
something like `/dev/nvme0n1p1`. There are some sane defaults that I didn't
|
|
include in this command as all new systems should have them by default, but you
|
|
could spell it out if you want to be extra certain: `--type luks2 --key-size 512
|
|
--cipher aes-xts-plain64 --iter-time 2000 --verify-passphrase`
|
|
|
|
Then, unlock this encrypted partition by typing: `sudo cryptsetup open /dev/
|
|
<root-partition> <mapper>`, where `<mapper>` is the name for the mapper file and
|
|
doesn't matter for our install. You could just use `luks`.
|
|
|
|
Now, make the btrfs file system with xxhash as the checksum function: `sudo
|
|
mkfs.btrfs --csum xxhash /etc/mapper/<mapper>`. I didn't use LVM here as btrfs
|
|
snapshots are much better and support RAID0/1 well. btrfs snapshots doesn't
|
|
have LVM snapshots' heavy performance penalty, doesn't require pre-allocation of
|
|
space which is often wasted, and doesn't become invalid later when its space is
|
|
used up.
|
|
|
|
Then, close the LUKS layer as the installer requires the password to it for
|
|
installation. If you skip this step, you would be forced to rescan in the
|
|
installer which closes it after you've already selected your configuration.
|
|
|
|
## Installing Fedora
|
|
|
|
Now, start the installer. Choose your keyboard layout and timezone. Then click
|
|
into storage configuration.
|
|
|
|
I have some commands for unlocking the LUKS in my Ubuntu install guide, but here
|
|
you can simply unlock the LUKS volume and the installer does all the work for
|
|
you setting that up.
|
|
|
|
- Format `<boot-partition>` (e.g. `/dev/nvme0n1p3`) as ext4 and mount to `/
|
|
boot`. (Check the format checkbox.)
|
|
- Format `<efi-partition>` (e.g. `/dev/nvme0n1p2`) as System EFI Partition and
|
|
mount to `/boot/efi`.
|
|
- Format `/dev/mapper/<machine name>-root` as ext4 and mount to `/`.
|
|
- Format `/dev/mapper/<machine name>-home` as ext4 and mount to `/home`.
|
|
- No need for swap as
|
|
[Fedora uses zram by default](https://fedoraproject.org/wiki/Changes/SwapOnZRAM).
|
|
|
|
Now click "Done" and start your install! It took only ten minutes for me.
|
|
|
|
Now, reboot into your newly installed system and test it out. Make sure it
|
|
works before migrating your data as that may take a long time, so you don't want
|
|
to do it again.
|
|
|
|
## Migrating all the data
|
|
|
|
Open up your retired machine, pop up the SSD, put it in a NVME enclosure, and
|
|
plug it in.
|
|
|
|
Now, if you'd like, take a snapshot: `sudo mkdir /snapshots && sudo btrfs
|
|
subvolume snapshot /home /snapshots/home-default`
|
|
|
|
My install is quite old and is from Ubuntu so it contains lots of files past
|
|
their shelf life. I hit `Ctrl`+`h` to unhide all hidden files and compared the
|
|
two file trees side-by-side and removed all conflicting or obsolete files. Now,
|
|
start the copy: `time sudo cp -a -T <old-path> ~` where `<old-path>` is path to
|
|
your old home directory. This took 22 minutes for me.
|
|
|
|
Now, reboot again to load these files.
|
|
|
|
## After the install
|
|
|
|
Congratulations! You've reached the end of this guide. After the install,
|
|
check out my [configuration guide](fedora-setup.md) and see if you'd like to
|
|
pull some bits from that.
|
|
|
|
## Some interesting notes
|
|
|
|
btrfs uses zstd level 1 compression by default. This saves substantially for
|
|
`/`, and a little bit for `/home`:
|
|
```
|
|
$ sudo compsize -x /
|
|
Processed 121050 files, 95144 regular extents (114629 refs), 60336 inline.
|
|
Type Perc Disk Usage Uncompressed Referenced
|
|
TOTAL 55% 3.6G 6.6G 8.4G
|
|
none 100% 2.1G 2.1G 2.3G
|
|
zstd 35% 1.5G 4.5G 6.0G
|
|
prealloc 100% 1.2M 1.2M 11M
|
|
$ sudo compsize /home
|
|
Processed 1178463 files, 1863614 regular extents (1907988 refs), 519681 inline.
|
|
Type Perc Disk Usage Uncompressed Referenced
|
|
TOTAL 94% 1.2T 1.2T 1.2T
|
|
none 100% 1.1T 1.1T 1.1T
|
|
zstd 36% 40G 110G 113G
|
|
prealloc 100% 1.2M 1.2M 1.1M
|
|
```
|
|
|
|
In my testing I managed to reach `91%` by forcing compression, but I didn't use
|
|
it as I don't think `3%` is worth the performance hit. (The default options has
|
|
negligible performance overhead.)
|
|
|
|
After using it for a while:
|
|
```
|
|
$ sudo compsize -x /
|
|
Processed 356866 files, 228300 regular extents (347966 refs), 187319 inline.
|
|
Type Perc Disk Usage Uncompressed Referenced
|
|
TOTAL 56% 11G 19G 30G
|
|
none 100% 6.9G 6.9G 9.8G
|
|
zstd 32% 4.1G 12G 20G
|
|
prealloc 100% 1.2M 1.2M 22M
|
|
$ sudo compsize /home
|
|
Processed 1204163 files, 2035560 regular extents (2142558 refs), 501390 inline.
|
|
Type Perc Disk Usage Uncompressed Referenced
|
|
TOTAL 95% 1.3T 1.4T 1.4T
|
|
none 100% 1.3T 1.3T 1.3T
|
|
zstd 35% 38G 107G 111G
|
|
prealloc 100% 215M 215M 115M
|