Make a note of the device name allotted for your hard disk/SSD, i.e.
/dev/sdb. Lets assume its
/dev/sda for the rest of the post.
lsblk -f and ensure that no partitions of this device
/dev/sda are mounted or in use. In the output of the command, there must be no entries in the "MOUNTPOINTS" column. If there are any entries (such as
swap disk), unmount all such partitions.
Finally, to disconnect the disk device, run:
sudo bash -c 'echo 1 > /sys/block/sda/device/delete'
When trying to install Linux Mint 21 to an external USB drive, I had a peculiar issue with the installer trying to modify partition tables for two devices: sda (primary SSD with Linux Mint 20.3) and sdb (USB drive).
On digging further, it turned out that the Live CD environment was using
/dev/sda's swap partition for its use, and when it was deselected in the installer as "Do not use this partition", the installer registered that as a change to be made in
/dev/sda's partition table.
To prevent any side-effects to a fully functional Linux Mint installation on my
/dev/sda, I needed to safely "deallocate"
/dev/sda from the system.
/dev/sda is an internal SSD, I cannot simply disconnect the cable, and the device is not available for powering off in any Live CD GUI option.