Wednesday, July 10, 2019

Linux: How do to permanently disable hard drives?

Linux: How do to permanently disable hard drives?

If the disks are SATA (the most normal thing; they are sdasdb, etc. you can do that two ways:

  • After the boot, you can disable them. The "magic" is (as root)

echo 1 > /sys/block/sdx/device/delete

where sdx is your disk. This will make the device disappear. Notice however that if something triggers an update of udev the disks may reappear.
Note also that the 
sdx denomination is not completely fixed; it can change especially if you add/delete disks to the system.

  • At boot level, if you have a kernel with version 3.13 or newer. You need to identify the ATA address, which is a number like 4.00 
     you can use 

dmesg | grep ata
ata4.00: ATA-8: ST2000DM001-1CH164, CC24, max UDMA/133

and you can completely hide the disk with the boot parameter:


the disk will act as if it was not connected at all to the system.

  • Another option is using udev rules as explained (I did not test) here. The difference, in this case, is that the disk devices are still there, but the disks are not mounted. In 99% of the case, the result is the same, unless you are playing tricks with directly writing to the raw disk devices...

I do not own the copyright on this.

1 comment:

sadimabey said...

Harrah's Lake Tahoe Hotel & Casino - Mapyro
Find Harrah's Lake Tahoe Hotel & 부천 출장샵 Casino, Stateline 전라북도 출장안마 NV, United States, ratings, photos, prices, expert 속초 출장샵 advice, traveler reviews 보령 출장안마 and tips, and more information  Rating: 4.2 군포 출장마사지 · ‎18 reviews