Freebsd

iSCSI:lsscsi 列出設備,但 fdisk 沒有

  • September 28, 2015

如何使 freebsd 顯示啟動器成為 zpool 中的可掛載目標?

在全新安裝的 FreeBSD 10.2(主機名bohr)上,我創建了一個 zpool,其名稱tank為單個 vdev,它是鏡像中的 2 個磁碟;然後我用 zfs 製作了一個 4GB 的捲(images)。我為指向images. Linux、FreeBSD 和 OS X 啟動器可以發現目標並連接,但它們都沒有找到我可以格式化或掛載的捲。

root@bohr:/tank/volumes # zfs list
NAME                  USED  AVAIL  REFER  MOUNTPOINT
tank                 4.13G   895G    96K  /tank
tank/volumes         4.13G   895G   100K  /tank/volumes
tank/volumes/images  4.13G   899G    64K  -
root@bohr:/tank/volumes # zpool status
 pool: tank
 state: ONLINE
 scan: none requested
config:

   NAME        STATE     READ WRITE CKSUM
   tank        ONLINE       0     0     0
     mirror-0  ONLINE       0     0     0
       ada1    ONLINE       0     0     0
       ada2    ONLINE       0     0     0

errors: No known data errors

root@bohr:~ # cat /etc/ctl.conf
auth-group ag0 {
   chap house shortshortdress
}

portal-group pg0 {
   discovery-auth-group no-authentication
   listen 0.0.0.0
   listen [::]
} 

target iqn.2015-09.com.example:images {
   auth-group no-authentication
   portal-group pg0

   lun 0 {
       path /tank/volumes/images
       size 4G
   }
}

所以,這是一個有代表性的 linux 發起者,注意/dev/sdd輸出中沒有fdisk -l

niels@suse_linux:~> lsscsi
[0:0:0:0]    disk    ATA      WDC WD1600AAJB-5 01.0  /dev/sda
[1:0:0:0]    cd/dvd  HL-DT-ST DVD-ROM GDR8162B 0015  /dev/sr0
[1:0:1:0]    cd/dvd  _NEC     DVD+RW ND-1100A  10FD  /dev/sr1
[2:0:0:0]    disk    ATA      TOSHIBA DT01ACA2 MX4O  /dev/sdb
[3:0:0:0]    disk    ATA      TOSHIBA DT01ACA2 MX4O  /dev/sdc
[21:0:0:0]   disk    FREEBSD  CTLDISK          0001  /dev/sdd

niels@suse_linux:~> sudo /usr/sbin/fdisk -l
root's password:

Disk /dev/sda: 160.0 GB, 159974776832 bytes, 312450736 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: 0x000c3390

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     4208639     2103296   82  Linux swap / Solaris
/dev/sda2   *     4208640    46153727    20972544   83  Linux
/dev/sda3        46153728   312449023   133147648   83  Linux

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md1: 2000.3 GB, 2000264691712 bytes, 3906766976 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

OS X 上的結果類似,連接但沒有可用的diskutil. 我也嘗試使用 freebsd 盒子作為啟動器,它會建立連接,但仍然沒有我可以訪問的設備。回到 bohr 以獲取另一個建立連接的範例,但是

root@bohr:~ # iscsictl -L
Target name                          Target portal    State
iqn.2015-09.com.example:images 192.168.1.148    Connected: da0

我遵循了 zfs 和 iscsi 的 FreeBSD 手冊。

好的,所以我需要通過特殊設備 /dev/zvol 路由我的 LUN。所以path /tank/volumes/images我需要path /dev/zvol/tank/volumes/images. 就是這樣。

引用自:https://serverfault.com/questions/725192