Unable to create target drives in non-root directory in CentOS 6.5
Michael Grover <[email protected]> Mon, 7 Dec 2015 14:59:29 -0500
| Newsgroups | org.kernel.vger.stgt |
|---|---|
| Message-ID | <CAAGs95CfsBMRTMjgH=sg=Z+bZMwr460CHOZ+ArzDQi=4uMb51g@mail.gmail.com> |
I'm trying to create target drive files on CentOS 6.5 using stgt. I am
not able to create the drives on a non-root directory. Here's what I
do:
I create two drive files, one on the root directory and one on a
directory owned by a user called "iscsi_target":
dd if=/dev/zero of=/iscsi_drives/temp
dd if=/dev/zero of=/home/iscsi_target/iscsi_drives/temp
I do a little SELinux management:
semanage fcontext -a -t tgtd_var_lib_t /iscsi_drives/temp
semanage fcontext -a -t tgtd_var_lib_t /home/iscsi_target/iscsi_drives/temp
restorecon -Rv /iscsi_drives/temp
restorecon -Rv /home/iscsi_target/iscsi_drives/temp
Here is what the pertinent lines in my targets.conf file look like:
<target iqn.2015.12.com.mysite:temp_target>
#backing-store /home/iscsi_target/iscsi_drives/temp
backing-store /iscsi_drives/temp
</target>
If I start the tgtd service, I get no errors. However, if I toggle the
comments on the two backing-store lines, switching which drive my
target uses, I get the following error:
Command:
tgtadm -C 0 --lld iscsi --op new --mode logicalunit --tid 1 --lun
1 -b /home/iscsi_target/iscsi_drives/temp
exited with code: 22.
Do you know what might be going on here?
Thanks for any help.