Cfdisk Basic Partitioning Scenarios

Revision as of 15:25, 5 September 2021 by Oguzkagan (talk | contribs) (minor fixes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Tango-dialog-warning.png This article or section is out of date.
Reason: This information can be outdated. Oguzkagan (talk) (Discuss)
Tango-dialog-warning.png

Overview

Tip
The Partitioning Overview and Existing Partition Tables guide provides an overview and explanation of primary and logical partitions, as well as advice on what to do if intending to use a shared Home Partition.


Basic partitioning scenarios have been presented below for illustrative purposes. In particular, the intention is to illustrate the substantial degree of flexibility when deciding upon an appropriate partitioning scheme when using cfdisk.


A Two Partition Scenario

In this scenario, Boot, Root, and Home will be combined into a single bootable partition (SDA1). A seperate swap partition will also be created in the remaining space, using a logical partition (SDA2/SDA5).

Creating the Partitions


Use the left and right arrow keys to select the available options in cfdisk. The up and down arrow keys are used to select disk space / partitions. In this instance, Manjaro is being installed on a clean hard disk with no existing partitions or data. New has been highlighted to create the first new partition.

Press <enter> to continue.


The first step will be to define if it is a Primary or Logical Partition. In this instance, Primary has been selected.

Press <enter> to continue.


The second step is to define the size of the partition. In this instance, 40,949MB (40GB) out of a total of 42,949MB (42GB), has been allocated, with the intention to leave approximately 2000MB (2GB) remaining for the swap partition.



Tip
If, for example, the intention was to leave 20GB of unallocated space on the author's hard drive to install another operating system later, then 20949MB (20GB) would be allocated instead. Once the 2GB swap partition was allocated, this would leave 20GB of space remaining. An installer used by a distro like Mint or Ubuntu would even automatically detect and use this unallocated space for installation alongside Manjaro.

Once the value has been set, press <enter> to continue.



The third (and final) step is to define where the partition starts on your hard drive (i.e. from the beginning or the end of the available space). As with this instance - unless you have a specific reason to do otherwise - it is recommended to always start your partition(s) at the beginning of your hard drive / available space on your hard drive.

Once the selection has been highlighted, press <enter> to continue.


This partition must also be bootable, as it is intended to contain the Boot/GRUB. To mark it as such, the Bootable flag/option has been highlighted.


Note
Unless you intend to use an existing bootable partition (i.e. used by an existing Linux operating system), then you must also do the same for the partition where you intended to store the GRUB.

Press <enter> to continue.


Note that the partition - listed as sda1 - has now been flagged as boot.

With this complete, the swap partition will now be created. This is undertaken by first selecting the free space underneath the partition, and then highlighting the New option.

Press <enter> to continue.


As before, the first step is to define the type of partition to be used. In this instance, for illustrative purposes, the swap partition has been defined as a Logical partition, although it would make no real difference if it were defined as a primary partition instead.

Press <enter> to continue.


Again, the second step is to define the size of the new partition. In this instance, the remaining space of 2GB has been allocated, which has already been listed by default.

Press <enter> to continue.


As this newly created partition is intended to be used as a swap partition, it is necessary to specifically define its type as such. To do so, the Type option has been highlighted.

Press <enter> to continue.


A list of (hexadecimal) codes corresponding to the available types of partition will be displayed. It will be necessary to press a key to continue and enter the appropriate code.

In this instance - as illustrated - the code 82 has been typed in to define the partition type as swap.

Once the code has been typed in, press <enter> to continue.


Note that the swap partition has been listed as sda5. This is because primary partitions only range from sda1 to sda4, while logical partitions always start from sda5. Also note that sda5 is listed as a swap partition.

With both partitions created and defined, the partition table must now be written to the hard disk. To do so, the write option must be highlighted, before pressing <enter> to continue.

Upon doing so a warning message will appear. It will also be necessary to confirm your intention to write the new partitions by typing in yes at the prompt and then pressing <enter> again.


With the partitions completed and written, highlight quit to exit from cfdisk.

Press <enter> to continue.


Finalising the Disk Preparation


You will be returned to the hard disk selection menu. Highlight Done as the disk partitioning has been completed.

Press <enter> to continue.


A message will appear stating that it will now be necessary to select the appropriate partitions to use for the Manjaro installation.

Press <enter> to continue.


As before,The installer will automatically detect and display all hard discs connected to your system. Where more than one drive is present on your system, highlight the drive partitioned earlier.

Press <enter> to continue.


Select the appropriate partition to use for the Swap. In this instance, the swap partition is sda5, which has been highlighted for selection.

Press <enter> to continue.


Confirm that you wish to format your chosen partition.

Press <enter> to continue.


Select the appropriate partition to use for the Root. Again, this is where Manjaro itself (and later, any newly installed applications for it) will be stored. In this instance, it's an easy choice as the only remaining partition available is sda1.

Press <enter> to continue.


Set the file system to manage your files. If you are unsure which file system to choose, as illustrated, then it is recommend to highlight ext4, as this is one of the latest and perhaps most widely used Linux file systems.

Press <enter> to continue


Confirm that you wish to format your chosen partition.

Press <enter> to continue.


Select any other partitions to mount at bootup. If a separate Boot Partition had been created, it would be selected here. Upon pressing <enter> to continue, it would then be necessary to select which file system to use for it (e.g. ext4), and then to confirm that it is to be mounted at '/boot'.

Once completed, the process would also be repeated for any other relevant partitions, such as if a separate Home Partition had been created. In essence, it will be necessary to select and mount all of the partitions you had created for your Manjaro installation so that they will all be available for use upon booting up.

However, as in this instance only two partitions had been created (one of which combines Boot, Root, and Home), there are no further partitions to select.

Press <enter> to continue.


Review and confirm the mounted partitions. A confirmation message will appear, listing all of the partitions to mounted during the bootup of your Manjaro installation. Ensure that all of your intended partitions have been listed, and that they have been listed correctly (e.g. purposes and file systems). If something is amiss, highlight No to be taken back.

Again, in this instance, the message confirms that sda5 is to be mounted as the Swap Partition, and that sda1 is to be mounted (using the ext4 file system) for everything else.

Press <enter> to continue.



After a few moments, a message will appear to confirm that the partitions have been successfully mounted.

Press <enter> to continue.


Return to the Main Menu. As this step has been completed, highlight Main menu and press <enter> to be taken back to the installer's main menu.

Install Manjaro

Return to the Installation Guide for Experienced Users


A Three Partition Scenario

In this scenario, a partition will be created especially for Boot, seperate from the partition for Root and Home. A seperate swap partition will also be created. All the partitions created will be Primary Partitions.

Creating the Partitions


In order to create a new partition, use your arrow keys to switch through the options and choose new.


There are two preferences when creating partitions. Primary and Logical partitions. It's good to know that you can only create four primary partitions per Hard Drive. Choose the desired preference, then press enter to select it.


We are now going to create the boot partition. For the boot partition, 100 MB and higher in recommended. Enter the desired size and press ENTER.


After that, the Beginning option will be highlighted. It's recommended to keep it that way, press ENTER to continue.


We also need to make the boot partition Bootable, press ENTER when Bootable is highlighted.


We are now going to create a swap partition. After creating the boot partition, use your UP/DOWN arrow keys and choose Free Space. Use your arrow keys to navigate to the new option then, press ENTER.


After that, press ENTER again when the Primary preference is highlighted.


Now, enter a size for your swap partition. The recommended size for the swap partition is the same as your RAM. In this tutorial we are going to make a 1 GB swap partition, for that we will enter 1000 because cfdisk measures the size in MB.


Because we'll use this partition for swap, we have to change it's type, so, when the Type option is highlighted, press ENTER.


You will be prompted with a list of file systems, for swap we'll have to enter 82, we'll confirm by pressing ENTER.


After that, we are going to create a root (/) partition. Here's where the Operating System is going to be installed. Again, use your UP/DOWN keys to select the Free Space option, press ENTER to confirm. Using your arrow keys, choose new from the options at the bottom then press ENTER.


Enter the size in MB for your root partition. The recommended size for the root partition would be 4 GB or more and confirm it by pressing the ENTER key.


After that, you'll be prompted with your new partition scheme. To continue, use your arrow keys and select the Write option at the bottom and press ENTER, this will apply the changes we've made so far.


That being done, use your arrow keys and select the Quit option and press ENTER to exit cfdisk.


Finalising the Disk Preparation


Now, hit ENTER on the Done option.


Press ENTER again, when you get prompted with some information about what's coming next.


You will be prompted with a list of available drives, choose the one you've partitioned earlier, then press ENTER.


You will now have to select the swap partition. In this case it's /dev/sda2. Use your arrow keys and highlight your previously created swap partition and press ENTER.


When getting prompted for formatting the swap partition, choose Yes and hit ENTER.

Warning
This will format the partition, the changes cannot be reverted.



You will now have to select the root ( / ) partition. In this particular case it's /dev/sda3.


You'll be prompted with a list of file systems, choose one of them, preferably EXT4 and hit ENTER.


Choose Yes when prompted to format the partition.


There will be an option to mount static partitions at boot. Here you'll select the boot partition you've created earlier.


Now, you will have to select a file system for you boot partition. The EXT2 file system is recommended but not necessary.


Set the mount point to /boot then hit ENTER.


Select Yes and press ENTER when prompted for formatting.


You will be able to mount other partitions at boot up. It's very useful in case you have a home partition for example. Otherwise, select Done and hit ENTER.


An informational window will be prompted. Here you will be able to see info about your previously created partitions, including the mount points and types. Hit ENTER if you want to continue. Note: This will write the changes to your Hard Drive. The process if irreversible.


If you chose to continue (selected Yes), the installer will format and set mount points for your partitions.


The process will take just a few seconds, depending on your hardware. Press ENTER when prompted with the success message.


Now, we're done setting up the partitions. Use your arrow keys and highlight Main menu, then press ENTER.


See Also