この「ホスト」ディレクトリは何ですか?

この「ホスト」ディレクトリは何ですか?

私はRHEL 7.6ベースのディストリビューションであるOracle Linux 7.6を使用しています。次のテストは、RHEL 7.6または他のRHEL 7.6ベースのディストリビューションで同じでなければなりません。

Windows 10のVMware WorkstationでOracle Linux 7.6サーバーを実行しています。私がやりたいことは、Linuxサーバーを再起動せずにLinuxゲスト仮想マシンにディスクを追加することです。 Googleでこのページを見つけました。https://rahsupport.wordpress.com/2017/08/10/vmware-add-disk-to-linux-without-rebooting-the-vm/。デフォルトで実行される操作は次のとおりです。

  • VMware WorkstationのディスクをLinux仮想マシンに追加する
  • 行く/sys/class/scsi_host/
  • 走るecho '- - -' > host1/scan
  • その後、実行すると、fdisk -l新しく追加されたディスクが表示されます。

私の環境でテストしてみました。これらのホストディレクトリには3つあり、各ディレクトリscanにはファイルがあります。

root:[/sys/class/scsi_host]# ls -la
total 0
drwxr-xr-x.  2 root root 0 Aug 24 22:49 .
drwxr-xr-x. 54 root root 0 Aug 24 22:49 ..
lrwxrwxrwx.  1 root root 0 Aug 24 22:49 host0 -> ../../devices/pci0000:00/0000:00:07.1/ata1/host0/scsi_host/host0
lrwxrwxrwx.  1 root root 0 Aug 24 22:49 host1 -> ../../devices/pci0000:00/0000:00:07.1/ata2/host1/scsi_host/host1
lrwxrwxrwx.  1 root root 0 Aug 24 22:49 host2 -> ../../devices/pci0000:00/0000:00:10.0/host2/scsi_host/host2
root:[/sys/class/scsi_host]#
root:[/sys/class/scsi_host]# ls -la */scan
--w-------. 1 root root 4096 Aug 24 22:50 host0/scan
--w-------. 1 root root 4096 Aug 24 22:50 host1/scan
--w-------. 1 root root 4096 Aug 24 22:50 host2/scan
root:[/sys/class/scsi_host]#

元のLinuxサーバーはディスクを認識できませんでした。

root:[/sys/class/scsi_host]# fdisk -l

Disk /dev/sda: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d3e78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896  2059401215  1029212160   83  Linux
/dev/sda3      2059401216  2101344255    20971520   83  Linux
/dev/sda4      2101344256  2147483647    23069696    5  Extended
/dev/sda5      2101348352  2143289343    20970496   83  Linux
/dev/sda6      2143291392  2147483647     2096128   82  Linux swap / Solaris

ただし、次を実行するとecho '- - -' > host0/scanディスクが表示されます。

root:[/sys/class/scsi_host]# echo '- - -' > host0/scan
root:[/sys/class/scsi_host]# fdisk -l

Disk /dev/sda: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d3e78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896  2059401215  1029212160   83  Linux
/dev/sda3      2059401216  2101344255    20971520   83  Linux
/dev/sda4      2101344256  2147483647    23069696    5  Extended
/dev/sda5      2101348352  2143289343    20970496   83  Linux
/dev/sda6      2143291392  2147483647     2096128   82  Linux swap / Solaris

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

root:[/sys/class/scsi_host]# 

再テストするために、Linux VMを元の状態に復元しました。今回はecho '- - -' > host1/scan動作しませんでしたが、echo '- - -' > host2/scan動作しました。

root:[/sys/class/scsi_host]# fdisk -l

Disk /dev/sda: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d3e78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896  2059401215  1029212160   83  Linux
/dev/sda3      2059401216  2101344255    20971520   83  Linux
/dev/sda4      2101344256  2147483647    23069696    5  Extended
/dev/sda5      2101348352  2143289343    20970496   83  Linux
/dev/sda6      2143291392  2147483647     2096128   82  Linux swap / Solaris
root:[/sys/class/scsi_host]# echo '- - -' > host1/scan
root:[/sys/class/scsi_host]# fdisk -l

Disk /dev/sda: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d3e78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896  2059401215  1029212160   83  Linux
/dev/sda3      2059401216  2101344255    20971520   83  Linux
/dev/sda4      2101344256  2147483647    23069696    5  Extended
/dev/sda5      2101348352  2143289343    20970496   83  Linux
/dev/sda6      2143291392  2147483647     2096128   82  Linux swap / Solaris
root:[/sys/class/scsi_host]# echo '- - -' > host2/scan
root:[/sys/class/scsi_host]# fdisk -l

Disk /dev/sda: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d3e78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896  2059401215  1029212160   83  Linux
/dev/sda3      2059401216  2101344255    20971520   83  Linux
/dev/sda4      2101344256  2147483647    23069696    5  Extended
/dev/sda5      2101348352  2143289343    20970496   83  Linux
/dev/sda6      2143291392  2147483647     2096128   82  Linux swap / Solaris

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

root:[/sys/class/scsi_host]#

私の質問は、これらは何ですか?所有者目次? Linuxサーバーがディスクを認識したいが認識できないのはなぜecho '- - -' > host0/scanですか?echo '- - -' > host2/scanecho '- - -' > host1/scan

ところで、私はLinuxに初めて触れ、まだ学んでいます。

ベストアンサー1

異なるhostディレクトリは、異なるディスクコントローラに対応します。コントローラがマッピングされるターゲットは、関連技術によって異なります。 AHCI SATAはポートごとに1つのホストをホストし、NVMeはコントローラごとに1つのホストを使用します。これは仮想マシンの設定によって異なります。

デフォルトでは、これはすべてのホストを再検索する必要があることを意味します。

おすすめ記事