# Hotswap Disks

**URL:** <https://discuss.88.io/t/hotswap-disks/556>\
**Category:** home storage\
**Tags:** storage\
**Created:** [March 1, 2022, 12:15am UTC](https://discuss.88.io/t/hotswap-disks/556 "2022-03-01T00:15:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![admin](https://discuss.88.io/user_avatar/discuss.88.io/admin/32/38_2.png) [@admin](https://discuss.88.io/u/admin)\
**Post date:** [March 1, 2022, 12:15am UTC](https://discuss.88.io/t/hotswap-disks/556/1 "2022-03-01T00:15:10Z")

</div>

Hotswap Disks are great, we can replace them seamlessly with no downtime to the host computer. Applications on the computer keep on running non-stop.

# 1. Hotswap SATA

Steps to perform BEFORE pulling hotswap SATA disks out:

1. unmount
2. sync (unmount takes care of this but it doesn’t hurt to run it)
3. hdparm -Y /dev/sdX (put in sleep mode)
4. echo offline \> /sys/block/sdX/device/state (prevent any access)
5. echo 1 \> /sys/block/sdX/device/delete (delete associated driver)
6. dmesg (to check that the drive is stopped)
7. wait at least a minute for the disk to spin down
8. pull the drive out slowly

Notes:

1. SATA mode set to AHCI
2. Enable any hot-swap support in the BIOS
3. All steps above should be taken in sequence
4. Waiting for spin down to finish before removing the disk is important, step 5 will also spin the disk down if step 3 does not perform the spin down.

# 2. Hotswap USB

1. unmount
2. sync
3. echo 'offline' \> /sys/block/sdX/device/state
4. echo '1' \> /sys/block/sdX/device/delete
5. dmesg (to check that the drive is stopped)
6. wait at least a minute for the disk to spin down
7. unplug the drive slowly

Some other options:

1. eject /dev/sdX
2. udisksctl power-off -b /dev/sdX
