Step1: Install parted
we’ll use the parted utility. You can install it by
sudo yum install parted
Step2: Check the disks connected and available on the system
We use the lsblk tools.
lsblk
This should give you a list of all hard drives on the system.
We’ll create a single partition spanning the entire disk.
Available options are:
GPT (GUID Partition Table) standard is the more modern partitioning standard
MBR ((Master Boot Record) standard offers wider support among operating systems.
Use GPT when setting up a drive. It’s a more modern, robust standard and all computers are moving toward it.
To choose the GPT standard:
sudo parted /dev/nvme1n1 mklabel gpt
To choose the MBR standard:
sudo parted /dev/nvme1n1 mklabel msdos
Now create a partition spanning the entire drive:
sudo parted -a opt /dev/nvme1n1 mkpart primary ext4 0% 100%
Check using lsblk, you should see the new partition.
Format the partition as an Ext4 filesystem using mkfs.ext4 utility.
Add a partition label using -L flag to identify this particular drive later.
Remember to pass in the partition and not the entire disk.
sudo mkfs.ext4 -L fastdrive /dev/nvme1n1p1
Changing the partition label at a later date, can be done by
sudo e2label /dev/nvme1n1p1 newlabel
Time to check the drive using lsblk.
sudo lsblk --fs
sudo lsblk -o NAME,FSTYPE,LABEL,UUID,MOUNTPOINT
It is recommended by the Filesystem Hierarchy Standard that /mnt or a subdirectory under it being used for temporarily mounted filesystems. There are no recommendations on where to mount more permanent storage, so you can choose whichever scheme you’d like.
sudo mkdir -p /short_fast
sudo mount -o defaults /dev/nvme1n1p1 /short_fast
You need to modify the /etc/fstab file.
First, use sudo lsblk --fs to obtain information on the drive.
sudo vim /etc/fstab
LABEL=fastdrive /short_fast ext4 defaults 0 2
sudo mount -a