Thursday, March 25, 2021

Removing a storage device from OS layer

Before removing access to storage device certain precaution needs to be taken. 


1. Check if the system is under memory pressure as I/O flush will add to the load

2. Free memory should not be less than 5 %

3. Swapping should not be active - (check si and so in vmstat output)

4. Close all applications using the file systems.

5. Unmount the file systems

6. Remove the device from volume groups (follow the volume manager software specific procedure)

7. Flush any outstanding I/O if device is used as raw device(blockdev --flushbufs device)

8. Remove any reference of disk based path /dev/dsk or /dev/dsk/by-path or major:minor from application and script

9. Remove each path from SCSI subsystem. 

10. echo 1 > /sys/block/device-name/device/delete

If the device is under multipath control and need to remove few paths. 

take the path offline echo offline > /sys/block/sda/device/state - This would ensure that subsequent I/O is sent to another alternate path.

then remove the device. 

echo 1 > /sys/block/device-name/device/delete





No comments: