Skip to content
Tutorials Center
My learning

Topics

Linux Command Reference ยท Special Files and Directories

The /boot directory

Reference for /boot: vmlinuz kernel images, initrd/initramfs, System.map, GRUB configuration, the EFI partition, and how to clean up old kernels safely.

/boot holds the files needed to start the system before the normal filesystems are available: the kernel image, the initial RAM filesystem and the bootloader's files. The bootloader (usually GRUB, or systemd-boot) reads them from here, loads the kernel into memory and passes control to it.

On many systems /boot is a small separate partition (often 512 MB to 1 GB), mounted at boot. On UEFI machines the EFI System Partition is mounted at /boot/efi (or /efi). Every kernel update adds new files, so this directory is also a classic place to run out of space.

Terminal
ls -lh /boot
uname -r
df -h /boot

Try it

Bash Matching kernel files to the running kernel (sample listing)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash What the kernel tells us about itself

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

File Description
vmlinuz-VERSION The compressed, bootable kernel image.
initrd.img-VERSION or initramfs-VERSION.img Early user space with drivers needed to find the root filesystem.
System.map-VERSION Kernel symbol addresses, used in debugging.
config-VERSION The options the kernel was built with.
grub/grub.cfg (or grub2/) Generated GRUB menu. Do not edit by hand.
efi/ EFI System Partition with .efi loaders (when mounted here).

Related commands: update-grub (Debian family) or grub2-mkconfig -o /boot/grub2/grub.cfg regenerate the menu. update-initramfs -u or dracut -f rebuild the initramfs.

Usage notes

  • Edit settings, not the output. Change /etc/default/grub and then regenerate grub.cfg; hand edits are overwritten by the next kernel update.
  • Space cleanup: remove old kernels with the package manager (sudo apt autoremove --purge, sudo dnf remove --oldinstallonly), never by deleting files. Keep the running kernel and at least one older one as a fallback.
  • Separate partition: if /boot is full, updates fail with "No space left on device" in the middle of installing kernel packages.
  • Do not unmount it carelessly. Kernel updates written while /boot is unmounted land in the wrong directory on the root filesystem, and the system may boot an old kernel.
  • Encryption: with full-disk encryption, /boot is often the only unencrypted part, so it contains no secrets but should still be protected from tampering (Secure Boot).
  • Containers have no real /boot; they share the host kernel.