Linux Install & setup

Partitioning during Linux install

Practical Linux guide: partitioning during Linux install without the usual guesswork.

10 min read Beginner Updated 9 Jun 2026

Step-by-step guide

Work through each section in order. Stop when your issue is resolved — you do not need every step for every situation.

Warning

Back up important data before repartitioning, encrypting disks, or restoring backups. Wrong commands can destroy partitions or overwrite live files.

What you will achieve

Confidence choosing partition layouts during install — separate /home, swap strategy, EFI vs BIOS, and when LVM is worth the complexity.

1) Know your firmware mode

[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

UEFI needs an EFI System Partition (FAT32, ~512 MB, mount /boot/efi). Legacy BIOS often uses a dedicated /boot partition (ext4, 1 GB) when using LVM or encryption.

2) Common server layout (single disk)

  • /boot/efi — 512 MB (UEFI only)
  • / — 30–50 GB ext4 (or btrfs on Fedora/openSUSE)
  • /var — optional, isolates logs and Docker data
  • swap — partition or file; 0–8 GB depending on RAM and hibernation needs

3) Desktop layout with separate /home

Keeping /home on its own partition lets you reinstall the OS without touching user data. During reinstall, mount the existing /home but do not format it.

4) LVM and encryption

Debian's guided "encrypted LVM" creates a physical volume, volume group, and logical volumes for swap, root, and home. Useful for snapshots and growth — see the LVM basics guide for post-install resizing.

Verify

lsblk -f
df -hT

Confirm mount points match your plan before leaving the installer.

5) Swap sizing guidance

  • RAM ≤ 8 GB: swap equal to RAM if hibernation desired; otherwise 2–4 GB.
  • RAM 16–64 GB: 4–8 GB swap for OOM safety; hibernation needs swap ≥ RAM.
  • Servers with 128 GB+ RAM: often 4 GB swap or zram — see swap guides.

6) Separate /var for databases and Docker

PostgreSQL, MySQL, and Docker images grow without bound. A dedicated /var partition prevents a full /var from making root read-only and breaking login.

7) Align partitions on SSD/NVMe

Modern installers align to 1 MiB boundaries by default. For manual parted:

sudo parted /dev/nvme0n1 mklabel gpt
sudo parted -a optimal /dev/nvme0n1 mkpart primary ext4 1MiB 100%

Post-install resize

Growing partitions is easier than shrinking. If unsure, leave unallocated space for later LVM extension rather than tight sizing every volume at install time.

8) GPT vs MBR legacy

UEFI requires GPT. BIOS can use MBR but GPT is fine on modern hardware. Windows 11 mandates UEFI+GPT — factor that into dual-boot plans.

Prerequisites

Know total disk size (lsblk), firmware mode (UEFI vs BIOS), and whether dual-boot shares disk with Windows. Have install ISO ready before committing partition table — resizing later is possible but annoying.

Encrypted boot partition note

/boot often stays unencrypted on LUKS setups so GRUB can load kernel. Separate /boot partition (not inside LVM) is standard on Debian encrypted installs.

Related guides

install linux partitioning