Debian 10 Manual Partition for /boot, /swap, root, /home, /tmp, /srv, /var, /var/mail, /var/log

line5

debian-10

KEEP IN MIND

  • Debian 10 (Buster) is used for this tutorial and configured using manual partition option in virtual environment using VMware workstation.
  • Sizes of the partitions can be different according to the requirement of the organization or user.
  • Advantages of manual partition include smooth backup and restore process, ability to maintain specially allocated partitions for different section for storage etc.
  • It is recommended to create a Standard /boot partition to keep the boot files and Linux Kernal separately as the system will might errors when booting from LVM partition. Or it can be a personnel preference since latest version supports the boot in LVM. (Read more at: https://askubuntu.com/questions/76095/what-is-the-use-of-boot-lvm-based-in-partitioning)
  • Logical Volume Manager is used to create partitions for
      • /swap
      • /       (root)
      • /home
      • /srv (For FTP servers a /srv partition is recommended)
      • /tmp
      • /var (For web or mail servers it is recommended to create a separate /var partition)
      • /var/log
      • /var/mail

Debian production release history

Refer the production release at https://wiki.debian.org/DebianReleases

debian releases

 

Why manual partition?

At a bare minimum, GNU/Linux needs one partition for itself. You can have a single partition containing the entire operating system, applications, and your personal files. Most people feel that a separate swap partition is also a necessity, although it’s not strictly true. “Swap” is scratch space for an operating system, which allows the system to use disk storage as “virtual memory”. By putting swap on a separate partition, Linux can make much more efficient use of it. It is possible to force Linux to use a regular file as swap, but it is not recommended.

Reason 01

Most people choose to give GNU/Linux more than the minimum number of partitions, however. There are two reasons you might want to break up the file system into a number of smaller partitions. The first is for safety. If something happens to corrupt the file system, generally only one partition is affected. Thus, you only have to replace (from the backups you’ve been carefully keeping) a portion of your system. At a bare minimum, you should consider creating what is commonly called a “root partition”. This contains the most essential components of the system. If any other partitions get corrupted, you can still boot into GNU/Linux to fix the system. This can save you the trouble of having to reinstall the system from scratch.

Reason 02

The second reason is generally more important in a business setting, but it really depends on your use of the machine. For example, a mail server getting spammed with e-mail can easily fill a partition. If you made /var/mail a separate partition on the mail server, most of the system will remain working even if you get spammed.

Drawback

The only real drawback to using more partitions is that it is often difficult to know in advance what your needs will be. If you make a partition too small then you will either have to reinstall the system or you will be constantly moving things around to make room in the undersized partition. On the other hand, if you make the partition too big, you will be wasting space that could be used elsewhere. Disk space is cheap nowadays, but why throw your money away?

More at [Deciding on Debian Partitions and Sizes:  https://www.debian.org/releases/jessie/amd64/apcs01.html.en]

Download Debian 10

For this tutorial version 10.3.0 for ‘amd64’ architecture is chosen. (Download the amd64 for 64 bit or i386 for 32 bit systems).

Download links (the links can change time to time)

https://www.debian.org/distrib/

Small installation image (netinst image)

This can be downloaded quickly and should be recorded onto a removable disk. To use this, you will need a machine with an Internet connection.

debian-10.3.0-amd64-netinst.iso – size (335 mb)

https://www.debian.org/distrib/netinst

Larger complete installation image

This contains more packages, making it easier to install machines without an Internet connection. You can download DVD images using torrent

debian-10.3.0-amd64-DVD-1.iso.torrent – size (3.69 GB)
debian-10.3.0-amd64-DVD-2.iso.torrent – size (4.36 GB)
debian-10.3.0-amd64-DVD-3.iso.torrent – size (4.34 GB)

https://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/

 

Directories in Linux 

This is the list of directories, you can find in Linux and please note that in this tutorial, partitions are created for only the selected ones.

directories

More at: https://www.debian.org/releases/stable/amd64/apcs02.en.html

TUTORIAL

The tutorial is divided into 7 sections

  1. Install Debian graphical install
  2. Create manual partition
  3. Create standard boot partition
  4. Configure Logical Volume Manager (LVM)
  5. Create logical volumes for the rest of the directories
  6. Configure the partitions
  7. Finalize installation

 

01 Install Debian graphical install

In this case, Graphical Install is selected

Debian 10-2020-04-17-16-47-46

Select the desired language

Debian 10-2020-04-17-16-48-00

Select the location

Debian 10-2020-04-17-16-48-11

Provide the desired keyboard option

Debian 10-2020-04-17-16-48-16

wait until the ‘installer components’ load

Debian 10-2020-04-17-16-48-29

Give the ‘Hostname’ for the system

Debian 10-2020-04-17-16-49-27

Provide the ‘Domain name’ (you can keep it blank if the system is used as a normal desktop system)

Debian 10-2020-04-17-16-49-48

Give a strong password for the root account

Debian 10-2020-04-17-16-50-08

Provide a name for the user who is going to use this system for non-administrative tasks

Debian 10-2020-04-17-16-50-16

Provide a username for the new account

Debian 10-2020-04-17-16-50-31

Provide a strong password for the created new user

Debian 10-2020-04-17-16-50-48

Configure the clock (You should have chosen the correct language earlier to make the time zone to be listed)

Debian 10-2020-04-17-16-50-58

Press continue to proceed to the next step which is creating partitions

02 Create manual partition

In this tutorial  manual partition option is chosen

Debian 10-2020-04-17-16-51-29

Select the hard disk (In this case, hard disk was created using VMware workstation)

Debian 10-2020-04-17-17-16-52

Click ‘Yes’ to proceed

Debian 10-2020-04-17-17-17-17

Select the free space to continue

Debian 10-2020-04-17-17-18-28

3.0 Create standard boot partition

As The First Partition Create a Standard boot partition

  • Size of the partiton: 1 GB
  • Type for the new partition: primary
  • Location of the new partition: beginning
  • use as: Ext4 journaling file system
  • Mount point: /boot
  • label: boot
  • bootable flag: on

Select the option to create a new partition

Debian 10-2020-04-17-17-18-39

Provide the disk space required (I GB is enough for boot partition)

Debian 10-2020-04-17-17-19-18

Select primary as the type for boot partition

Debian 10-2020-04-17-17-19-22

Create the boot partition at the beginning of the free space

Debian 10-2020-04-17-17-19-26

In the partition settings you can select the Mount point,

Click on ‘Mount point’ to select the mount point as /boot

Debian 10-2020-04-17-17-25-25

‘/boot’ is selected as the mount point

Debian 10-2020-04-17-17-25-30

Click on the ‘Label’ to give the label as ‘boot’

Debian 10-2020-04-17-17-25-43

Provide ‘boot’ as the label

Debian 10-2020-04-17-17-25-50

Select the file system as Ext4 (In this scenario Ext4 is selected by default)

What is Ext4?

The ext4 journaling file system or fourth extended file system is a journaling file system for Linux, developed as the successor to ext3. Furthermore, ext4 is the default file system for many Linux distributions including Debian and Ubuntu. –wiki

Debian 10-2020-04-17-17-26-49

Debian 10-2020-04-17-17-26-53

Review the settings and finish configuring

Debian 10-2020-04-17-17-28-13

Note that freshly configured /boot partition is available in the list

Debian 10-2020-04-17-17-28-19

4.0 Configure Logical Volume Manager (LVM) 

  • Firstly create a LVM physical volume
  • Then create other partitions as LVM logical volumes within the LVM physical volume

Select the option from the menu to configure the LVM

Debian 10-2020-04-18-22-55-38

Click ‘yes’ to proceed

Debian 10-2020-04-20-13-22-10

Create a logical volume group

Debian 10-2020-04-20-13-22-18

Provide a name to the Volume Group

Debian 10-2020-04-20-13-22-37

Choose the free space for the new volume group

Debian 10-2020-04-20-13-22-46

Select ‘Yes’ to proceed

Debian 10-2020-04-20-13-23-07

5.0 Create logical volumes for rest of the directories  

In this tutorial logical volumes are created for following directories only for reference/ educational purposes. Additionally, you can create more separate partitions based on the requirement of the organization and personnel preferences.

  • /swap
  • /       – (root)
  • /home
  • /srv (For FTP servers a /srv partition is recommended)
  • /tmp
  • /var (For web or mail servers it is recommended to create a separate /var partition)
  • /var/log
  • /var/mail

Swap Space

There are two basic types of memory in a typical computer. The first type, random access memory (RAM), is used to store data and programs while they are being actively used by the computer. Swap space is the second type of memory in modern Linux systems. The primary function of swap space is to substitute disk space for RAM memory when real RAM fills up and more space is needed.

There’s no one hard-and-fast rule that will tell you how much paging or swap space you need. The answer depends on what you do with your computer and how much memory you use. For example, if you have 8 GB of memory but you never ever used more than those 8 GB, you could get by with no swap space at all — it’s likely you would need more than 8 GB eventually, of course. On the other hand, you might have a computer with 64 GB of memory, but it might regularly work with 100 GB data sets — you’d probably want at least the 64 GB swap space just to be safe. So a computer with 8 GB of RAM might need no page file and a computer with 64 GB of RAM might need a huge page file. It all depends on what the computer is doing. [More at:  https://www.howtogeek.com/196238/how-big-should-your-page-file-or-swap-partition-be/]

The root (/) directory

Primary hierarchy root and root directory of the entire file system hierarchy.
The root directory is the directory on Unix-like operating systems that contains all other directories and files on the system and which is designated by a forward slash ( / ). Size is 5 –6GB for a workstation or a server installation.

The /home Directory

A home directory, also called a login directory, is a subdirectory of /home that serves as the repository for a user’s personal files, directories and programs. It is also the directory that a user is first in after logging into the system.

The name of a user’s home directory is by default the same as that of the user. Thus, for example, a user with a user name of william would have a home directory also named william, and that directory would have an absolute pathname of /home/william.

The only account that will by default have its home directory in a location other than /home is the root (i.e., administrative) user, whose home directory by default is /root, another standard sub-directory of the root directory.

A common strategy for large installations is to place /home on its own partition (i.e., a logically independent section) of a hard disk drive (HDD) or even on a separate HDD. This is because users’ home directories usually contain the most important data on a system, and having them on a partition or disk separate from other parts of the system can make it easier to back them up and thereby reduce the chances of loss of data.

The /srv Directory

Site-specific data served by this system, such as data and scripts for web servers, data offered by FTP servers, and repositories for version control systems.

The /tmp Directory

Temporary data created by programs will most likely go in this directory. 40–100MB should usually be enough. Some applications — including archive manipulators, CD/DVD authoring tools, and multimedia software — may use /tmp to temporarily store image files. If you plan to use such applications, you should adjust the space available in /tmp accordingly.

The /var Directory

/var is a standard sub-directory of the root directory in Linux and other Unix-like operating systems that contains files to which the system writes data during the course of its operation.

Among the various sub-directories within /var are..

  • /var/cache (contains cached data from application programs),
  • /var/games (contains variable data relating to games in /usr),
  • /var/lib (contains dynamic data libraries and files),
  • /var/lock (contains lock files created by programs to indicate that they are using a particular file or device),
  • /var/log (contains log files),
  • /var/run (contains PIDs and other system information that is valid until the system is booted again) and
  • /var/spool (contains mail, news and printer queues).
  • /var/mail (A mail server getting spammed with e-mail can easily fill a partition. If you made /var/mail a separate partition on the mail server, most of the system will remain working even if you get spammed).

[More at: http://www.linfo.org/var]

 

Firstly, swap partition is created

Create a volume for the swap space

Debian 10-2020-04-20-13-23-26

Choose the previously created Logical Volume Group

Debian 10-2020-04-20-13-23-33

Give the name as swap

Debian 10-2020-04-20-13-24-37

Provide the size for the swap partition

How to decide the swap partition size

  • Size of the LVM logical volume partition: 2.5 GB [since the system RAM is 2 GB, 2 GB + 500 mb]
  • use as: swap area

You can calculate the capacity according to the system RAM. If the system RAM is less than 2 GB it can be multiplied by 2, if the system RAM is more than 2 GB, you can add 500 mb to the system RAM. However, this can be different based on the requirement.

EX -:
system RAM is 250 mb —> Desired Capacity is 500 mb [250 mb * 2]
system RAM is 3 GB —> Desired Capacity is 3.5 GB [3 GB + 500 mb]

Another guide that explains the swap partition size: https://opensource.com/article/18/9/swap-space-linux-systems

Debian 10-2020-04-20-13-24-51

Keep creating the rest of the partitions in LVM

Debian 10-2020-04-20-14-54-09

Altogether, 8 partitions are created (Again, it needs to be reminded that the partitions and sizes varies according to the requirement of the servers or workstations)

Debian 10-2020-04-21-00-19-02

 

6.0 Configure the partitions

Firstly, configure the swap space

Select swap logical volume

Debian 10-2020-04-21-03-57-44

In the partition settings, change the file system to ‘swap area’ (this is the only change you have to make)

Debian 10-2020-04-21-03-57-52

Debian 10-2020-04-21-03-57-59

Complete the configuration

Debian 10-2020-04-21-03-58-10

Notice how the changes are taken into effect

Debian 10-2020-04-21-03-58-16

 

Configure the /home logical volume settings

/home partition

  • use as: Ext4 journaling file system
  • Mount point: /home
  • label: home

Select the previously created home volume

Debian 10-2020-04-21-04-06-46

Change the file system to Ext4 journaling file system

Debian 10-2020-04-21-04-06-56

Debian 10-2020-04-21-04-07-02

Change the mount point to /home

Debian 10-2020-04-21-04-18-42

Debian 10-2020-04-21-04-18-47

Label the volume as ‘home’

Debian 10-2020-04-21-04-19-11

Debian 10-2020-04-21-04-19-17

Complete the /home partition settings

Debian 10-2020-04-21-04-19-33

Notice the changes made to the /home logical volume

Debian 10-2020-04-21-04-19-42

 

Configure the rest of the volumes as well with following partitions settings

Root partition

  • use as: Ext4 journaling file system
  • Mount point: /
  • label: root

/srv partition

  • use as: Ext4 journaling file system
  • Mount point: /srv
  • label: srv

/tmp partition

  • use as: Ext4 journaling file system
  • Mount point: /tmp
  • label: tmp

/var partition

  • use as: Ext4 journaling file system
  • Mount point: /var
  • label: var

/var/log

  • use as: Ext4 journaling file system
  • Mount point: /var/log
  • label: var-log

To create /var/log directory you have to provide the mount point manually

Debian 10-2020-04-21-05-09-45

Debian 10-2020-04-21-05-09-51

Debian 10-2020-04-21-05-10-05

Debian 10-2020-04-21-05-10-17

/var/mail

  • use as: Ext4 journaling file system
  • Mount point: /var/mail
  • label: var-mail

 

After finishing the configuration review the settings and finish partitioning

Debian 10-2020-04-21-05-11-00

Debian 10-2020-04-21-05-11-31

click ‘Yes’ to accept the changes and write to the disk

Debian 10-2020-04-21-05-11-52

07 Finalize installation

Tick ‘yes’ to scan additional CD/DVD images for installation (I selected ‘No’ since I do not wish to install further from CD/ DVD)

Debian 10-2020-04-21-05-55-04

Configure the network mirror by selecting the Debian mirror country

Debian 10-2020-04-21-05-55-14

Select the Debian mirror archive mirror (in this scenario, default option is kept as it is)

Debian 10-2020-04-21-05-55-20

Include the proxy details if needed or keep it blank

Debian 10-2020-04-21-05-55-31

Let the package manager configure its settings

Debian 10-2020-04-21-05-55-40

Configure the popularity-contest to participate in the package survey

Debian 10-2020-04-21-06-02-05

Software selection

For this Debian system, Gnome desktop environment and standard system utilities are installed.

If you want to install Debian Minimal server, you can un-tick the Debian desktop environment.

Read the following article to choose the best desktop environment for you:  https://itsfoss.com/best-linux-desktop-environments/

Debian 10-2020-04-21-06-17-03

Let the installation finish

Debian 10-2020-04-21-06-17-36

Select ‘Yes’ to install the GRUB boot loader to the master boot record

Debian 10-2020-04-21-06-53-45

Keep the boot loader installation location as it is

Debian 10-2020-04-21-06-53-51

Click ‘continue’ to finish the installation and boot into the new system

Debian 10-2020-04-21-06-55-54

Login to the new system using the password you have provided for the user created earlier

Debian 10-2020-04-21-07-03-35

Debian 10-2020-04-21-07-03-50

Go to the terminal and switch to root user to check the partition table using the lsblk command

waruna@debpc: ~$ su –

Password: *****

root@debpc:~# lsblk

Debian 10-2020-04-21-07-52-13.png

 

4 thoughts on “Debian 10 Manual Partition for /boot, /swap, root, /home, /tmp, /srv, /var, /var/mail, /var/log

  1. thanks you for your tutorial and explained detail the step so install, i will use for recomendation install debian on my laptop,still burn the ISO into USB drive.. good luck you

    Like

Leave a comment