up

SATA HotPlug and HostSwap in Ubuntu Linux

Check active scsi devices:

ubuntu@ubuntu:~$ lsscsi
[1:0:1:0]    disk    ATA      SAMSUNG HD103SJ  1AJ1  /dev/sda
[2:0:0:0]    disk    ATA      SAMSUNG HD103SJ  1AJ1  /dev/sdb
[3:0:0:0]    cd/dvd  HL-DT-ST DVDRAM GH22NS90  HN00  /dev/sr0
[5:0:0:0]    disk    Generic  STORAGE DEVICE   9451  /dev/sdd
[6:0:0:0]    disk    GT-I5700  - Card                /dev/sdc

Now refresh SCSI devices. Use this command to refresh host0 (or host1, host2, host3):

ubuntu@ubuntu:~$ echo "- - -" | sudo tee -a /sys/class/scsi_host/host0/scan 

Check the result:

ubuntu@ubuntu:~$ lsscsi 
[0:0:1:0]    disk    ATA      SAMSUNG SP1213C  SV10  /dev/sde
[1:0:1:0]    disk    ATA      SAMSUNG HD103SJ  1AJ1  /dev/sda
[2:0:0:0]    disk    ATA      SAMSUNG HD103SJ  1AJ1  /dev/sdb
[3:0:0:0]    cd/dvd  HL-DT-ST DVDRAM GH22NS90  HN00  /dev/sr0
[5:0:0:0]    disk    Generic  STORAGE DEVICE   9451  /dev/sdd
[6:0:0:0]    disk    GT-I5700  - Card                /dev/sdc

HotPlugged SATA HDD appeared on the first line.

Now you can see the partitions on /proc/partitions file:

ubuntu@ubuntu:~$ cat /proc/partitions
major minor  #blocks  name

   8        0  976762584 sda
   8        1     975872 sda1
   8        2          1 sda2
   8        3  963902464 sda3
   8        5   11881472 sda5
   8       16  976762584 sdb
   8       17     975872 sdb1
   8       18          1 sdb2
   8       19  963902464 sdb3
   8       21   11881472 sdb5
  11        0    1048575 sr0
   9        1     975808 md1
   9        0  963902400 md0
   8       64  117245471 sde
   8       65   35656267 sde1
   8       66   57850065 sde2
   8       67    4056412 sde3
   8       68   19679593 sde4

Now I can mount sde[1234] partitions.

Add new comment