March 15, 2018

How to add disks in CentOS 7(with partition)

The procedure for adding disks is as follows. I did this on VMware virtual environment.

Device recognition → Partitioning → Format → Mount




1. Device recognition : When a  disk is connected, CentOS 7 will recognizes it.

Device recognition on CentOS

Device recognition check on CentOS

SCSI supports hot plugging, but if sdb is not visible because OS fails to recognize the device, use the recognition script as shown below.

Device recognition script on CentOS




2. Partitioning

How to partitioning in CentOS 7

I made a total of two partitions with "fdisk" command.

After creating the partition, save the setting with "w". If sdb1 and sdb2 are not created, check the partition information of all recognized disks by CentOS 7 with "partprobe -s".




3. Format

How to format in CentOS

It can be easily formatted by "/usr/bin/mkfs.*". Partition 1 was formatted as ext4 and partition 2 was formatted as xfs.

The result of the format can be checked by "file -s [Device]" or "blkid".




4. Mount

How to mount in CentOS

Each partitioned disk information was mounted by registering in "/etc/fstab". If you register there, they will not be automatically unmounted when rebooting. After registering, reboot the system.

Check "UUID"s using "blkid" and be careful not to make a typo when writing it. And  check the mount status with "df -Th".


Check environment
O      S CentOS 7.4.1708(64bit) CPU Intel i7-4710MQ 2.50GHz
SHELL GNU bash (4.3.46(2)) RAM 1 GB