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 previous part of this Debian12 series of articles (4 parts), I covered many details about the philosophy of the Debian distribution — what Debian offers, how it packages software, the main releases besides the Stable one, how to use Debian in a “Debian” way, and how to determine if Debian is a good fit for you. If you enjoyed it so far and I’ve sparked your curiosity about Debian, let’s move on to the installation!
This article is quite long, but that’s not because installing Debian is difficult. In fact, you can complete the installation in about 20 minutes without any assistance, as the Debian installer smoothly guides you through the process and provides nice explanation of each step. Even if you’re completely unsure about what to select, it offers default options that are perfect for beginners with Linux systems.
My aim in this article, however, is to give you as much detail as possible so that you, can feel fully confident with your Debian OS from the very start.
The longest part of this article is dedicated to the process of advanced manual configuration of storage device/devices that will host Debian (using Partitioner integrated into Installer):
❧ Disk/diskS partitioning
❧ Choosing filesystems for partitions
❧ Setting up of Logical Volume Manager (LVM)
I’ll be using the Debian network install because it allows me to install only the essential packages. However, it does not mean that I will have to install firmware manually, because the Installer scans my PC’s hardware and installs all necessary available firmware.
Let’s get started! The first 4 steps are fairly straightforward. However, if terms like hostname, domain, or root user are not very clear for you, don’t worry! I’ll explain all of them in detail.
⓪ First, I downloaded Network Install or netinst from here. 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).
② On the following three screens, you will be prompted to select the language for the installation, your localization, and keyboard layout. You can adjust these settings later in case of misalignment (for instance, I prefer the English language and am located in Italy, but I select United Kingdom as my location because, oddly, the English-Italy bundle is not available).
③ 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 domain name is used in larger networks including the Internet. For personal or local networks, you might not need a specific domain name. At this step I choose hostname on my taste and ** domain** leave blank.
④ 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:
In my opinion, this is the most important step of the installation: while you can modify things like network configuration, user name, passwords, country, language, etc., your decision about disks is more definitive — especially if you choose the first option: Guided — use entire disk. There’s nothing wrong with this option, and if you don’t want to go too much in details, go for it. But if you’re looking for understanding what is Partition disks step about, this part of the article is for you. So let’s begin. I’ll be using the Manual option from the menu above.
⑤.① What is this disk partitioning about?
Disk partitioning is the creation of one or more storage regions (called partitions), so that each region can be managed separately. It is typically the first step of preparing a newly installed disk, before any file system is created. The disk stores the information about the partitions’ locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct “logical” disk that uses part of the actual disk (Source)
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:
That’s correct, I have 3 storage devices attached: 1 SSD (500GB, Samsung), 1 HDD (1TB, ST1000DMxxxx (further — Seagate)) and the last one is the installation medium — USB pen drive with Debian 12 net install .iso. You may notice that all listed disks do follow same naming convention. 3 devices are identified as SCSI (Small Computer System Interface) and this name (only name!) pointing to pretty old technology (see here 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.
As you can see, on the Samsung SSD, I have another old Debian. Notice that this SSD has 1 MB of FREE SPACE at the beginning and the end. This is standard — these two free space disk sectors are automatically created due to the partitioning method used, called GPT (GUID Partition Table).
By writing the GPT header and partition table at the beginning of the disk and also at the end of the disk. If the original GPT header and partition table gets deleted or corrupted, the backup header and partition table can be used to help restore the drive (more details here)
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:
This is what will happen to my Seagate HDD disk during this installation step dedicated to disk partitioning (a flow on the right diagram):
- All data will be wiped out, and the existing partitions will be destroyed — new partition table will be created and written. As a result, I’ll have approximately 1 TB of free space (I say approximately and use rough numbers because I don’t want to dive into the whole “Why are hard drives never as large as advertised?” topic. If you’re curious, feel free to check out the link and read all the math behind it).
- In this free space, one or more partition*S* will be created (the choice whether it will be one “system” partition or few functional ones is yours, and I assume you’re reading all this to make that decision).
- Then, this partition or partition*S* will be formatted into some filesystems (again, your choice, but thee chosen file systems have to be compatible with the Linux kernel — so no NTFS Windows stuff).
- That’s all. Proceed with Debian installation.
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 (source).
Before discussing different file systems, let’s start with directories structure. Directory structure of Debian can be represented like a tree:
If you look on the left, I have placed “the parent” — root. And all “children”-directories are placed “under” it. And that is the one very popular way of partitioning — all in the same directory. How does it look this process behind? You take some free space of your disk, you create a partition over it, you put a one file system over it, that is suitable for Linux Kernel, and you place all these things in this partition. That's all. If during installation process you opt for “Guided - use the entire disk” and then select "All in the same partition” option, then everything, all the files and directories, will be located under ‘root’, except boot and swap tiny partitions that will be created automatically.
So you may be wondering, what is it all about then if Partition disk Installation Step is THAT simple? Well, here is another my life story:
When I was using Ubuntu OS and had my Brave browser installed from the Snap repository, it had a nasty bug. The browser kept panicking and writing to the syslog non-stop, and I never noticed it. Then, I occasionally noticed that the log file had grown to 400 GB! I don’t remember exactly if it was solely the browser’s fault, but either way, I only had around 480 GB of total space for my entire OS, all of it under root. If I hadn’t caught it, I was at serious risk of losing my system and not being able to boot without using recovery mode.
Of course, some might say it’s my fault for not checking and setting up a simple bash script to monitor it… but things happen. That said, it’s worth sign /var
as a potentially problematic ‘child’ of root
Consider another scenario: let’s say you’re downloading all seasons of Naruto in some super-mega high resolution. The files slowly download into your /home
directory, you go to bed, and leave the PC running… Then again, you can’t boot because your /home
directory ballooned to an enormous size and consumed all the space under root. So, mark /home
as another potentially problematic ‘child’ of root.
Now, another case: imagine you’re using Debian in a slightly reckless way, installing odd software or building from source, and you fall victim to script-like malware that drops itself into the /tmp
directory — pretty common for these things. For it to cause damage, it needs to be executed… It would be great if anything under /tmp
couldn’t be executed unless you explicitly allow it, wouldn’t it? Meanwhile you are marking /tmp
as another problematic ‘child’ of root, note the added benefit of separating all these directories: it opens up the possibility of using specific mounting options for them!
To understand the process of mounting partitions, think of a USB pen drive with some software on it — let’s say, Photoshop. You insert the pen drive, and it gets detected. What happens next depends on your PC’s configuration. If you’re logged in as a regular user, you might not see anything on the pen drive because only administrators (root) are allowed to ‘mount’ USB devices [mounting option: user / nouser].
If you can see the content, you might try to run Photoshop — execute it — but it will fail because there’s a restriction that prevents anything on the pen drive from being executed [mounting option: exec / noexec]. If you can execute it, and there are photos on the drive, you might open Photoshop, edit the photos, and then try to save the changes — but that will fail too. That might depend on the fact that there is a rule that allows only read operations, so you can’t write new files or update the version of Photoshop on the USB pen drive [mounting option: ro / rw].
In this example, several mounting options were mentioned, find the full list of mounting options here fstab — Debian Wiki.
Let’s sum it all together — what separate partitions are and what they offer:
You might notice in some partitioning schemes, there’s a partition for /opt
. It’s quite common to place it on a separate partition. There can actually be other variations, depending on how you use your PC. Some decisions are guided by mounting options — for example, there’s the view that /usr
should be on a separate partition that’s mounted in read-only mode by default, as a security measure. All the apps and software you install have their binaries placed in /usr
. If you’ve had experience with Linux, you might have noticed that to update, upgrade, or install something using a package manager, your user needs to be part of the sudoers group (running command with sudo
) or you need to do it as root. That’s because a regular user can’t write to /usr
. Some users prefer to separate also /var/log
or /var/mail
.
However, there are limits, and you shouldn’t overdo partitioning. For instance, /etc
cannot be moved anywhere — it must remain part of the “system” partition because it contains crucial files like fstab
(file System table). fstab
can answer a common concern: if you go for separate partitions in Debian, do you have to manually mount each one every time you turn on your PC? The answer is no. You define the mounting options during installation, and you can change them later if needed. fstab
(/etc/fstab
) file is a system configuration file on Debian systems fstab — Debian Wiki, 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 FileSystem — Debian Wiki.
Why use different filesystems for your partitions? Well, some filesystems are better suited for the types of operations that typically occur on certain partitions. If you’re planning to use Oracle databases, it makes sense to put them on a separate partition and format it with ZFS, which is well-suited for that purpose. Personally, for system, home, and var, I tend to stick with the same filesystem, but the choice is yours, and you can pick whatever suits your needs — or just go with the default, as I often do.
You can also check in this table 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 /opt
on 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/local
on 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 /home
on 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, ext4 is the default file system for new installations.
Ext4 is journaling filesystem. What does it mean?It maintains a journal of operations not yet committed to disk, and is able to prevent some amount of data loss after a system crash or power failure. If an ext4 filesystem is determined “unclean” on boot (traces of remaining operations in the journal), the system will run fsck and attempt to repair the filesystem, and write uncommited blocks to the lost+found/ directory. At the very least, the filesystem will be restored to a working state (source)
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(source).
And here is important part for understanding LVM:
These updates do not have to be located physically in proximity to each other: in fact, the journal file entries are scattered all over the disk. But instead of accessing them randomly, they are available in a diary-like sequence which is thousands of times faster (source)
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:
Remember about start end end of partitions? Here they are. 6 partitions on a single disk + some FREE SPACE close to #6 partition /tmp. Can you enlarge any partition except the last one, #6? NO. In a safe way, no. Tweaking around, yes, but that always bring a risk.
That’s where LVM — Logical Volume Manager — comes into play. LVM is the answer if:
❧ You have a bunch of SSDs, but each of them is small per se — let’s say, only 100GB.
❧ You don’t know how much space you’ll need for your system and have a massive SSD.
❧ You’re worried about making the wrong choice for partition size and what that your choice are less definitive in the feature.
LVM offers the flexibility to resize, combine, and manage partitions easily, without committing to a setup that’s hard to change later. It’s what you need when you’re uncertain about your future storage needs.
Finally, let’s bring this theory in action!
First, make sure you memorize the SCSI ID and the mounting ID very well. For SATA devices, it will appear as a letter like sdX. During installation, the installer won’t give you a detailed name for your storage devices, and at some point, you’ll be asked to confirm writing changes to disk sdX. It would be a real pity if you accidentally destroy something valuable by selecting the wrong disk.
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 /var
or /home
in the context of LVM, we’re really referring to separate logical volumes for /var
or /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.
Next, click on a FREE SPACE that should appear and be equal approximately to disk size. Click Continue to create a first separate /boot
partition, physical one, outside a Logical volume.
NB! About /boot
partition:
Remember the image of the first step in this article about UEFI vs. BIOS (legacy) mode? This is the installation moment where the mode matters. This is a turning point if your to-be-installed Debian is not the only operating system on your PC—not just on a disk, but the whole PC.
When you enter your BIOS with a special key like F2 after you turn on your PC, it's the unique BIOS for your PC, agnostic of any operating system. BIOS is on your motherboard. The same goes for the UEFI bootloader; its roots go exactly there. UEFI mode is agnostic to your installed OSs. How does it work? When you install your first OS, it places the EFI System Partition (ESP), a specially tagged partition (which is usually formatted using the FAT32 filesystem) on the same partition where your first OS's /boot
is residing.
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 /boot
partition 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 /boot
is 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 /boot
partition. If it is not your first installed OS and you're in UEFI mode, then I would allocate 300-500MB to it. This /boot
partition 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 here) and some other system related information needed for booting.
PS. If it crossed your mind to think about what will happen if you wipe your disk where the ESP bootloader of UEFI is located, then the answer is to back up this directory periodically.
Debian I install is not the first OS on my PC, and I have UEFI BIOS.I dedicate 500 MB to the /boot
partition and place it at the beginning—it will be the first partition. Then, I select the filesystem (ext4) and leave the mounting options as default. The bootable flag is off, even though intuitively, it seems like it should be on. You can try turning it on, but it won’t work if you’re installing Debian as not first OS in UEFI mode. NB! If you are installing Debian as a single/first OS, /boot
partition should be flagged as bootable and formatted as fat32 filesystem not ext4!
Next, I need a physical partition that I’ll use as part of the Volume Group (LVM). I’ve decided to dedicate 400GB to it.
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 Swap — Debian Wiki. Moreover, if your PC has a big amount of RAM you can even go without dedicated swap partition — there are kernel modules as Zram and Zswap which allow compressing the swap inside RAM.
NB! If you are unsure, place your swap partition in a way that it can be expanded — do not squeeze it between other physical partitions. Even though I’ve done it differently (3 screenshot above), you can place your swap partition at the end of the disk instead of the beginning, so you can easily increase it if needed. Remember the diagram about starts/ends of partitions from section ⑤.⑤? A partition with free space on the left or right can be enlarged.
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 /tmp
and /var
partitions 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:
If I return to the main menu which shows situation with partitions of my disks, I should see new LVM logical volumes on top of the list.
We’re almost there! Now, by clicking on each logical partition (>#X), you can format it into the filesystem you want, choose the mount point, and set the mounting options. I mount root to to its corresponding directory with default mounting options and format it as ext4 filesystems.
Quick recap:
❧ The nodev
mount option specifies that the filesystem cannot contain special devices.
❧The nosuid
mount option specifies that the filesystem cannot contain cannot contain set userid files.
❧The noexec
mount option specifies that the filesystem cannot contain executable binaries.
❧ The /tmp
directory is used to store data used by the system and user applications for a short period of time. NB! This directory is intended to be emptied after each reboot.
❧ The /home
directory is used to support disk storage needs of local users
❧ _The /var
directory is used by daemons and other system services to temporarily store dynamic data.
Since the /tmp
, /var
and /home
are not intended to support devices, I set nodev
mount option to ensure that users cannot create a block or character special devices in these directories.
I set nosuid
option for /tmp
, /var
and /home
to ensure that users cannot create setuid files in these directories.
I format /home
, /tmp
and /var
as ext4 filesystems.
Here is the final result!
⑥ After this, the installation will proceed. You’ll be prompted to select the country where you’re located to choose the closest repository mirror, to minimize latency while installation. Then, you’ll be asked to select one of the mirrors closest to you based on your previous country selection.
You’ll also be prompted to enter a HTTP Proxy name — you can leave it blank unless you have another Debian PC on the same network acting as a proxy server. This option is particularly useful for system administrators managing an infrastructure. First, the OS being installed is generally in a vulnerable state during installation, as it doesn’t have its defenses up. Plus, using a proxy is great if you need to install the exact same bundle of utilities, firmware, and precise versions on multiple PCs.
However, regarding security, if you’re installing on your home network, the risks are small. But if you’re using a public network, it might not be the best idea to install Debian with netinst while connected to the network.
⑦ Your decision about anonymous contributions: I strongly advise clicking “Yes.” It would be a nice gesture, and you’ll be passively contributing to the improvement of Debian!
⑧ 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!
That's all! You can now boot into your fresh Debian installation after detaching the USB medium
Confirmation of the system's functioning and the status of partitions/disks:
After reboot and login (as root) I run these commands:
df -h
cat /etc/fstab
lsblk
fdisk -l
#you can also explore the content of your /boot directory with
ls -la /boot
Here are my outputs:
Don't hesitate to ask any questions in comments section!
Top comments (0)