In my previous post, I have explained about the steps to add a new disk to an existing Linux system. In this post, I will explain about the procedure to remove or delete a disk from an existing Linux machine without rebooting or restarting the server. These steps works well on almost all Linux operating systems such as CentOS, RHEL, Ubuntu, Rocky Linux, Oracle Linux etc.

The steps are very simple.

Step 1: Remove the entries from fstab

First unmount the disk from the system and remove the entry corresponding to disk in the /etc/fstab file.

The command to unmount the disk is given below.

Syntax : umount <mount point>

umount [mount point]

After unmounting the disk, remove the entries if any from the /etc/fstab file.

Step 2: Delete the partition

The partition can be deleted by using the fdisk command. The syntax is given below.

fdisk [disk name]

The disk name can be /dev/sdb or /dev/xvdc etc. An example command is given below

fdisk /dev/sdb

After executing the fdisk command, it will ask for the option to choose. Here we have to type d as the option. The option d stands for delete partition option.

After entering the input d, the system will delete the partition. Then give the input as w. The option w stands for write the changes to disk.

After the changes are written to the disk, the partitions gets completely deleted from the disk.

With this step we have completed all the steps as part of removing a disk from the operating system.

Step 3: Delete the Virtual disk if any from the Server BIOS [Optional. Depends on the server]

In the Server management console (In case of Dell servers, this console is called iDRaC) , select the disk to be removed and delete any virtual disks that are part of this disk.

Step 4: Unplug or Remove the disk from the server

Now unplug the disk from the server.

The steps I mentioned above does not require a reboot. I have performed these steps in several servers including production system. These steps works on almost all Linux operating systems such as CentOS, RHEL, Oracle Linux, Rocky Linux, Ubuntu etc.

I hope this tip is useful. Feel free to comment in case if you have any questions or feedback.