Many installation guides are overly complicated by using specific utilities like anaconda, livecd-tools, Fedora Media Writer and others, or by creating a kickstart script file. Fedora already has the required custom installation tools. This article will show an example for installing on a USB flash drive and hard drive
Attention! Everything that you do, you do at your own peril and risk, because operations in this manual may result in partial or complete loss of data.
Note: Presumably, the base system is installed on / dev / sda, and the target disk or flash drive is connected to / dev / sdb. In your case, this may be another disk, for example, an SSD M.2 drive, recognized by the system as / dev / nvme0n1
Disk layout
GPT for large hard disk
sgdisk --zap-all /dev/sdb
sgdisk -o /dev/sdb
sgdisk -a 4096 -n 1:0:+1M --typecode=1:ef02 /dev/sdb # BIOS Boot
sgdisk -a 4096 -n 2:0:+1G --typecode=2:8300 /dev/sdb # /boot
sgdisk -a 4096 -n 3:0:+8G --typecode=3:8200 /dev/sdb # swap
sgdisk -a 4096 --largest-new=4 --typecode=4:8300 /dev/sdb # XFS
sgdisk -A 1:set:2 /dev/sdb
MBR for USB stick
sfdisk /dev/sdb << EOF
label: dos
device: /dev/sdb
unit: sectors
sector-size: 512
/dev/sdb1 : start= 2048, type=83, bootable
EOF
Formatting partitions
XFS for hard drive
Why XFS? Because dynamic inode allocation is convenient for a large number of small files, for example, if you have many git projects
mkfs.ext4 -F /dev/sdb2
mkswap --force /dev/sdb3
mkfs.xfs -f /dev/sdb4
EXT4 for USB stick
mkfs.ext4 -b 1024 /dev/sdb1
Mount filesystems
For hard drive
mount /dev/sdb4 /mnt
mkdir /mnt/{boot,dev,sys,proc}
mount /dev/sdb2 /mnt/boot
For USB stick
mount /dev/sdb1 /mnt
mkdir /mnt/{boot,dev,sys,proc}
Installing the base system
My gentlemen's kit contains some helper utilities for system administration
dnf -y --installroot=/mnt --releasever=33 group install standard core \
hardware-support development-libs development-tools
dnf -y --installroot=/mnt install iptables gpart gdisk rsync nano tcpdump \
tcsh grub2-pc net-tools bind-utils sysstat xfsprogs
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
cp /etc/resolv.conf /mnt/etc
chroot /mnt /bin/tcsh
dnf -y install kernel
grub2-install /dev/sdb
grub2-mkconfig -o /boot/grub2/grub.cfg
exit
! resolv.conf , .. systemd-resolved
fstab
uuid " " .
blkid --output export /dev/sdb2 | grep ^UUID= | xargs -I '{}' echo {} /boot ext4 rw,relatime 1 2 > /mnt/etc/fstab
blkid --output export /dev/sdb4 | grep ^UUID= | xargs -I '{}' echo {} / xfs rw,relatime 0 0 > /mnt/etc/fstab
blkid --output export /dev/sdb3 | grep ^UUID= | xargs -I '{}' echo {} swap swap defaults 0 0 > /mnt/etc/fstab
USB
blkid --output export /dev/sdb1 | grep ^UUID= | xargs -I '{}' echo {} / ext4 rw,relatime 0 0 > /mnt/etc/fstab
. , .
echo 'root:123' | chpasswd --root /mnt
groupadd --root /mnt admin
useradd --root /mnt -m -d /home/admin -s /bin/bash -g admin -m admin
echo 'admin:admin' | chpasswd --root /mnt
umount /mnt/dev
umount /mnt/sys
umount /mnt/proc
umount /mnt/boot
umount /mnt
USB
umount /mnt/dev
umount /mnt/sys
umount /mnt/proc
umount /mnt
bare-metall ,