Linux

A brief Introduction to Linux and how to create disk partition in Ubuntu Linux

Intro-to-LInux-and-Disk-Part
Ubuntu Desktop

In this article, I am going to take you through the brief introduction to Linux and how to create a disk partition in Ubuntu Linux Operating System. This guide is intended to take you from a beginner to superuser and make you a better Linux System Administrator but before I continue, I will like to answer the question, what is Linux? To properly answer this question, we got to go back to the history of Linux. In the early 80s, Richard Stallman then working in an AI Lab in MIT started the GNU project under the Free Software Foundation (FSF), a non-profit organization he founded to support the free software movement, which promotes the universal freedom to study, distribute, create, and modify computer software with the goal of creating an entirely free and open-source Unix-like Operating System. By the early 90s, there was almost enough software to create an entirely new Operating System, however, the Kernel was not yet complete. As a result of the incomplete Kernel system for Linux, Linus Torvalds while still a student at the University of Helsinki, started developing Linux to create a system similar to MINIX, a UNIX operating system.  In 1991 he released version 0.02; Version 1.0 of the Linux kernel, the core of the operating system, was released in 1994.

Linux is a great and lovable Open Source Operating System used by many organizations and individuals around the globe for their day-to-day business or personal activities. The Linux® kernel is the main component of a Linux operating system (OS) and is the core graphical user interface (GUI) between a computer’s hardware and its processes. It communicates between the two, managing resources as efficiently as possible. To put it simply, Linux is the Kernel that powers a Linux OS. Kernels are programs that talks directly to the hardware and manage resources and processes. It requires a whole Operating System to be useful.

Another thing we need to look at before proceeding is Distributions in Linux.

What is Linux Distribution? A Linux distribution often abbreviated as “Linux distro” is a version of the open-source Linux operating system that is packaged with other components, such as installation programs, management tools, and additional software such as the KVM hypervisor. Review a complete list of Linux Distro.

When a Linux Kernel is bundled with OS software and shipped together, that is called Linux Distribution.

Creating Files System in Ubuntu Linux

Before we get started, I will like to take you through few things you need to also know about Ubuntu.

 Ian Murdock on August 16, 1993, started the community-supported Debian Project. The first version of Debian (0.01) was released on September 15, 1993, and its first stable version (1.1) was released on June 17, 1996. The Debian Stable branch is the most popular edition for personal computers and servers. Debian is also the basis for many other distributions, most notably Ubuntu.

There are so many Linux Distributions but the common question that’s often asked by beginners is what distribution of Linux should I use? The answer is simple, use what’s convenient and suitable for your business or personal needs!

This article is centered on Ubuntu Linux distribution. Ubuntu was created in the early 2000 and it is being distributed by Canonical. Canonical releases two Ubuntu versions a year, one in April and one in October. See the diagram below for details on the release lifecycle.  It is a Debian-based Linux Distribution.  It has become more popular and widely adopted that it’s in turn birthed other Linux distributions that are Ubuntu based. One popular part of its distributions are called elementary OS. Other officially recognized Ubuntu distributions can be found here.

Ubuntu-releases-1
Ubuntu Releases

Let’s get started!

What you need to do before you begin are:

  • Click here to download Ubuntu Linux distribution. When on the page, click on the Download tab to download. As at the time of writing this article, the latest version of Ubuntu is 21.04 non-Long Term Support (LTS) and 20.04 LTS. Download the one with the long term support. This is because LTS releases are always a good and safe choice, although in general all general non-LTS releases are just fine. LTS gives you longer support and in general better stability. Non-LTS will give you newer features, but you may run into more bugs and you’ll have to upgrade at least every nine months. The screenshot below shows the download screen.
Download-Ubuntu
Ubuntu Download Screen

From the screenshot above, it shows that you can download the server version of Ubuntu Linux as well but we are not going to use the server version in these configuration steps. For a full installation guide, see the related article on how to install and configure Ubuntu Linux on VirtualBox. See other related guides on Linux OS – How to create and deliver a report on System Utilization on a Linux based OS, Install Synaptic Package Manager: How to install, remove, and upgrade packages in Ubuntu Linux, Install Microsoft Edge on Ubuntu: How to install and remove Microsoft Edge Browser on Linux, How to install and configure BigBlueButton on Ubuntu Linux 16.04 LTS Xenial Xerus, How to setup SELinux on a Linux server.

With all set, we are going to start by exploring our newly installed Ubuntu Linux Operating System. to switch to have a full-screen mode, use the key combination of Right control key + f on your keyboard.

We are going to explore the programs that have been installed alongside the Operating System. Once you click on the dotted icons directly below the terminal icon at the bottom left of the screen, you will enter into the menu where all your installed programs are located. Take time to explore the programs. See the screenshot below for more information.

Exploring-the-menus
Exploring programs and menus

We are going to launch out our terminal now because all the configuration we are going to do will be done using the terminal. To launch the terminal window, simply double-click it from the bottom left of the screen or use the search bar. To save time you can use the Ctrl + Alt + T shortcut command on your keyboard to launch the terminal. I have my screenshot below to show you better.

Terminal-Screen
Terminal Screen

Let’s look at what is a filesystem in Linux? A file system in Linux is arranged in a tree-based hierarchy with forward-slash (/) denoting the root directory of the file system. Everything in Linux is a file. It could be a text-based file or a special device file.  You need to use the mount command to attach each partition/device to the file system before accessing the partition/device.

To create a file system you need to create a partition and format it first. In Linux, a primary partition is used to boot the Linux System while the swap partition is used to create space to hold extended memory.

Let’s create our first partition. Creating disk partitions enables you to split your hard drive into multiple sections that act independently.

In Linux, users must structure storage devices (USB and hard drives) before using them. Partitioning is also useful when you are installing multiple operating systems on a single machine. Here, you will learn how to create a partition using the Linux parted command.

How-to-partition-a-disk-in-Linux-1
Disk Partition in Linux

Prerequisites

  • A system running Linux (As we have already installed Ubuntu)
  • A user account with sudo or root privileges
  • Access to a terminal window / command line (Activities > Search > Terminal)

Step 1: Partition a Disk Using parted Command

When attempting to make a partition in Linux, list available storage devices and partitions. This will help you identify the storage device you want to partition.

Run the following command with the sudo (Super User Do) command to list storage devices and partitions:

sudo parted -l

The terminal prints out available storage devices with information about:

Using-Parted-Command
Terminal
  • Model – Model of the storage device.
  • Disk – Name and size of the disk.
  • Sector size – Logical and physical size of the memory. Not to be mistaken for  available disk space.
  • Partition Table – Partition table type (msdos, gpt, aix, amiga, bsd, dvh, mac, pc98, sun, and loop).
  • Disk Flags – Partitions with information on size, type, file system, and flags.

Partitions types can be:

  • Primary – Holds the operating system files. Only four primary partitions can be created.
  • Extended – Special type of partition in which more than the four primary partitions can be created.
  • Logical – Partition that has been created inside of an extended partition.

In our example, there is only one storage device (/dev/sda)

Note: The first storage disk (dev/sda) contains the operating system. Creating a partition on this disk can make your system unbootable. Only create partitions on secondary disks. I have dev/sda2, dev/sda3 as my secondary disk. So I’m creating my partition on /dev/sda2

Step 2: Open Storage Disk

Open the storage disk that you intend to partition by running the following command:

sudo parted /dev/sda2
Creating-disk-part-through-dev-sda2
Opening Storage Disk

Always specify the storage device. If you don’t specify a disk name, the disk is randomly selected. To change the disk to dev/sda2 or partition type you have  run:

select /dev/sda2

Using-dev-sda2-part-1
Selecting /dev/sda2

Step 3: Make a Partition Table

Create a partition table before partitioning the disk. A partition table is located at the start of a hard drive and it stores data about the size and location of each partition.

Partition table types are: aixamigabsddvhgptmacms-dospc98sun, and loop. To create a partition table, enter the following:

mklabel [partition_table_type]

For example, to create a gpt partition table, run the following command:

mklabel gpt

After running the mklabel gpt command above, type Yes to execute it.

Step 4: Check Table

Run the print command to review the partition table. The output displays information about the storage device

Step 5: Create Partition

Let’s make a new disk size partition using the ext4 file system. The assigned disk start can start from 1MB to 2024MB and above depending on what is best fit for you.

To create a new partition, enter the following:

mkpart primary ext4 1MB 2024MB

After that, run the print command to review information on the newly created partition. The information is displayed under the Disk Flags section.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Kindly subscribe to TechDirectArchive
This is default text for notification bar