Subject: Re: NetBSD iSCSI HOWTOs
To: None <current-users@netbsd.org>
From: Ray Phillips <r.phillips@jkmrc.com>
List: current-users
Date: 03/02/2006 17:25:51
Sorry to lower the level of the conversation by asking another 
beginner's question but could you explain what kind of trickery is 
happening with the size of the iSCSI target file please?

I used a 75 GB target file on a ~ 108 GB /usr partition and ls -l 
/usr confirms it is 75 GB in size.  However, df says /usr has 59 GB 
available, which doesn't add up.

I've appended some output to this email to show the details.

Also, I was thinking of putting two network cards in the target, one 
for the iSCSI traffic which would be connected directly to the 
initiator, the other for managing the target which would be connected 
to the normal LAN.  Is it possible to configure the target to refuse 
connection attempts by initiators on the LAN NIC?


Ray



# cat /etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
#   it's the lowest common storage denominator
#   at least one is needed
# + a device is made up of one or more extents or other devices
#   devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
#   will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent        file or device          start           length
#extent0        /tmp/iscsi-target0      0               100MB
extent0         /usr/iscsi-target0      0               75GB

# target        flags   storage         netmask
#target0        rw      extent0         0.0.0.0/0
target0         rw      extent0         172.16.0.2/32
# ls -l /usr
total 33269950
drwxr-xr-x   2 root  wheel         1024 Feb 27 18:31 INSTALL
drwxr-xr-x   8 root  wheel          512 Feb 25 00:23 X11R6
drwxr-xr-x   2 root  wheel         7168 Feb 27 18:28 bin
drwxr-xr-x   3 root  wheel         1024 Feb 27 18:27 games
drwxr-xr-x   3 root  wheel          512 Feb 27 18:32 home
drwxr-xr-x  46 root  wheel         3584 Feb 27 18:27 include
-rw-r--r--   1 root  wheel  80530636801 Mar  2 14:36 iscsi-target0
drwxr-xr-x   4 root  wheel         9216 Feb 27 18:27 lib
drwxr-xr-x   4 root  wheel          512 Feb 25 00:23 libdata
drwxr-xr-x   8 root  wheel         1024 Feb 27 18:28 libexec
drwxr-xr-x   2 root  wheel         1024 Feb 25 01:24 lkm
drwxr-xr-x   2 root  wheel         1024 Feb 25 01:23 mdec
drwxr-xr-x   2 root  wheel         4608 Feb 27 18:27 sbin
drwxr-xr-x  28 root  wheel          512 Feb 25 00:23 share
# df -h
Filesystem    Size      Used     Avail Capacity  Mounted on
/dev/ld0a     2.0G      25M      1.9G     1%    /
/dev/ld0e     107G      43G       59G    42%    /usr
kernfs        1.0K     1.0K        0B   100%    /kern
# disklabel ld0
# /dev/rld0d:
type: unknown
disk: mydisk
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 14593
total sectors: 234441648
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

16 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
  a:   4209030        63     4.2BSD   2048 16384 22160  # (Cyl. 
0*-    262*)
  b:   2104515   4209093       swap                     # (Cyl. 
262*-    393*)
  c: 234441585        63     unused      0     0        # (Cyl. 
0*-  14593*)
  d: 234441648         0     unused      0     0        # (Cyl.      0 
-  14593*)
  e: 228128040   6313608     4.2BSD   2048 16384 28848  # (Cyl. 
393*-  14593*)
#