How to Add New Disk in Linux CentOS 7 Without Rebooting

In Linux CentOS 7, adding a new disk to a system does not require a system reboot. This is very useful in scenarios where the system has to stay up and running without interruption.

There are several scenarios where this capability is extremely valuable. One of the most common reasons is to expand the storage capacity of a running system without any downtime. For example, in a production environment, it may not be feasible to take the system down to install a new disk, as it can result in significant financial losses due to service disruption.

Another reason is to improve the performance of the system by separating the system’s data into different disks. By doing this, the system can reduce the I/O wait time and increase the speed of data access.

Moreover, adding a new disk without rebooting can also help in situations where there is a limited amount of space available on the existing disks, and there is a need to install additional software or store more data. In this scenario, adding a new disk can provide additional space and prevent the system from running out of disk space.

See also  How to Check Opened Port on Linux VPS Server

Another use case is when migrating a virtual machine from one host to another. In this case, a new disk can be added to the virtual machine on the new host, and the data can be transferred to the new disk without any downtime.

Finally, some users may want to add a new disk without rebooting for testing or learning purposes. It allows them to experiment with the system and its configuration without affecting its uptime or availability.

In this step-by-step guide, we will explain how to add a new disk to Linux CentOS 7 without rebooting.

Step 1: Check the available disks on the system:

The first step is to identify the available disks on the system. We can use the ‘lsblk’ command to list all the available disks on the system.

$ lsblk

Step 2: Partition the new disk:

Next, we need to partition the new disk. We can use the ‘fdisk’ command to create a new partition on the disk.

$ sudo fdisk /dev/sdb

This will open the fdisk utility. You can use the following commands to create a new partition:

See also  How to Setup NetHogs - Monitor Bandwidth Usage Per Process in Linux

– Press ‘n’ to create a new partition
– Select the partition type by pressing ‘p’ for a primary partition, ‘e’ for an extended partition, or ‘l’ for a logical partition.
– Enter the partition number.
– Enter the starting and ending sector numbers. If you want to use the entire disk, you can press Enter for the default values.
– Press ‘w’ to save the partition table.

Step 3: Format the new partition:

After partitioning the disk, we need to format the partition to a file system. In this example, we will format the partition to the ext4 file system.

$ sudo mkfs -t ext4 /dev/sdb1

Step 4: Create a mount point:

Next, we need to create a mount point for the new partition. A mount point is a directory where the new partition will be attached to the file system.

$ sudo mkdir /mnt/newdisk

Step 5: Mount the new partition:

Finally, we can mount the new partition to the mount point.

$ sudo mount /dev/sdb1 /mnt/newdisk

Commands Mentioned:

  • lsblk – List all available disks on the system.
  • fdisk – Create a new partition on the disk.
  • mkfs – Format the partition to a file system.
  • mkdir – Create a new directory.
  • mount – Mount a partition to a mount point.
See also  How to Check Server Uptime in Linux

Conclusion:

Adding a new disk to a Linux CentOS 7 system can be achieved without rebooting the system. By following these simple steps, you can partition, format, create a mount point, and mount the new disk to the file system. This guide can help you maintain the availability and uptime of your system while expanding its storage capacity.

If you have any comments or suggestions for improvements, feel free to leave them below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *