Blog

April 6, 2020

Hard disk Partitioning During Manjaro Linux Setup for x86

And short and clear on BIOS, (U)EFI, MBR, GPT and partitioning. Also few things to do after installation.

Read time: 5 minutes. This article is available here as pdf.

INTRODUCTION and NOTA BENE:

This is for Manjaro regular x86_64 regular PC system. Manjaro guys are cool and you don’t need explicit separate GRUB installation. The purpose of this article is to give you some basic points and help you install with screenshots and recommendations. The Manjaro version for this guide is Manjaro 19.02 Kyria Xfce with Linux Kernel x86_64 version 5.4.23-1.

For my other project with Manjaro ARM on a Raspberry Pi 4 – you don’t need the partitioning as it is done automatically. For my 32 GB SD Card it configured directly msdos Partition Table with file system FAT16 boot partition of size 98.6 MB, and one primary partition with ext4 file system and total size 31.8 GB. Full Screenshot guide is available in this article.


BIOS and the HW

How does the PC start? There is a piece of HW (a chip) called BIOS, which checks the HW of the complete system – i.e. what is connected to the motherboard inside it. Then it reads the starting sector of the hard drive and understands what sections of data are in it, and where the booting (starting) code is located:


What are BIOS, (U)EFI, MBR and GPT

BIOS stands for Basic Input / Output System. It was first developed around 1975 and since then has evolved a lot.

(U)EFI stands for (Unified) Extensible Firmware Interface. It was first started as EFI from Intel, developed in the mid 1990’s. In 2005 the UEFI Forum was created by several big chip makers and Intel abandoned EFI to support the UEFI.

There is one more important abbreviation – ACPI – which stands for Advanced Configuration and Power Interface, integrated in the UEFI consortium in 2013.

Most PCs in the last years support EFI/UEFI. Linux supports it and most serious distribution have integrated this support already few years ago (now is April 2020).

BIOS is nowadays the de-facto name for this chip, no matter whether it holds only BIOS, or also EFI/UEFI functionality and standard conformance. Nowadays many times it supports simultaneously (U)EFI and Legacy Boot for older HW.

MBR is Master Boot Record, sometimes referred to as Legacy Boot. MBR was first introduced with IBM PC DOS 2.0 in 1983. It’s called Master Boot Record because the MBR is a special boot sector located at the beginning of a drive. This sector contains a boot loader for the installed operating system and information about the drive’s logical partitions. The boot loader is a small bit of code that generally loads the larger boot loader from another partition on a drive.  For Linux normally the GRUB boot loader will typically be located in the MBR.

MBR does have its limitations:  it only works with disks up to 2 TB in size and also only supports up to four primary partitions—if you want more, you have to make one of your primary partitions an “extended partition” and create logical partitions inside it.

GPT stands for GUID Partition Table. GUID means Globally Unique IDentifiers.  It’s a new standard that’s gradually replacing MBR. It’s associated with UEFI, which replaces the clunky old BIOS with something more modern. GPT, in turn, replaces the clunky old MBR partitioning system with something more modern. It’s called GUID Partition Table because every partition on your drive has a “Globally Unique IDentifiers,” or GUID—a random string so long that every GPT partition on earth likely has its own unique identifier.

GPT doesn’t suffer from MBR’s limits. GPT-based drives can be much larger, with size limits dependent on the operating system and its file systems. GPT also allows for a nearly unlimited number of partitions. Again, the limit here will be your operating system—Windows allows up to 128 partitions on a GPT drive, and you don’t have to create an extended partition to make them work.

Two of the best links on the subjects above (some parts from the text above are directly from there!):

https://www.howtogeek.com/193669/whats-the-difference-between-gpt-and-mbr-when-partitioning-a-drive/

https://www.simplylinuxfaq.com/2017/10/main-differences-between-mbr-gpt.html

For the more curious also here and here.


How to setup our Manjaro Partitions when installing

This is the boot screen – either wait for some seconds or hit Enter on this option:

You start with the language and localization, no screenshots for them. Once you’ve done you will reach the following screen which gives you the opportunity to make the partitioning: choose Manual Partitioning and click next:

If you have read the previous chapter – it is always better to work with GPT if you want to be up to date. If your HW doesn’t support it – only then choose MBR. How to understand? After searching online and if I can’t find – I would try with GPT and if there are problems that cannot be solved (again with online help) I would only then switch back to reinstall with MBR. My test machine is relatively old fanless from 2013, with regular BIOS, and I use GPT on the 64 GB SSD. And it is working. One more example in support of always trying UEFI + GPT – Debian Jessie supports UEFI since 2015 with Kernel Linux 3.16. The integrated Kernel in latest distribution versions has reached versions over 5.xx. Of course checking your distribution documentation is recommended (if you know how to search in it) as having Kernel Support for some functionality is one thing, but whether this functionality is enabled by default is another.

Why some distributions do not enable/integrate the GPT support? Simplest example is Manjaro for Raspberry Pi and ARM – by default the functionality is not needed as it boots from an SD card. My 32 GB SD Card was configured directly in msdos Partition Table with FAT16 boot partition of size 98.6 MB, and one primary partition with ext4 file system and total size 31.8 GB – and I didn’t have Partition Management during installation. More information – here

A bit more information on how to choose between MBR and GPT is available for Arch Linux (and Manjaro is Arch based) here. Here is a quotation:

— — — — — — — — —

Some points to consider when choosing:

  • To dual-boot with Windows (both 32-bit and 64-bit) using Legacy BIOS, the MBR scheme is required.
  • To dual-boot Windows 64-bit using UEFI mode instead of BIOS, the GPT scheme is required.
  • If you are installing on older hardware, especially on old laptops, consider choosing MBR because its BIOS might not support GPT (but see below how to fix it).
  • If you are partitioning a disk of 2 TiB or larger, you need to use GPT.
  • It is recommended to always use GPT for UEFI boot, as some UEFI implementations do not support booting to the MBR while in UEFI mode.
  • If none of the above apply, choose freely between GPT and MBR. Since GPT is more modern, it is recommended in this case.

— — — — — — — — —

Now switching to Manjaro for x86/64 (and this example is done on a Virtual Machine :)) :

First delete all old partitions if there are any to be deleted (I hope you have saved any data from them :)), choose “New Partition Table”, select GUID (GPT) and click OK.

You need:

  1. A FAT32 boot
  2. Swap space (recommended 4 GB, better 8 GB)
  3. Root file system (minimum 20 GB, if you plan to install more SW – then accordingly)
  4. Home partition (the rest of the space)

Here we have only one important short note to add – about the swap space. Swap space is used to extend the RAM when it is filled up completely. Nowadays this happens rarely.  Here is an article from David Both which explains it’s usage in detail. When is it useful? If some of your programs grows so big, that the RAM is not enough. As David cites Fedora installation guide – if your RAM is under 2 GB – your SWAP shall be minimum x2 more. For RAM from 4 to 8 GB – swap shall be equally big. For RAM over 8 GB – swap shall be x0.5 or according to custom needs.

My SSD on the test PC is total 64 GB so I have roughly 512 MB boot, 8 GB SWAP, 20 GB root and 30 GB Home. Why the sum is not 64 GB? Because the rest is allocated for file systems data tables.

The example with the Virtual Machine has a bit more space so:

BOOT:

SWAP: Scroll down in the Flags for the right flag!

 

ROOT: In Flags For the right flag scroll down again, The mount point is only a slash:

For Home directory – no special flags needed:

Resulting allocation table:

For the last option in the bottom – “Install boot loader on” I kept on my test PC the default setting of Master Boot Record. The MBR section is really small and it doesn’t have enough space to hold the whole bootloader. As we have a boot partition with FAT32 – a small piece of code is directing the execution in the beginning at boot time from MBR to the /boot section. And this works on my test PC.

So now you have your system.

Just FYI:

To check / list the partition tables on some of the disks or all of them in Terminal:

$ sudo parted -l

$ sudo parted /dev/sda print

$ sudo gdisk -l /dev/sda




Few things to do after installation

Update the pacman mirrors to ensure fast operation

This takes few minutes, but it is definitely worth (I tried before and after – download speed increase was few times!). So in order any installation to be as fast as possible, and so that you don’t wait for minutes to download e.g. some 3 MB package:

$ sudo pacman-mirrors –fasttrack

Then to update packages:

$ sudo pacman –Syu

More information here.


Add a Text Editor

I’ve installed the Gedit simple text editor with this command:

    $ sudo pacman -S gedit

For something more advanced – Sublime and Atom are on top of many reviews. Choose one and install it via:

Sublime

I wanted Sublime. It can be installed via pacman, instructions are taken from here:

Install the GPG key:

    $ curl -O https://download.sublimetext.com/sublimehq-pub.gpg && sudo pacman-key –add sublimehq-pub.gpg && sudo pacman-key –lsign-key 8A8F901A && rm sublimehq-pub.gpg

Select the Stable channel to use:

    $ echo -e “\n[sublime-text]\nServer = https://download.sublimetext.com/arch/stable/x86_64” | sudo tee -a /etc/pacman.conf

Update pacman and install Sublime Text

    $ sudo pacman -Syu sublime-text

Atom

As Atom is in the official Arch repository pacman supports it by default:

    $ sudo pacman –S atom


Install base-devel, obligatory for development

In order to be able to develop, compile and so on: we need base-devel package group (it is also crucial for compiling AUR packages):

    $ pacman -S base-devel –needed

The last flag here asks pacman to install only what is needed.


Install an “AUR install helper” package – if you want to use AUR

Why using a helper? Cause it saves time and makes the full compilation process for you, solving dependences and so on.

YAOURT (which I used in the past) is no longer supported and here are some other alternatives we may use.

I have chosen YAY. You can install yay by cloning the git repo and building it. Use the below commands:

    —–

    $ cd Downloads

    $ git clone https://aur.archlinux.org/yay.git

    $ cd yay

    $ makepkg -si

    —–

Using yay:

Searching an application through Yay in AUR:

$ yay -Ss <package-name>

Installing an application:

$ yay -S <package-name>

It is written in Go programming language, so requires the Go environment… that’s why it will require few hundred MB of space. But it definitely helps.

Some generic hints on yay you can find here.


Play with Manjaro

This means – try the settings, customize your bottom screen toolbar, put some fast buttons for Terminal and File Manager on the Desktop and / or bottom toolbar, remove the transparency of the Terminal (personally I don’t like it 🙂 )….. etc. You can check also this article on BASH basics.

Manjaro Linux on Raspberry Pi 4

Leave a Reply

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