Disk partitioning is a way of setting boundaries or creating regions to treat each storage space independently. Some advantages of partitioning a storage space include easy data recovery and backup, better organization, ease of reinstallation, and a new hard disk. However, each partition needs to have an appropriate filesystem, and it must be mounted at a mount point before use.

The article demonstrates ways to partition disks in Manjaro and explains how to format and mount disk partitions for proper drive usage.

Getting Started

The storage devices (hard disks, USBs, CD/ROM drives, and RAM disks) are known as block devices, as they read and write data in blocks of fixed sizes. Before partitioning, list all the available block devices attached to the system. Use the lsblk command to list out all block devices information:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/How-to-Partition-and-Format-Hard-Drive-in-Manjaro-1.png" data-lazy- height="242" src="data:image/svg xml,” width=”617″>

The printed output includes information on:

  • Name: Device name
  • RM: if the device is removable (1) or not (0)
  • SIZE: device storage size
  • RO: if the device is read-only
  • TYPE: device type
  • MOUNTPOINT: device mount point directory

To display partitions blocks containing file system information:

[manjaro@manjaro ~]$ lsblk -f

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/How-to-Partition-and-Format-Hard-Drive-in-Manjaro-2.png" data-lazy- height="239" src="data:image/svg xml,” width=”841″>

The commands above display each storage device with the identifiers beginning with sd and ending with letters a,b,d, etc. Such that each partition is identified by an assigned number 1,2,3, etc. The partition without any information on the filesystem is unformatted.

In case of a doubt regarding the most recently plugged storage device to be /dev/sdx. Plug the drive and use the dmesg command to view recent kernel log entries. The most recently listed drive identifier will be the one just plugged. Unplug the device and rerun the dmesg command to note that it isn’t there.

[manjaro@manjaro ~]$ sudo dmesg | tail

[  105.470055] sd 2:0:0:0: [sdb] Attached SCSI removable disk


.


.

<SNIP>

Disk Partitioning

For this tutorial, we have plugged in a USB device to create partitions. Users can create a partition on a hard disk via a similar method. Use the fdisk command to partition the storage device. The -l flag of the fdisk command can also list existing partitions.

[manjaro@manjaro ~]$ sudo fdisk -l

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/How-to-Partition-and-Format-Hard-Drive-in-Manjaro-3.png" data-lazy- height="292" src="data:image/svg xml,” width=”684″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/How-to-Partition-and-Format-Hard-Drive-in-Manjaro-4.png" data-lazy- height="335" src="data:image/svg xml,” width=”680″>

The above command prints extensive details about each drive and its partitions, such as:

  • model: storage device model
  • disk: disk size and name
  • sector size: it represents logical and physical memory size, not available storage space.
  • partition table: type of partition table; gpt, aix, amiga, bsd, dvh, mac, pc98, sun, and loop.
  • disk flags: information about partition size, filesystem, type, and flags

Now choose the storage disk for creating device partitions by using the following command.

[manjaro@manjaro ~]$ sudo fdisk /dev/sdb

The above command opens the disk to write changes.

Create New Partitions

  • Enter n to make a new partition. It will prompt for the partition type, select default p primary partition.
  • Type the required number of device partitions or select the default (1-4, default 1).
  • It then prompts for the starting and ending hard drive sector numbers. Choose the default suggested number.
  • Lastly, it prompts for entering partition size. Users can select several sectors or can choose the partition size in mega and gigabytes.

A message confirms the successful completion of partition formation. These changes will only remain in the memory until the user decides to write them on the disk.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/How-to-Partition-and-Format-Hard-Drive-in-Manjaro-5.png" data-lazy- height="445" src="data:image/svg xml,” width=”786″>

Write On Disk

Type w to write all the changes to the disk. Lastly, verify that the partitions are created by running the fdisk -l command.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/How-to-Partition-and-Format-Hard-Drive-in-Manjaro-6.png" data-lazy- height="90" src="data:image/svg xml,” width=”710″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/How-to-Partition-and-Format-Hard-Drive-in-Manjaro-7.png" data-lazy- height="273" src="data:image/svg xml,” width=”616″>

Format Partitions

Without a filesystem, the drive is of no use. There are various ways to make them accessible, format partitions using the mkfs command:

  • NTFS
  • FAT32
  • ext4

The general syntax for formatting partitions is:

[manjaro@manjaro ~]$ mkfs [options] [-t type fs-options] device [size]

However, before formatting a storage drive, it’s necessary to understand each filesystem, as each has its file size limitations and OS compatibility. Nevertheless, all the above formats are compatible with Linux systems.

Use the following command to format disk partition with ext4 format filesystem.

[manjaro@manjaro ~]$ sudo mkfs -t ext4 /dev/sdb1

To format the disk with the FAT32 file system, replace ext4 with the vfat option in the above command:

[manjaro@manjaro ~]$ sudo mkfs -t vfat /dev/sdb1

To format with NTFS filesystem:

[manjaro@manjaro ~]$ sudo mkfs -t ntfs /dev/sdb1

After applying each format, verify the change file system by locating the partition and confirming that it uses NTFS filesystem:

[manjaro@manjaro ~]$ lsblk -f

Mount Drive Partition

To access the stored data in the disk, Manjaor Manjaro requires us to create a mount point. Mount point is a directory that enables user interaction with the disk partition. It further ensures that Manjaro recognizes device format by reading information about the file system from the partition table.

Make a directory with the mkdir command to create a mount point to a preferred location.

[manjaro@manjaro ~]$ sudo mkdir -p <mountpoint>

Now mount the drive partition to the , as follows:

[manjaro@manjaro ~]$ sudo mount -t auto /dev/sdb1 <mountpoint>

A successful mounting won’t generate any output.

To verify successful mounting, use the following command.

[manjaro@manjaro ~]$ lsblk -f

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/How-to-Partition-and-Format-Hard-Drive-in-Manjaro-8.png" data-lazy- height="273" src="data:image/svg xml,” width=”857″>

Conclusion

The article details the process of storage drive partition creation in Manjaro Linux. We discussed the tools to list and view available partitions and format them in various file formats. The article also demonstrated how to mount drive partitions in Manjaro and why it’s important.

About the author

<img alt="" data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/usama-1-150×150.jpg" height="112" src="data:image/svg xml,” width=”112″>

Usama Azad

A security enthusiast who loves Terminal and Open Source. My area of expertise is Python, Linux (Debian), Bash, Penetration testing, and Firewalls. I’m born and raised in Wazirabad, Pakistan and currently doing Undergraduation from National University of Science and Technology (NUST). On Twitter i go by @UsamaAzad14