Installing Debian 12: A step-by-step guide for Installation process, with a central focus on Manual Disk Partitioning, file systems, and LVM Setup
In the . This minimal image contains just the minimal amount of software to install the base system and fetch the firmware/utilities of your choice over the Internet.
Then, I have created a bootable USB stick (16 GB size was more than enough), and burned in there the downloaded Debian .iso file. In the BIOS menu I have selected this UEFI device to boot with. I will be using Graphical Installer. It is preferably that your PC is connected to internet via cable during installation with “netinst” .ISO.
① On the first screen after booting, I select “Graphical Install” to proceed with guided installation via GUI, even though personally I prefer “Install” option that also guides you through installation process but via terminal-style interface (TUI). If you enter in the Advanced options, you will have the opportunity to install Debian using shell commands (advanced, not guided mode).
③ Next, you’ll be asked to provide both a hostname and a domain name. Hostname: the name of your computer on a network. It’s used to identify your machine among other devices connected to the same network. It should be unique within your local network — i.e if you have Desktop PC and laptop and you are installing on them Debian, you cannot choose for both of them hostname “debian”.
④ The following step is important — you will be prompted to set up a strong root password. Choose a combination of letters, numbers, and special characters to secure your system. Setting up root password you automatically enable root user. It’s strongly not advisable to use the root login routinely! It is suitable only for specific system administration tasks (first post installation steps and troubleshooting).
After installation, logging in as root you will be able to add your user account to the sudoers group, allowing you to execute commands with root-level privileges using sudo + <command>. This approach provides an extra layer of oversight, as you’ll need to re-enter your password for commands that will affect your entire system and not only user space, giving you a moment to reconsider the actions prompted by such commands.
If you choose to leave the root password blank during setup, your user account will automatically receive sudo privileges to perform tasks requiring root access. Be cautious with this setting; lacking a root password can complicate accessing recovery mode or GRUB during system recovery, potentially restricting your troubleshooting options. After the installation is completed I will cover in more detail the difference between execution commands as root and as user with sudo. Right after setting the root password you will be prompted to create a user. If you decided to leave root password blank, the user you create during installation will be granted with administrator privileges.
⑤ The next step is about selecting on which storage device (further for simplicity — disk) your Debian will be installed. This step is named Partition disks. You will see 5 options:
, before any )
If you’ve only used graphical installers and selected the full guided option for this installation step in the past, you may not have explored the details of how your storage device hosting the OS is configured, as the scripts handled it for you.
However, once you start using the OS after installation, eventually you might (the probability of this “might” depends on how do you use your PC) find yourself in situation when something goes wrong with the disk hosting your OS. An at this moment you wish you’d known and understand these configuration details better— such as which partitions are used, how they are mounted, and which file systems they are formatted with… That’s why I cover the Partition disks step of the installation in very detail.
In the end, there is always a slim probability that something can go wrong with the different hardware components of your PC (not during the installation of Debian, don’t worry, but later, when you start using it with a spirit of experimentation). However, the most devastating issue is when something goes wrong with disks (incorrect configuration, usage, or configurations modification), because ALL your data stored on them are at stake.
⑤.② Physical storage devices: understanding its properties and identifiers
During the installation process, before this step, the hardware on which the system is to be installed is scanned, and various devices, including disks, are discovered. If you have multiple disks, they should all appear in the list, which you can have a look at if you select any option that starts with “Guided-use entire disk” from the options of partitioning step (screenshot from above), (don’t worry, you always can go back and change your selection). I see this:
more details). Indeed, Samsung SSD and Seagate HDD are connected via SATA interface, however, they are using protocol SCSI, so they are identified as SCSI devices. All SATA disks are usually called using a naming convention “Storage Device+ Alphabet letters” — /dev/sda, /dev/sdb, /dev/sdc etc. — with the last letter indicating their “id” in the list (NB! **id letter is automatically assigned on each boot, it is not a reserved identifier of a hardware piece, and it is not associated with a disk!**).
And what if for your SSD disk you see instead of /sdX something like /dev/nvme0nX? First, in Linux systems, /dev stands for "devices" (later in this article, you'll understand why a hardware device like a disk appears as a filename). Second, /nvme0nX refers to NVMe, which stands for Non-Volatile Memory Express. It's simply another interface, similar to SATA, but specifically designed for SSDs. This interface allows for incredibly fast data transfer speeds. It also requires a dedicated "attachment slot" for compatible disks, and if your motherboard is fairly new, it most likely has one. However, not all SSDs are compatible with this slot. Some, particularly older models, are designed exclusively for the SATA interface.
⑤.③ Physical storage devices: preparation steps to enable them to “accommodate” Operating System
Okay, let’s continue with partitioning process. Even though the installer identified all disks, however, whether they are brand new (free space only) or already have something on them (in which case Debian will identify existing partitions), they are not yet ready to accommodate any operating system.
If you have another OS installed and plan to wipe it and replace it with Debian, you cannot do it without partitioning process. A partition has a start and end point, and if there is already a partition with something on it that spans the entire physical disk (and all OSs create partitions for themselves), there’s no room for a new OS. The same is true for a completely new disk — it just doesn’t have any defined start or end points yet. To understand the importance of the starts and ends of partitions and how they affect a usability of a disk — my little life story:
I once had to create installation medium for a specific custom OS. The requirement stated that a 16 GB USB drive would be sufficient, and there was a custom script to convert the USB drive into installation medium. I executed this custom script and… I ended up with a pen drive in a temporary “brick” state (no reading/writing from/on this storage device was possible). How come? The installer script “marked” the start of new partition and began writing data, but the USB drive apparently was too small (the size requirement for USB drive was incorrect), and the end of the partition didn’t fit. Later, I found out that the OS installation files were about 20 GB. At the end, the PC could detect this USB per drive physically, but there was no way to read/write anything from/on it except by wiping it out, repartitioning and formatting.
Please note, that formatting disk ≠ simple erasing all data; the process is much broader. Anyway, in my sporadic writing style, I mentioned things like free space, partitions, their start and end points, and formatting… So, let’s get back to the list of my disks and see which disk can accommodate Debian.
)
Also, you can notice that SSD has one very large partition — almost equal to the entire disk size (other Debian was installed without advanced partitioning, there are boot, swap and huge “system” partitions only).
For the purposes of this article, I’ll be installing Debian on the Seagate HDD, which I typically use for tests and articles, as you can see by its messy partitions. I want to clean up the current “partitions soup” on that disk and install Debian on a part of this disk ( I plan to dedicate 400GB of this disk for this installation). Here is schematic representation of the processes that I will be executing to achieve it:
” topic. If you’re curious, feel free to check out the link and read all the math behind it).
And now we arrive at another non trivial topic: filesystems and why, in my diagram above on the right, there’s a strange bookshelf with very well-organized books.
⑤.④ File Systems, Directories and Mounting Options
In Linux/Unix operating systems everything is a file, even directories are files, files are files, and devices like mouse, keyboard, printer, etc are also files.
Filesystem controls how data is stored and retrieved. Without a file system, information placed in a storage medium would be one large body of data with no way to tell where one piece of information stops and the next begins ( ← the parallel with well organized bookshelf comes from here). A file system separates the data into pieces and gives each piece a name. Each group of data is called a “file”. There are many different kinds of file systems. Each one has different structure and logic, properties of speed, flexibility, security, size and more (
The diagram above contains information about what is each directory is responsible for. Schematic representation of information provided here: .
Let’s sum it all together — what separate partitions are and what they offer:
, exactly this file manages all the mounting when you boot in into your system.
Another reason for separating certain directories into their own partitions is the choice of filesystem. 1 partition = 1 filesystem . You can’t have multiple filesystems on the same partition. Why would you even want different filesystems? And are there many? Yes, there are, and each has its own strengths, quirks, and specific use cases. You can check the full list here whether a specific filesystem is supported as a ‘system’ filesystem in Debian releases. One filesystem I find particularly interesting is Btrfs, which is based on the copy-on-write (COW) principle and comes with an integrated logical volume manager. It was designed to tackle the limitations of traditional Linux filesystems, like the lack of pooling, snapshots, checksums, and multi-device spanning. I’m definitely going to try it out on one of my virtual machines.
Here’s my personal advice, based on my experience: If you have a large disk (over 1TB), whether it’s an SSD or HDD, split system on separate partitions however you like — whatever feels necessary for you. Want
/opton a separate partition but unsure if any third-party software will actually use it, even though what you’ve read about partitioning is convincing? Go for it. Want /var/log on a separate partition? Do it. Want/usr/localon its own? Do that too.
However, if you have a smaller disk, say 120GB, I recommend not split system into separate partitions it, except maybe putting
/homeon a separate partition. Why? Because while separate partitions might look as a good fit mathematically, in practice, you’ll find your system slowing down if any partition is more than 90% full. And one more thing: if you create physical partitions on your small disk without using LVM, that’s fine—but logical partitions change things, by fragmenting the disk to some extent, and usable space of a small disk will become even smaller.
To sum it up: if you have a big disk, partition it as you like and set up LVM. If you have a small disk, keep the system in one partition, maybe splitting off
/home. However, if your small disk is just temporary—let’s say you’re getting new ones in the next few days or weeks—go ahead and create partitions as you want, and set up LVM.
⑤.⑤ Logical Volume Manager
And this brings us to a “word” you might be especially interested in — Logical Volume Manager (LVM). I’ll explain how to configure it, but first, let’s talk about the default Debian filesystem, which is the most common across many Linux distributions. It’s important to understand how this filesystem stores data on disk before diving into how to set up LVM.
In Debian, )
The term “journal” comes from the analogy of a diary. Any changes you record in a diary entry are stored date- and time-wise. In a similar way, journaling allows all the updates to a file to be stored in a contiguous portion of the disk()
How is all this information related to LVM, partitioning, and installation? We’ve finally arrived at the conclusion — how all these details wrap together in LVM. We’ve identified the partitions we want to create, the filesystems to use… but how big should they be? After going through all this, you might be tempted to throw your hands up and say, “BASTAAA! I just want everything together with the default ext4 filesystem — let’s move on with the installation!” But even then, you need to answer a simple question: how big should your system partition be?
If you have a 500GB SSD, you can simply span the whole drive from start to finish — and that’s fine. Nowadays, 500GB isn’t considered a huge storage space. But what if you have a 5TB disk? Or even a 2TB one? Do you really want to dedicate all that space to your system? If you set it up without using LVM, you’re making a definitive choice that’s difficult to change later. On the other hand, if you have a small disk, like 120GB, and plan to install a lot of software or binaries, you may run into issues down the line. Sure, there are workarounds, like mounting extra storage under /data, but that can quickly become a hassle, especially when you need to remap paths every time you install something.
If you take the “everything-on-one-big-disk” approach and your disk is pretty big, you’ll likely waste a lot of storage space. And while expanding storage is often manageable with various solutions, shrinking a root partition? That’s tricky and risky. Shrinking a system partition can lead to problems.
Below is a diagram that displays a bottleneck of partitioning disk without LVM:
Schematic representation of Volume Group that spans over two disks. Volume Group contains logical volumes + some FREE SPACE (sorry for my 3D drawing XD)
A logical volume is a broader concept — it can span across more than one physical device or partition (yes, you can even add just a part of a disk to a volume group!). A logical volume is similar to a traditional partition. So, when we talk about separate partitions for
/varor/homein the context of LVM, we’re really referring to separate logical volumes for/varor/home.
Please note that I’ve intentionally drawn the logical volumes as schematically different shapes, not perfectly aligned rectangles. This is to illustrate that while the volume group sits on top of physical partitions with precise start and end points on the physical disks, what happens in between — within the space dedicated to volume group — is managed in a more abstract way. So, there isn’t a neat or precise allocation of logical volumes within the volume group, and therefore on the disk. In a way, logical volumes can increase fragmentation of your physical disk space. Keep that in mind.
First, I click on the disk where I plan to create partitions, both logical and physical, and click Continue. After that, I’ll be informed that I’m about to create a new partition table for this disk. DON’T WORRY — this is not a definitive step. Nothing you do at this stage will be immediately applied to the disk without your confirmation, which usually happens at the very end of this process.
In my setup, ESP is already existing and it is on SSD drive, together with the OS I installed first
I guess you may prefer to have everything together on a selected disk for your new OS. But this is impossible with UEFI; it can have ONLY ONE bootable partition for your whole PC, so you cannot just have this ESP for each system. If all your other systems are Linux, when booting you will see a GRUB TUI selection menu. When it comes to Windows, then you will see the same GRUB menu, and from there you can boot Windows or the newly installed Debian.
Before UEFI, it was indispensable to have a separate
/bootpartition which should have been flagged as bootable partition. Why separate? Because it had just the essentials to boot your system, and legacy mode is quite ancient, and you couldn't be sure that to access your booting configs it would have been able to mount all the system that is under / if your/bootis part of it. UEFI is much more advanced, so it does not suffer this problem; however, if you choose to encrypt your LVM volume group and do not separate/boot... well, you will not be able to boot.
So, if your PC uses UEFI mode (it is indicated when you enter BIOS or when you started to install Debian; it also shows which mode it uses), AND if the Debian you are installing will be your first or single OS on your PC, I would allocate between 500MB-1GB for the
/bootpartition. If it is not your first installed OS and you're in UEFI mode, then I would allocate 300-500MB to it. This/bootpartition will contain only the following files in this case: initrd (Initial RAM Disk), vmlinuz (The Compressed Linux Kernel) (more details here about what they are
Create New Partition →Choose the size of it →Decide where it should be — at the beginning of the disk or at the end →Check overview, change if needed → Done setting up the partition
Select FREE SPACE (tot size-boot partition size) →Choose the size of it →Decide where it should be — at the beginning of the disk (after boot partition) →in drop down menu of **use as** select physical volume for LVM
The last physical partition I’ll create is the swap partition. I have 64GB of RAM on my PC, and I don’t use it as a server. If you search on internet about how big should be swap partition, you’ll often find the rule of thumb that swap should be 2x the size of your RAM. However, that advice is a bit outdated and mostly applies to older, weaker machines with 2–6GB of RAM. For me, having a 128GB swap partition is pretty unreasonable. There aren’t many situations where my system will use swap memory… I have desktop setup, so I do not plan to use functionality of hibernate/suspend. Moreover, I do not plan to use any Desktop Environment that consumes a lot of memory (especially Gnome). So I’m just dedicating 1GB to swap partition. To understand better what swap is used for, check out and
Select FREE SPACE (tot size-boot partition size-physical partition for LVM) →Choose the size of it →Decide where it should be — at the beginning of the disk (after physical LVM partition or at the end of the disk (in my case it would have been after FREE SPACE that follows physical partition of LVM) →in drop down menu of use as swap area.
Now I can begin setting up the volume group and its logical volumes. Remember, the volume group is a broader concept. In my case, the volume group will be created on a part of the disk — 400 GB of the previously created partition #2 as a physical volume for LVM. However, I can easily expand the volume group later by adding a new physical partition, which could reside on a completely different disk.
My advice is not to rush into adding all your free physical disks to the volume group right away. Keep in mind that when you have multiple disks as part of a volume group, LVM doesn’t always write in an organized way — it’s not like it neatly writes from left to right or keeps everything close together. It might write a bit on one disk and then a bit on another. So, if later you realize that you don’t actually need all those disks in your system, it won’t be that easy to free one up. You’ll need to transfer all its data to another physical disk.
The volume group is now created, and its “children” — the logical volumes — can be created next. I give them names that correspond to the filesystem parts I want to separate from the system and place into separate logical partitions (logical volumes).
You need to repeat the same steps for all partitions you want to separate logically. I’ve created the following logical volumes: root — 100 GB, home — 100 GB, var — 20 GB, tmp — 10 GB. Why these sizes? First, they are logical volumes, so I can afford to start with smaller
/tmpand/varpartitions and expand them later based on my usage. Second, home is larger because I often work in a user environment rather than system-wide. I frequently use a chroot space-consuming environments to build packages from source and test them. Root is that big because/usr, with all its binaries, is part of it, and knowing myself I will install and try various packages.
I’m personally completely fine dedicating around 500 GB for my OS, as I don’t have a shortage of storage devices. If you do, you can definitely reduce the size of root or home a bit. Similarly, I recommend not making them too big. If you’re setting up LVM, it’s better to start with slightly smaller volumes rather than larger, because shrinking your system partition can be risky, even if it’s logical.
Here’s an overview: in the main menu of the Logical Volume Manager, select “Display configuration details.” I see this:
Change “Use as” with a filesystem of your choice →Select right Mount point →Change/approve mounting options →Done setting up the partition
Here is the final result!
⑧ This step is the reason why I go for netinst — I want to have the minimum utilities preinstalled. So, I only tick the last option. I don’t install any desktop environment, as in the next article, which will be dedicated to Debian personalization, I’ll be installing and configuring a window tiling manager. I won’t be using any desktop environments. That’s all, after installation process completes you will be informed when everything is ready to reboot!
Don't hesitate to ask any questions in comments section!
↗ Original-Artikel auf dev.to lesenVollständiger Original-BerichtAusführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
SOCIAL SHARE CARD GENERATOR