Install Debian Buster on your server

If you rented a virtual server at your favorite hosting company then you already have a ready installation of Debian Buster. If you have a chance to change the partitioning scheme then please create a separate partition for /var/vmail as described below. Otherwise feel free to skip this page.

Basic installation and partitioning

Installing Debian Buster is easy. Get a boot medium from the Debian website. The smaller network installer is sufficient – it will download all required packages directly from the internet. Make sure you choose ‘English’ as the installation language even if it is not your native language. If you have trouble with the server you will more likely find help when searching for English error messages on the internet.

Most of the installation is pretty simple. You don’t need me holding your hand. Just if you are not used to using the logical volume manager (LVM) I won’t leave you alone. So I will provide a step-by-step partitioning guide below with screenshots and explanations.


The only part that takes some patience is when it comes to partitioning your disk. Throughout this tutorial you will store your users’ emails in the /var/vmail partition. The MariaDB database will live in /var/lib/mysql and is usually pretty small even for a large number of email accounts – so that won’t require a separate mount point. Log files go to /var/log.

So my recommendation for partitioning boils down to:

  • Boot partition, 300 MB, first partition of your disk (e.g. /dev/sda1), mounted at “/boot”
  • All the rest of the disk goes into one large LVM physical volume, second partition of your disk (e.g. /dev/sda2)
    • LVM volume group consisting of that one physical volume
      • LVM logical volume for “/”, 10 GB, formatted as ext4
      • LVM logical volume for “/tmp”, 5 GB, formatted as ext4
      • LVM logical volume for “/var/vmail”, formatted as ext4, as much space for mailboxes as you want to start with

LVM is very flexible. You can enlarge your root partition or “/var/vmail”. You can even add another physical disk and join it into the volume group to get more space. So just start small.

Let me guide you through the configuration of the logical volume manager (LVM) setup which is a bit tricky at first. LVM gives you a lot of flexibility to move or enlarge partitions without interrupting the operation of the server. If you haven’t worked with LVM please learn how to use it. That is a very valuable skill and in hindsight not evil at all.

Now comes a series of screenshots I took during an exemplary installation. At each step I will first show you the screenshot and after it explain what I recommend you to enter.

When asked about the partitioning schema choose Manual.

Select the disk to use.

If you install Debian on a fresh disk you will get asked whether to create a new empty partition table. Confirm that.

The available space on your disk will be shown as FREE SPACE. Select that line.

Choose to create a new partition.

Your first partition will be used for the “/boot” partition. These files are necessary to start the server. This is the place where the Linux kernel and the initrd (init ramdisk) live. 300 MB is a pretty good value for its size.

Just choose Primary for the partition type. This is a legacy of old MS-DÖS times. There could be only four primary partitions and a number of logical partitions. And Windoze was supposed to live in a primary partition to boot. If you are really interested in the bloody details see Wikipedia on the MBR.

A lot of empty space lies before us. Let’s just creating the first partition at the very Beginning of the space.

Set the new partition to:

  • Ext2 file system
    (I sometimes use Ext4 and it works. But Debian usually is very conservative and just uses the old Ext2).
  • Mount point is “/boot” – that’s where the partition will be visible in your file system
  • Bootable flag = on.

So that’s it for the boot partition. Now let’s use all the remaining space for physical volume. That is a term for some device that provides space to use within the logical volume manager (LVM). See the beginning of this section for a distinction of PVs, VGs and LVs. Create a new partition.

The overview shows you the “/boot” partition you just created. Now select the FREE SPACE again.

The number shown in this dialog is already the size of the remaining free space on disk. Just press enter. Or enter “max” if you like.

Once again choose Primary. We can have four primary partitions and we will just use two anyway.

As the type choose “Physical volume for LVM“. That’s it.

Now the overview shows you the boot partition and the large lvm partition. To further set up LVM please choose the “Configure the logical Volume Manager” menu item.

The installer wants you to write the partition table to disk first. Sure, do that.

The first order of business is creating a volume group (VG). You can group any number of physical volumes (PV) under one group. Well, you just have one physical volume. But to use it you still need a volume group.

The volume group needs to have a name. I tend to prefix my volume groups with “vg…”. Some call it “vg0” or “vg00”. You might also name it after your favorite pet.

As I said a volume group contains several physical volumes. You created /dev/sda2 as an LVM partition which is the same as a physical volume. Move the cursor down to the large second partiton. Press SPACE to select it. Then use TAB to select Continue.

The volume group is now created as you can see in the counter that shows “1”. Now the last step is to create logical volumes in that group.

Select the volume group that the logical volume should live in. Well, there is just one volume group so the choice is simple.

Give the logical volume a name. Again I name those like “lv…” to be clear. But that’s up to you. First we need a root partition. That’s the top of the file system at “/”. I suggest you name it “lvroot”.

Just like with normal partitions we need to set an initial size. Remember: you can later extend that partition/volume at any time without anyone noticing adn within a couple of seconds. So don’t worry if it turns out to be too small. I would start with 10 GB.

Now you have one logical volume. Very nice. Create another one.

Again the mandatory question which volume group we want to use.

The next logical volume will be for “/tmp”. Let’s call it “lvtmp”.

Let’s start with just 5 GB.

And now to the final partition. This time it will be the place where all the mailboxes will be stored.

Again cho… oh, well, I start to sound like a broken MP3…

Call the volume whatever you like. What about “lvmail”?

Maybe you have a good guess how much space the users’ mailboxes will take up. To start playing around I’ll start with 10 GB. But even a terabyte may be a reasonable number.

So that’s it for the LVM setup. Finish him!

Your partitions should now look like this. All that is left to do is tell the installer what file system you want for the logical volumes and where to mount them. Start with the lvmail volume.

Set the type to “Ext4 journaling file system” and the mount point to “/var/vmail”. I also recommend setting the noatime option under the “Mount options”. Why? Because the file system usually stores the last access time of a file which causes roughly one additional write access per read access. (The reality is a bit more complicated and has to do with the relatime flag if you want to research it.) Dovecot does not need access times so this speeds up mailbox accesses and saves wear on your disk.

Okay, “/var/vmail” looks good. Now choose the lvroot volume.

Also make it an “Ext4” partition. Mount point is “/”. That’s it.

The last partition to configure is “/tmp”. Choose the lvtmp volume.

That’s also an “Ext4” partition. Set the mount point to “/tmp”.

Enjoy all the glory you just set up. A boot partition with ext2. And a couple of logical volumes mounted to the right places. Nice. Finish the process.

Oh, noes. We forgot the swap partition. Or not? Don’t worry. I deliberately do not recommend to use a swap partition. Yes, yes, the Debian installer complains about that. I don’t care. Your system should have at least 1 GB of RAM for a small family mail server. 2 GB would be better. If anything goes wrong on your server and it suddenly needs more RAM then it’s better to let the Linux kernel kill processes quickly rather than start to use the swap to rescue itself. Otherwise you would get an ugly spiral-down effect that makes the server die slowly while you can do nothing about it. It is true that rarely used components can get swapped out to free some RAM but the benefit is barely noticeable. In my opinion a server nowadays must not have swap. (Why is it that ancient technology like swap partitions are still discussed nowadays?) Whatever, just select “No” to continue.

That’s it. Everything looks right. Write the changes to disk and continue with the rest of the installation. Just make sure that you install the “SSH server” component so that you can login from remote after the installation.

9 thoughts on “Install Debian Buster on your server”

  1. Modern Linux no longer requires a separate /boot partition. And the root volume can be on LVM formatted with ext4 or xfs or most of the other common filesystems; grub2 has been able to handle it for several years.

    On an EFI system you still need a separate /boot/efi as a primary partition (not LVM), but it is OK to make that small. (I usually use 50 MB.)

    1. Christoph Haas

      I often skip the /boot partition, too. Strange that the Debian installer insists on creating it. Even with an ancient ext2 file system.

      1. Which Debian installer insists on it? I just built a Debian 10 “golden master” VM a few weeks ago and installed it without a /boot. I always use the text-mode installer though. I don’t know if the GUI one is more restrictive. I wish I would have kept screen shots or more detailed notes on exactly what I did to get the install to run without /boot, but I think it was just a matter of setting up the LVM and creating a logical volume for / and then installing grub on /dev/sda.

        Also, thank you very much for these guides. I always look forward to them and really appreciate the effort you put into them!

        1. Christoph Haas

          I saw that schema when chosing “automatic partitioning” from a netinst boot medium in text mode. I hope I didn’t just dream that. 🙂

  2. When I saw that we would be doing custom partitions for this guide, I was expecting and hoping that FDE would be recommended somewhere in there. Why was it not?

    1. Christoph Haas

      You mean full disk encryption? It’s a personal preference I guess. I like servers to be able to boot automatically after a failure without the need to enter a passphrase on the console. But of course you can do that.

      Another approach would be using Maildir encryption as described by Eelke.

      1. Yes, I mean full disk encryption. I generally use it on all of my servers and, while it can be a hassle if a reboot is required for whatever reason, I prefer the additional layer of security.

        I’ll be implementing Maildir encryption as well; I was looking at the “What’s new?” page and got really excited when I saw that mentioned. I had been planning to look into TREES from Riseup[1] but was very hesitant to as it hasn’t been updated in a year and, at first glance, seemed like a huge pain. The fact that Dovecot is experimenting with at-rest encryption in an official capacity is a relief.


    2. I’ve done this before with a custom initrd running a dropbear instance that allows me to SSH in and pipe the decryption passphrase to dmcrypt after rebooting. So FDE on a remote server is possible, if you’re *REALLY* paranoid.

  3. I’d argue, a swap partition does have it’s merits on physical hardware; if the system configured correctly, that is. On VPS systems, maybe if you want to go with the cheapest option, and have more “memory” just in case. (Usually the lower spec options are really memory-bound)

Leave a Reply

Your email address will not be published. Required fields are marked *