Set up and document iSCSI device for fighter #119
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Because we've been running some of our production data on a SATA SSD RAID-0 array, I've finally decided that I don't need to lose data before moving to a more resilient setup.
fighter
to usefighter
fighter
to mount the device on bootAdditional tasks:
fighter
.Creating the Zvol and iSCSI share in TrueNAS Scale
Tank
).fighter
, Size for this zvol:8 TiB
. Leave all other settings default.iqn.2020-04.net.jafner
)).a. Create or Choose Block Device. Name:
fighter
, Device:zvol/Tank/fighter
, Sharing Platform:Modern OS
.b. Portal. Portal:
Create New
, Discovery Authentication Method:NONE
, Discovery Authentication Group:NONE
, Add listen:0.0.0.0
.c. Initiator. Leave blank to allow all hostnames and IPs to initiate. Optionally enter a list IP address(es) or hostname(s) to restrict access to the device.
d. Confirm. Review and Save.
Done!
Connecting to the iSCSI Share in Debian 12
open-iscsi
package withsudo apt-get install open-iscsi
.sudo iscsiadm --mode discovery --type sendtargets --portal 192.168.1.10
where the IP for--portal
is the IP of the NAS hosting the iSCSI share. In my case, this returns192.168.1.10:3260,1 iqn.2020-03.net.jafner:fighter
.sudo iscsiadm --mode node --targetname "iqn.2020-03.net.jafner:fighter" --portal "192.168.1.10:3260" --login
. Where the name for--targetname
is the iqn string including the share name. And where the address for--portal
has both the IP and port used by the NAS hosting the iSCSI share. Verify the session connected withsudo iscsiadm --mode session --print=1
, which should return the description of any active sessions. Debian.org.a. Identify the device name of the new device with
sudo iscsiadm -m session -P 3 | grep "Attached scsi disk"
. In my case,sde
. ServerFault.b. Partition and format the device. Run
sudo parted --script /dev/sde "mklabel gpt" && sudo parted --script /dev/sde "mkpart primary 0% 100%" && sudo mkfs.ext4 /dev/sde1
Server-world.info.c. Mount the new partition to a directory. Run
sudo mkdir /mnt/iscsi && sudo mount /dev/sde1 /mnt/iscsi
. Where the path/dev/sde1
is the newly-created partition and the path/mnt/iscsi
is the path to which you want it mounted.d. Test the disk write speed of the new partition. Run
sudo dd if=/dev/zero of=/mnt/iscsi/temp.tmp bs=1M count=32768
to run a 32GB test write. Cloudzy.com.Connecting and mounting the iSCSI share on boot
/etc/iscsi/nodes/<share iqn>/<share host address>/default
. In my case it was/etc/iscsi/nodes/iqn.202-03.net.jafner:fighter/192.168.1.10,3260,1/default
. Debian.org.node.startup
parameter toautomatic
. Runsudo sed -i 's/node.startup = manual/node.startup = automatic/g' /etc/iscsi/nodes/iqn.2020-03.net.jafner:fighter/192.168.1.10,3260,1/default
./etc/fstab
. Runsudo bash -c "echo '/dev/sde1 /mnt/iscsi ext4 _netdev 0 0' >> /etc/fstab"
. Adamsdesk.com, StackExchange.Alright, we've successfully built a test instance of Nextcloud with the iSCSI device as its data partition.
Next step is to move the current instance over. Just gotta be attentive to permissions.
We've now moved everything except Autopirate off of md0 and onto the iscsi directory.
How to Gracefully Terminate iSCSI Session
for stack in /home/admin/homelab/fighter/config/*; do cd $stack && if $(docker-compose config | grep -q /mnt/iscsi); then echo "ISCSI-DEPENDENT: $stack"; fi ; done
to get the list of iSCSI-dependent stacks. Ensure all listed stacks are OK to shut down, then runfor stack in /home/admin/homelab/fighter/config/*; do cd $stack && if $(docker-compose config | grep -q /mnt/iscsi); then echo "SHUTTING DOWN $stack" && docker-compose down; fi ; done
.sudo umount /mnt/iscsi
.sudo iscsiadm --mode node --targetname "iqn.2020-03.net.jafner:fighter" --portal "192.168.1.10:3260" --logout
.sudo shutdown now
.