Linux Tutorials

Learn how to Create a New Ext4 File System (Partition) in Linux


The ext4 or fourth prolonged filesystem is a widely-used journaling file system for Linux. It was designed as a progressive revision of the ext3 file system and overcomes quite a lot of limitations in ext3.

It has important benefits over its predecessor equivalent to improved design, higher efficiency, reliability, and new options. Though it’s best suited to onerous drives, it can be used on detachable gadgets.

This text will present you learn how to create a brand new ext4 file system (partition) in Linux. We’ll to start with have a look at learn how to create a brand new partition in Linux, format it with the ext4 file system and mount it.

Word: For the aim of this text:

We’ll assume that you’ve added a brand new onerous drive to your Linux machine, through which you’ll create the brand new ext4 partition, and
In case you are working the system as an administrative consumer, use the sudo command to realize root privileges to run the instructions proven on this article.

Making a New Partition in Linux

Record the partitions utilizing the fdisk -l or parted -l instructions to establish the onerous drive you need to partition.

# fdisk -l
# parted -l

List Linux PartitionsList Linux Partitions

Record Linux Partitions

Trying on the output within the screenshot above, now we have two onerous disks added on the take a look at system and we are going to partition disk /dev/sdb.

Now use parted command to start out creating the partition on the chosen storage machine.

# parted /dev/sdb

Now give the brand new disk a label utilizing the mklabel command.

(parted) mklabel msdos

Then create a partition utilizing the mkpart command, give it further parameters like “main” or “logical” relying on the partition sort that you just want to create. Then choose ext4 because the file system sort, set the beginning and finish to determine the scale of the partition:

(parted) mkpart                                                            
Partition sort? main/prolonged? main
File system sort? [ext2]? ext4
Begin? 1
Finish? 20190

Create a New Ext4 PartitionCreate a New Ext4 Partition

Create a New Ext4 Partition

To print the partition desk on the machine /dev/sdb or detailed details about the brand new partition, run the print command.

(parted) print

Print Partition TablePrint Partition Table

Print Partition Desk

Now exit this system utilizing the stop command.

Formatting New Ext4 Partition

Subsequent, that you must correctly format the brand new partition with the ext4 file system sort utilizing the mkfs.ext4 or mke4fs command as follows.

# mkfs.ext4 /dev/sdb1
# mke4fs -t ext4 /dev/sdb1

Format a New Ext4 PartitionFormat a New Ext4 Partition

Format a New Ext4 Partition

Then label the partition utilizing the e4label command as follows.

# e4label /dev/sdb1 disk2-part1
# e2abel /dev/sdb1 disk2-part1

Mounting New Ext4 Parition in File System

Subsequent, create a mount level and mount the newly created ext4 partition file system.

# mkdir /mnt/disk2-part1
# mount /dev/sdb1 //mnt/disk2-part1

Now utilizing the df command, you may listing all file techniques in your system along with their sizes in a human readable format (-h), and their mount factors and file system sorts (-T):

# df -hT

Show Linux Filesystem with Mount PointsShow Linux Filesystem with Mount Points

Present Linux Filesystem with Mount Factors

Lastly, add the next entry in your /and many others/fstab to allow persistent mounting of the file system, even after a reboot.

/dev/sdb1 /mnt/disk2-part1 ext4 defaults zero zero

You may additionally prefer to learn these following associated articles:

Learn how to Add New Disks Utilizing LVM to an Current Linux System
Learn how to Add a New Disk to an Current Linux Server
10 Finest File and Disk Encryption Instruments for Linux
Learn how to Create a Digital HardDisk Quantity Utilizing a File in Linux

That’s all! On this article, we’ve defined learn how to create a brand new partition in Linux, format it with ext4 file system sort and mount it as a filesystem. For extra info or to share any queries with us, use the suggestions kind under.

Source link

Related Articles

Back to top button