Linux | Red Hat Certified | IT Technology | Operations Engineer
👇 Join our technical exchange QQ group with the note 【Public Account】 for faster approval

1. Check the disk mounting status
fdisk -l
You can see the unmounted disk labels and sizes

By the way, it may be due to the server’s default configuration that the disk has already been partitioned(/dev/vdb1) If it is already partitioned, you can skip step 3
2. Check the current partition status
df -lh

3. Follow the steps below to input commands sequentially to add a new partition to the new disk
fdisk /dev/vdb

4. After partitioning, check the filesystem type of all devices
blkid
Found that the new partition /dev/vdb1 does not have a filesystem type(type indicates the specific filesystem type, such as ext3, ext4, xfs, iso9660, etc. The specific differences can be searched online; this article recommends using xfs)
/dev/sr0: UUID="2024-12-18-09-36-49-00" LABEL="config-2" TYPE="iso9660" /dev/vda1: UUID="e90313e4-0677-4753-81ca-da0d1738bef3" TYPE="xfs" /dev/vda2: UUID="a5a988d3-2f90-4cb4-a99f-5b3165b0c609" TYPE="swap" /dev/vda3: UUID="32f2b4da-5a45-45f3-a69f-b4083341f8a4" TYPE="xfs" /dev/vdb2: LABEL="M-fM-^VM-0M-eM-;M-:M-eM-^MM-7" UUID="963C46D73C46B253" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="2118689b-320f-4894-8669-0d9b8d8d675f" /dev/vdb1: PARTLABEL="Microsoft reserved partition" PARTUUID="6fcc17ce-de3d-4da3-b671-742c3dae8f14"
5. Format the partition
First, check what types the current system supports for formatting by entering mkfs and pressing the tab key twice

The current system supports the xfs type we need, start formatting
mkfs.ext4 /dev/vdb1

Then enter the command to check all filesystem types after formatting
blkid
The following new information appears
[root@ecs ~]# blkid……/dev/vdb2: UUID="3874b62c-2195-49fb-80fa-bac02dc8f9da" TYPE="ext4" PARTLABEL="Basic data partition" PARTUUID="2118689b-320f-4894-8669-0d9b8d8d675f" /dev/vdb1: UUID="b10f57e0-ca97-4217-8f0f-ab59aa15c235" TYPE="ext4" PARTLABEL="Microsoft reserved partition" PARTUUID="6fcc17ce-de3d-4da3-b671-742c3dae8f14"
This indicates that the new partition has been successfully formatted to the ext4 filesystem type
Here are some common filesystem types and their characteristics:
ext4: Advantages: Widely used, good performance and stability, supports large files and filesystems. Disadvantages: Support for some advanced features (like fast filesystem checks) is not as good as some newer filesystems. XFS: Advantages: Suitable for handling large files, supports parallel IO, strong scalability. Disadvantages: Filesystem check recovery is slower. Btrfs (B-Tree Filesystem): Advantages: Supports copy-on-write (COW), snapshots, data compression, and checksums. Disadvantages: Relatively new, stability may not be as good as ext4 and XFS. ZFS: Advantages: Provides data integrity checks, snapshots, RAID-Z, and other advanced features. Disadvantages: May require additional installation on Linux and has higher hardware resource requirements.
6. Mounting
Mounting requires attaching the disk to a mount point(a folder), but the mount command does not create folders, so first create the mount point before using the mount command
mkdir /data
Mount the new partition /dev/vdb1 to the mkdir data mount point
mount /dev/vdb1 /data
Check if the mount was successful
mount

(If the wrong disk is mounted, you can use the umount + mount path command to unmount)

7. Configure automatic mounting on startup
First, check the UUID
blkid
If you are familiar, you can directly write the file directory into the mount configuration file, copy the UUID of /dev/vdb1, and write it into /etc/fstab
echo "UUID=e943fbb7-020a-4c64-a48a-2597eb2496df /vdb1 ext4 defaults 0 0" >> /etc/fstab echo "UUID=3874b62c-2195-49fb-80fa-bac02dc8f9da /data ext4 defaults 0 0" >> /etc/fstab /dev/vdb2: UUID="3874b62c-2195-49fb-80fa-bac02dc8f9da" TYPE="ext4" PARTLABEL="Basic data partition" PARTUUID="2118689b-320f-4894-8669-0d9b8d8d675f"
It is recommended to edit the /etc/fstab configuration file:
vim /etc/fstab

Mount all filesystems defined in /etc/fstab.
mount -a
Then restart the server and check if the disk mount is retained after reboot
Linux operations and maintenance materials collection/course consultation
↓ Please scan the QR code below ↓

What technical points and content would you like to see?
You can leave a message below to let us know!