HowTo: Linux Remove a Partition Name (/dev/sdXY entry) Temporarily

I‘d like to remove /dev/sdc5 temporarily without deleting partitions on hard drive /dev/sdc under Linux operating systems?

You can use old good rm command (make sure /dev/sdc5 is not mounted). Another option is to use the delpart command that asks the Linux kernel to remove a partition.

This command doesn’t manipulate with partitions on hard drive. The syntax is as follows:
delpart /dev/sdX Number
rm /dev/sdXY

rm command example

Type the following rm command as root:
# umount /dev/sdc5
# rm /dev/sdc5
# ls /dev/sdc*

delpart command example

Type the following as root:
# umount /dev/sdc5
# delpart /dev/sdc 5
# ls /dev/sdc*

How do I re-read (or add) temporarily deleted partition?

Use partprobe command. It will informs Linux operating system kernel of partition table changes, by requesting that the operating system re-read the partition table:
# partprobe /dev/sdX
# partprobe /dev/sdc

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.