The article demonstrates ways to partition disks in Manjaro and explains how to format and mount disk partitions for proper drive usage.
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:
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:
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.
[ 105.470055] sd 2:0:0:0: [sdb] Attached SCSI removable disk
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.
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.
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.
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.
Without a filesystem, the drive is of no use. There are various ways to make them accessible, format partitions using the mkfs command:
The general syntax for formatting partitions is:
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.
To format the disk with the FAT32 file system, replace ext4 with the vfat option in the above command:
To format with NTFS filesystem:
After applying each format, verify the change file system by locating the partition and confirming that it uses NTFS filesystem:
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.
Now mount the drive partition to the <mountpoint>, as follows:
A successful mounting won’t generate any output.
To verify successful mounting, use the following command.
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.