Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

dracut

Create (or rebuild) the initramfs: the small root file system in RAM that finds and mounts the real root at boot.

Niveau
RHCSA-examen
Groep
Kernel en hardware
Root nodig
Ja
Pakket
dracut

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

The initramfs holds the drivers, LVM/RAID/crypt tools and systemd units needed to reach the root file system. dracut builds it for a kernel; by default only what this machine needs (host-only). Kernel package updates call it automatically. Rebuild it after you change storage drivers, LVM names, /etc/crypttab or module blacklists that matter at boot.

Zo schrijf je het

dracut [OPTION]... [IMAGE [KERNEL-VERSION]]

Opties 38

Meest gebruikt

Basic

-f, --force
Overwrite an existing image.
--kver VERSION
The kernel version (default: the running one).
--regenerate-all
Rebuild the images of all installed kernels.
-v, --verbose
More output.
-q, --quiet
Less output.
--list-modules
List the available dracut modules.
--print-cmdline
Print the kernel arguments for the current setup.

Content

-a, --add LIST
Add dracut modules (like lvm, crypt, nfs, network).
--force-add LIST
Add even if not needed for this host.
-o, --omit LIST
Leave out dracut modules.
-m, --modules LIST
Use only these dracut modules.
-d, --drivers LIST
Use only these kernel modules.
--add-drivers LIST
Add kernel modules.
--force-drivers LIST
Add and load these kernel modules early.
--omit-drivers LIST
Leave out kernel modules.
--filesystems LIST
Add file system modules.
-I, --install LIST
Add these files.
--install-optional LIST
Add files if they exist.
-i, --include SOURCE TARGET
Copy a file or folder into the image.
--kernel-cmdline ARGS
Built-in kernel arguments.
--add-fstab FILE, --fstab, --mount "DEV MNT TYPE OPTS", --add-device DEV
Extra mounts and devices.
--mdadmconf, --nomdadmconf, --lvmconf, --nolvmconf
Include RAID / LVM config.
--fscks LIST, --nofscks
fsck tools to include.
--early-microcode, --no-early-microcode
CPU microcode in the image.
--kernel-only, --no-kernel
Only kernel modules / no kernel modules.
--sshkey FILE
SSH key for network boot unlock.

Host-only

-H, --hostonly
Only what this host needs (default on RHEL).
-N, --no-hostonly
Generic image for any hardware (rescue image).
--hostonly-mode sloppy|strict, --hostonly-cmdline, --no-hostonly-cmdline, --no-hostonly-default-device, --hostonly-i18n, --no-hostonly-i18n, --hostonly-nics LIST, --persistent-policy POLICY
Host-only details.

Build

--gzip, --bzip2, --lzma, --xz, --lzo, --lz4, --zstd, --compress PROGRAM, --no-compress
Compression.
--strip, --nostrip, --aggressive-strip, --hardlink, --nohardlink
Size tricks.
-k, --kmoddir DIR, --fwdir DIRS, --libdirs DIRS
Where to find modules, firmware, libraries.
-c, --conf FILE, --confdir DIR
Other config files.
--tmpdir DIR, -r, --sysroot DIR, --prefix DIR, --noprefix, -l, --local
Build settings.
--logfile FILE, --debug
Logging.
--uefi, --uefi-stub FILE, --uefi-splash-image FILE
Build a unified kernel image (UKI).
-h, --help
Show help.
--version
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Rebuild for the running kernel

    dracut -f

    Writes /boot/initramfs-$(uname -r).img.

  2. 2For a chosen kernel

    dracut -f /boot/initramfs-6.12.0-55.el10.x86_64.img 6.12.0-55.el10.x86_64

    From a rescue disk, take the version from ls /lib/modules.

  3. 3All kernels

    dracut -f --regenerate-all

    After a change that matters for every kernel.

  4. 4Add a storage driver

    dracut -f --add-drivers "nvme"

    When the root disk moved to another controller.

  5. 5Generic rescue image

    dracut -f -N /boot/initramfs-generic.img

    Boots on other hardware (after a P2V/V2V move).

  6. 6Make module options permanent in the image

    echo "options loop max_part=8" > /etc/modprobe.d/loop.conf; dracut -f

    Early modules read the config from the initramfs.

  7. 7Look inside the result

    lsinitrd | less

    Files and dracut modules in the image.

  8. 8Available dracut modules

    dracut --list-modules | head

    lvm, crypt, nfs, network, multipath …

  9. 9Kernel arguments it would need

    dracut --print-cmdline

    rd.lvm.lv=… and root=… for the current setup.

  10. 10Back up before rebuilding

    cp /boot/initramfs-$(uname -r).img /root/initramfs.bak

    A safe way back.

Bestanden

/etc/dracut.conf, /etc/dracut.conf.d/
Settings.
/boot/initramfs-VERSION.img
The images.
/usr/lib/dracut/modules.d/
dracut modules.

Exitcodes

0Done.
1Error.