目次
Linuxにてディスク・ドライブのホットスワップを制御する手順。
| OS | CentOS 6 |
| M/B | ASRock Z370 Extreme4 |
| SSD | ADATA SU650 |
| SSD | crucial CT1000BX500SSD1 |
BIOSの設定にて、SATAの動作モードをAHCI、ディスクのホットスワップを有効化する必要がある。
コントローラのホットスワップが有効化されていれば、ディスクを接続するだけで自動的に検出される。
ディスクが検出された際には、/var/log/messagesに以下の様なログが出力される。
kernel: ata3: SATA link up 6.0 Gbps (SStatus 133 SControl 300) kernel: ACPI Error (psargs-0359): [DSSP] Namespace lookup failure, AE_NOT_FOUND kernel: ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SAT0.PRT2._GTF] (Node ffff88026be306f0), AE_NOT_FOUND kernel: ata3.00: ATA-9: ADATA SU650, P190710b, max UDMA/133 kernel: ata3.00: 3750748848 sectors, multi 16: LBA48 NCQ (depth 31/32), AA kernel: ACPI Error (psargs-0359): [DSSP] Namespace lookup failure, AE_NOT_FOUND kernel: ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SAT0.PRT2._GTF] (Node ffff88026be306f0), AE_NOT_FOUND kernel: ata3.00: configured for UDMA/133 kernel: ata3: EH complete kernel: scsi 2:0:0:0: Direct-Access ATA ADATA SU650 710b PQ: 0 ANSI: 5 kernel: sd 2:0:0:0: Attached scsi generic sg4 type 0 kernel: sd 2:0:0:0: [sde] 3750748848 512-byte logical blocks: (1.92 TB/1.74 TiB) kernel: sd 2:0:0:0: [sde] Write Protect is off kernel: sd 2:0:0:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA kernel: sde: kernel: GPT:Primary header thinks Alt. header is not at the end of the disk. kernel: GPT:3749978111 != 3750748847 kernel: GPT:Alternate GPT header not at the end of the disk. kernel: GPT:3749978111 != 3750748847 kernel: GPT: Use GNU Parted to correct GPT errors. kernel: kernel: sd 2:0:0:0: [sde] Attached SCSI disk
kernel: ata5: exception Emask 0x10 SAct 0x0 SErr 0x4050000 action 0xe frozen
kernel: ata5: irq_stat 0x00400040, connection status changed
kernel: ata5: SError: { PHYRdyChg CommWake DevExch }
kernel: ata5: hard resetting link
kernel: ata5: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
kernel: ACPI Error (psargs-0359): [DSSP] Namespace lookup failure, AE_NOT_FOUND
kernel: ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SAT0.PRT4._GTF] (Node ffff88026be306a0), AE_NOT_FOUND
kernel: ata5.00: ATA-10: CT1000BX500SSD1, M6CR030, max UDMA/133
kernel: ata5.00: 1953525168 sectors, multi 1: LBA48 NCQ (depth 31/32), AA
kernel: ACPI Error (psargs-0359): [DSSP] Namespace lookup failure, AE_NOT_FOUND
kernel: ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SAT0.PRT4._GTF] (Node ffff88026be306a0), AE_NOT_FOUND
kernel: ata5.00: configured for UDMA/133
kernel: ata5: EH complete
kernel: scsi 4:0:0:0: Direct-Access ATA CT1000BX500SSD1 030 PQ: 0 ANSI: 5
kernel: sd 4:0:0:0: Attached scsi generic sg6 type 0
kernel: sd 4:0:0:0: [sdg] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
kernel: sd 4:0:0:0: [sdg] Write Protect is off
kernel: sd 4:0:0:0: [sdg] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
kernel: sdg: sdg1
kernel: sd 4:0:0:0: [sdg] Attached SCSI diskディスクの切り離しを行う前に、ディスクへアクセスしているサービスの停止、パーティションのアンマウントを行う。
# lsof | grep "/dev/sdg" tgtd 3994 root 14u BLK 8,96 0t0 20079 /dev/sdg
# df | grep "sdg" /dev/sdg1 9612254672 1859479864 7264493620 21% /exports/disk1
# echo 1 > /sys/block/sdg/device/delete
kernel: ata5.00: disabled
kernel: ata5: exception Emask 0x50 SAct 0x0 SErr 0x4090800 action 0xe frozen
kernel: ata5: irq_stat 0x00400040, connection status changed
kernel: ata5: SError: { HostInt PHYRdyChg 10B8B DevExch }
kernel: ata5: hard resetting link
kernel: ata5: SATA link down (SStatus 0 SControl 300)
kernel: ata5: EH completeBIOSにてホットスワップが有効化されていない状態で検出を行うと、以下のログが出力される。
kernel: ata8: hard resetting link kernel: ata8: SATA link down (SStatus 0 SControl 300) kernel: ata8: EH complete