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
OR
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
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 9 comments… read them below or add one }
I am really curious why someone would want to do this.
Why would one do such a thing?
Can’t imagine a use case either…
And how to get deleted partition back?
@punktyras
Use partprobe command.
May be to avoid accidental mounting and deleting files. For example, boot embedded nas / router from /boot and run this command from /etc/rc.local. Now, apt-get or yum or ipkg will not able to update kernel and install at /boot.
Say are writing a script that modifies /boot or other part of fs. In that case you can delete /dev/whatever and use some image file on /boot and test your config without committing anything to real /dev/whatever and be done with testing.
Hope this helps!
Good for hide a special partition from others :)
@Vivek
Wouldn’t you then use fstab to point /boot at another partition?
I fear that the person who submitted the question is trying to get something done at their job, and will screw something up because they are approaching the solution wrong.
This could be used to test an application or something for disk failures. Like removing the drive suddenly to see what an application would do. As you can see partprobe would be able to get back the drive so no harm is done.
you can do this when you don’t want airport customs to see your files