2.3. Planning the Installed System

The installer asks for the hostname, the administrative account arrangement, the time zone, and the disk layout before it writes the base system. These choices are easier to make now than after services, users, and data exist, and they determine what the first boot checks should expect.

2.3.1. Selecting Hostnames, Accounts, and Administrative Access

The hostname identifies the machine on the local network and in logs. During installation, Debian asks for a hostname and, optionally, a domain name; their combination is the fully qualified domain name. On a machine without a domain, the short name is also what hostname -f returns.

$ hostname
trixie

The command prints the kernel's current hostname. It does not prove that the name is stored persistently or that it resolves.

Option Description
-f Print the fully qualified name.
-s Print the short name, without the domain.
-d Print the domain part of the name.
-I Print all configured addresses for the host.
$ hostname -f
trixie

No domain is configured on the example system, so the result is the short name; a machine with a domain returns something like server1.example.com. The persistent name lives in a file:

$ cat /etc/hostname
trixie

The file contains the static hostname without a domain. Editing it by hand changes the next boot's name but neither the running kernel's name nor the local resolution entries; use hostnamectl set-hostname and check /etc/hosts when changing a hostname on a running system.

$ cat /etc/hosts
127.0.0.1   localhost
127.0.0.2   trixie
::1     localhost ip6-localhost ip6-loopback
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

The first line maps localhost to the IPv4 loopback address. The second maps the hostname to another loopback alias so that local applications can reach the machine by name without an external resolver. A default installation normally writes this entry on 127.0.1.1; the example image uses 127.0.0.2. Either address is a loopback alias and never reaches the network. The IPv6 lines provide the standard localhost and multicast names. The mapping is used before DNS:

$ getent hosts trixie
127.0.0.2       trixie

If this lookup fails, local applications that use the hostname can fail even when DNS works. Check that the name in /etc/hostname also appears in /etc/hosts.

The installer also decides how the system will be administered. If a root password is set, the root account can log in directly. If the root password is left blank, the installer disables the root password, installs the sudo package, and arranges for the first ordinary user to administer the system through it. That is the default path; a preseeded or otherwise customized installation may differ - Chapter 27 covers preseeding - so the arrangement is worth verifying on the machine in front of you rather than assuming.

The examples in this book run as john, an ordinary account with sudo membership - the arrangement a default installation produces for its first user. The account record comes from the name service switch:

$ getent passwd john
john:x:1001:1001::/home/john:/bin/bash

The fields are the account name, a password placeholder, the user ID, the primary group ID, the comment field, the home directory, and the login shell. The password hash is not here; it is in /etc/shadow, which ordinary users cannot read. The privilege that matters is the supplementary group:

$ getent group sudo
sudo:x:27:john

The sudo group exists and john is its member; membership in it is the standard way a Debian system grants an ordinary account the right to run commands as root. The account's password status adds one more fact:

$ sudo passwd -S john
john P 2026-11-18 0 99999 7 -1

passwd -S prints the account name, the password status letter, the date of the last change, the minimum and maximum age, the warning period, and the inactivity period. P means a usable password is set; L would mean the password is locked, which blocks password-based login.

Whether the privilege path actually works is a separate question from the policy. sudo remembers a successful authentication for a short period, so first discard any cached credential; -k is silent when it succeeds.

$ sudo -k

Then run one command with sudo. The password is requested the first time and is not echoed while it is typed.

$ sudo id -u
0

The command runs as root, so id -u prints 0. This is a stronger check than reading the policy files, because it exercises the path the account will use. Chapter 1 showed the full policy listing with sudo -l, and Chapter 5 covers account management and sudo policy in detail.

2.3.2. Choosing Partition Layouts for Desktop and Server Systems

The partition layout determines how the system uses the disk, how much space each part of the filesystem can consume, and how difficult recovery will be. A desktop and a server can both run from a single ext4 partition, but a server that stores logs, web content, or virtual-machine images usually benefits from separate filesystems or from LVM.

The example machine has one virtual disk and one partition. lsblk shows the device tree and mount points.

$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
NAME    SIZE TYPE FSTYPE MOUNTPOINTS
vda     100G disk        
└─vda1  100G part ext4   /

The disk is vda, the partition is vda1, the filesystem is ext4, and the partition is mounted at the root of the tree. There is no separate /boot, /home, /var, or swap. That is a valid simple layout; it is not a recommendation for every role. findmnt shows the mount that backs a path and the options in effect.

Option Description
-n Omit the header line.
-o list Select output columns.
-T path Show the mount that contains path.
--fstab Read the static table instead of the running mount table.
$ findmnt -no SOURCE,FSTYPE,OPTIONS /
/dev/vda1 ext4 rw,relatime,discard,errors=remount-ro

The root filesystem is mounted read-write with relatime access-time updates. discard passes TRIM requests to the virtual disk; the installer adds it on devices that report support. errors=remount-ro makes the kernel remount the filesystem read-only after serious errors instead of continuing to write to a damaged filesystem. The partition table can be inspected without changing it:

Option Description
-l List partition tables and exit without changing anything.
-l device List one device instead of all devices.
-x Show extended partition information.
$ sudo fdisk -l /dev/vda
Disk /dev/vda: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3427c43a

Device     Boot Start       End   Sectors  Size Id Type
/dev/vda1  *     2048 209715199 209713152  100G 83 Linux

The disk has 209,715,200 sectors of 512 bytes - 100 GiB. The label type dos is the MBR partition table, and the single partition starts at sector 2048, which leaves the usual 1 MiB alignment gap at the front of the disk. The boot flag is set, which BIOS boot uses. A UEFI machine would normally show a GPT (disklabel type: gpt) and a small FAT32 EFI system partition in addition to the root filesystem.

How much room the layout actually has is part of the plan. df reports both block capacity and inode usage, because a filesystem can run out of either.

Option Description
-h Show sizes in powers of 1024 with human-readable suffixes.
-i Show inode usage instead of block usage.
-T Show the filesystem type.
-x type Exclude filesystems of the given type.
$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        98G  4.9G   88G   6% /
$ df -i /
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/vda1      6553600 122284 6431316    2% /

The root filesystem has 98 GiB of capacity, of which 4.9 GiB is used - the example image carries a full Xfce desktop task in addition to the base system - and about 6.5 million inodes, of which about 122,000 are used. Percentages rise as packages, logs, and data accumulate. Swap is also part of the layout:

$ sudo swapon --show

The command is silent on the example system because no swap area is active. That is honest minimalism for a virtual machine, not a general recommendation: a machine that hibernates needs swap at least as large as its RAM, and a server benefits from some swap as a buffer against memory pressure.

The installer's guided partitioning offers several schemes. The minimum sizes come from the Installation Guide; they are floors for the scheme to fit, not recommendations for a busy machine.

Scheme Minimum space Created partitions Suitable for
All files in one partition 8 GB /, swap Simple desktop or virtual machine
Separate /home 9 GB /, /home, swap Desktops that must preserve user data
Separate /home, /var, /tmp 12 GB /, /home, /var, /tmp, swap Desktops or small servers with predictable separation
Separate /srv and /var, swap limited to 1 GB 8 GB /, /srv, /var, swap Servers hosting services
Small-disk scheme 3 GB /, swap Very small virtual machines

A server that hosts web content or application data usually separates /var and /srv from the root filesystem so that logs and service data cannot fill the root. A desktop separates /home so a reinstallation can preserve user files. A virtual machine can keep one filesystem and grow the virtual disk later, but growing is easier when the filesystem sits on LVM.

Role Baseline layout Why
Desktop or laptop ESP on UEFI, /, swap, optional /home Simple; separate home preserves user data; encryption suits a portable machine
General server ESP on UEFI, /, /var, /srv, swap, preferably on LVM Logs and service data do not fill the root; volumes can grow
Virtual machine MBR or GPT, /, swap Easy to rebuild; the virtual disk can be enlarged
Multi-boot system Existing ESP plus a new root, or manual partitions Preserve the other operating system's boot files and data

Partitioning is destructive. Before accepting any layout, confirm the disk by size and model, confirm that the correct disk is selected, and back up data that must survive. A disk with an existing operating system must not be overwritten unless that operating system is disposable.

2.3.3. Selecting Guided Encryption, LVM, or Manual Partitioning

The installer can create partitions directly on the disk, place them inside LVM, place LVM inside an encrypted container, or leave the layout to manual partitioning. The choice changes how the system grows, how it is recovered, and what an attacker can read from a powered-off disk.

Single ext4 and guided encrypted LVM layouts

Figure 2.3. The tested single ext4 layout compared with a conceptual guided encrypted LVM layout. The left stack was observed on the example machine; the right stack is documented.

Method What it creates Growth and recovery Best for Cautions
Guided classic Partitions directly on the disk, ext4 root, swap Grow or shrink with partition tools; simple recovery Simple desktop, virtual machine, small server Space cannot move between partitions easily; no volume snapshots
Guided LVM Separate /boot, an LVM physical volume, a volume group, logical volumes Grow logical volumes online; add disks to the group; recovery needs LVM tools Servers that will grow or need flexible allocation More layers to inspect; /boot stays outside LVM
Guided encrypted LVM Separate /boot, a LUKS container, LVM inside it, logical volumes Same as LVM, plus a passphrase at boot; recovery needs LUKS and LVM tools Laptops and servers holding sensitive data at rest A lost passphrase loses the data; header backup is essential; the initial overwrite takes time
Manual Any supported combination of partitions, LUKS, LVM, RAID, and filesystems Depends entirely on the layout Multi-boot, custom storage, pre-existing disks Easy to damage the wrong disk or omit a required partition

Guided classic partitioning is the least complex. The installer creates a root filesystem and swap, and the root filesystem can use the whole disk. It can be grown later if free space follows the partition, but moving space from one partition to another is not an online operation.

Guided LVM creates a small /boot partition outside LVM and places the root, swap, and optional separate filesystems inside logical volumes. The volume group can span one or more disks, and logical volumes can be enlarged when the group has free extents. This is the usual choice for a server whose storage requirements are not final. The cost is an additional layer: the boot loader reads the kernel from /boot, and the initramfs must activate LVM before it can mount the root logical volume.

Guided encrypted LVM adds a LUKS container between the partition and the LVM physical volume. The passphrase unlocks the container during boot, and LVM then finds the logical volumes inside it. Before creating the container, the installer overwrites the selected disk with random data, which makes it harder to tell which blocks a previous installation used and destroys all old data; on a large disk the overwrite takes time. The /boot partition stays unencrypted because the boot loader must read the kernel and initramfs before a passphrase can be entered. If the machine hibernates, the swap volume must be inside the encrypted container too, because hibernation writes memory contents to swap.

Encryption protects data at rest, not a running system: once the volume is unlocked, access to the data follows normal file permissions. It also changes recovery - a lost passphrase, a damaged LUKS header, or a lost key slot makes the data unreadable even on a healthy disk. Keep a backup of the LUKS header and a recovery key in a safe place, and test that the backup unlocks the volume. Chapter 13 covers LUKS and LVM administration, including headers and key slots.

Manual partitioning is appropriate when the disk already contains an operating system, when the layout must match an existing encryption or RAID scheme, or when the guided schemes do not provide the required mount points. On a UEFI system, create a FAT32 EFI system partition - a few hundred MiB leaves room for GRUB and firmware-update payloads - and mount it at /boot/efi. On a BIOS system, the disk needs boot code in the MBR, and a separate /boot is optional unless the root filesystem is on LVM or encryption.

The installer writes the partition table only after a confirmation screen. With guided classic partitioning, changes can be undone until the final write. With guided LVM or encrypted LVM, some changes are written while the volume is being set up and cannot be undone.

The installer is about to erase the selected disk. Selecting the wrong disk destroys its data. Back up first, read the device name and size on the confirmation screen, and do not proceed if the disk is not the one you intend to erase.