[CentOS] iSCSI disk preperation

Mon Feb 7 20:57:30 UTC 2011
Ross Walker <rswwalker at gmail.com>

On Mon, Feb 7, 2011 at 3:41 PM, Jason Brown
<jason.brown at millbrookprinting.com> wrote:
> On 02/07/2011 03:26 PM, Ross Walker wrote:
>> On Mon, Feb 7, 2011 at 1:56 PM, Jason Brown
>> <jason.brown at millbrookprinting.com> wrote:
>>> I am currently going through the process of installing/configuring an
>>> iSCSI target and cannot find a good write up on how to prepare the disks
>>> on the server.  I would like to mirror the two disks and present them to
>>> the client.  Mirroring isn't the question, its how I go about it is the
>>> problem.  When I partitioned the two drives and mirrored them together,
>>> then presented them to the client, it showed to the client as a disk out
>>> no partion on it.  Should I partition the drive again and then lay the
>>> file system down on top of that?  Or should I delete the partitions on
>>> the target server and just have sda and sdb mirrored, then when the
>>> client attaches the disk, then partion it (/dev/sdc1) and write the file
>>> system.
>>
>> Whatever you export, the whole disk, partition or logical volume, the
>> initiator will see as a whole disk.
>>
>> So if you mirror sdaX and sdbX and export md0 the initiator will see a
>> disk the size and contents of sdaX/sdbX.
>>
>> Just create the filesystem on the disk on the initiator and use it there.
>>
>> REMEMBER: iSCSI isn't a way for multiple initiators to share the same
>> disk (though they can using specialized clustering file systems), it
>> is a way for multiple initiators to share the same disk subsystem.
>>
>> You can't access the file system from both the target-side and
>> initiator-side at once or it will corrupt the file system. If that's
>> what you want then you want NFS or Samba and not iSCSI.
>>
>
> Well my first question would be, do you really need to partition the
> disks on the target or can you just RAID them together (ie sdb/sdc and
> not sdb1/sdc1)?  Then create your md0 based off of the two drives.  Once
> that is done, export the md0 in /etc/tgt/targets.conf to present to the
> clients.

You don't need to partition the disks on the target if you want to
export the whole disks. I just don't recommend it because exporting
whole disks isn't the most economical use of the disks. The whole idea
of iSCSI is you can create one huge RAID array on the target and all
the initiators can then all benefit from it.

If you have 13 disks, say they're 500GB SATA disks. If you create a
RAID50 out of 2 6 disk RAID5s (stripe the LVs in LVM for management
ease instead of nested mdraid devices), you would get 10x the READ
IOPS of your mirror, and the same amount or better write IOPS then the
mirror, double the write IOPS then the single RAID5 and a tad better
read IOPS then your single RAID5. Not to mention a lot more storage
potential for the two servers, or a third server, or a fourth
server...

> Second question.  This does not need to be a clustered file system as
> only one server will need access to it at a time however, if server A
> failed, could you create a new server and present it to server B and the
> new server would have access to the files or would it show as an
> unpartitioned drive?

You can definitely allow two different hosts access to the target,
just not simultaneously (unless it's a clustered file system). The
second host can log in to the target, and have the disk at ready to
mount after the first target is offline or "fenced", just don't mount
it while it's mounted on the first target or zap! There goes your file
system!

-Ross