Connect your Raspberry Pi to a NAS using iSCSI

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024
  • One way to expand the storage on your Raspberry Pi is to connect it to a NAS over protocols like SMB, or NFS. Those are file sharing protocols. However the Raspberry Pi (and Linux) also support block level access to remote storage, using iSCSI. Here is a tutorial on how to connect your Pi to a NAS using iSCSI.
    HOWTO: github.com/gar...
    How to Partition and Format a Disk in Linux: • How to Partition and F...
    Synology DS420j Review, Hands-on, and Setup Guide: • Synology DS420j Review...
    Synology NAS - Free Yourself From the Cloud: • Synology NAS - Free Yo...
    Let Me Explain T-shirt: teespring.com/...
    Twitter: / garyexplains
    Instagram: / garyexplains
    #garyexplains

Комментарии • 59

  • @GaryExplains
    @GaryExplains  2 года назад +5

    ERRATA: You don't need to edit the /etc/iscsi/initiatorname.iscsi file and set the InitiatorName. Just leave the file as is. The iSCSI qualified name (IQN) of the Pi is defined in `/etc/iscsi/initiatorname.iscsi`. During installation the initial IQN will be generated automatically. If you wish to create a new IQN then use the `iscsi-iname` utility, it will print out a new IQN for you.

  • @wxfield
    @wxfield 8 месяцев назад

    I like the speed at which you go through these.
    I tend to be impatient and just want to get the major points before going off to do it myself.

  • @AlastairMontgomery
    @AlastairMontgomery 2 года назад +7

    Liked SCSI, I remember with CD-R drives came affordable for the home user, my friends had constant buffer under-runs with their IDE CD-R drives, I had an external SCSI one had no issues at all.

  • @timrobertson8242
    @timrobertson8242 Год назад +1

    As mentioned in other comments. The initiator name and target should be different. Looking at Synology, there is a Custom option for the configuration where you can limit the advertisement of the LUN to a set of IP addresses or initiator names. When unspecified All imitators doing the connect to the target will see those LUN.
    Great job getting folks started on the ISCSI path. I’ll also mention that one might have different sd drive letters assigned (like if you stick a USB in or have multiple targets responding). In this case, I use File System labels for my mount in fstab (or LVM2 on top of iScsi and leverage the Group and Logical Volume names in my mount.
    netdev option in fstab was also mentioned earlier.

  • @TheClembo
    @TheClembo 2 года назад +4

    Thanks Gary -Now I get it!, simple when it has been explained to you -thank you. Cheers.

  • @beauregardslim1914
    @beauregardslim1914 2 года назад +1

    iSCSI is great stuff for certain applications, but you need to be sure that the network connection is rock solid or you may end up with corruption. The underlying subsystems are intended for use with locally attached drives and are much less forgiving than network file protocols like SMB or NFS.

  • @vinnytube1001
    @vinnytube1001 2 года назад +8

    Actually Gary, you can put an fstab entry in there and then add "_netdev,x-systemd.requires=iscsi.service" to the mount options. At least assuming you are using Raspbian, as I am, and my system is using systemd. This is even better since the sleep either wastes time, or isn't long enough and then it won't work.
    Otherwise great video. Only suggestion might be to give some suggestions how this could be useful. I can see some uses for sure, but a lot of people might be asking why do this over just using the Synology. But then again not everybody might run lots of Pi boards running different services and wanting to co-locate the data onto a single NAS/SAN.

    • @GaryExplains
      @GaryExplains  2 года назад +2

      Thanks for the info. I will update my document in GitHub. 👍

    • @timrobertson8242
      @timrobertson8242 2 года назад +1

      Another tip in /etc/fstab is the Label of the Filesystem [LABEL=] (created with mkfs -L OR e2label) or disk UUID [UUID=] and not hardcode the /dev/sda, if you have multiple iSCSI targets for a single client you run the risk of different device assignment order.

    • @WizardNumberNext
      @WizardNumberNext 2 года назад

      I run
      Raspberry Pi 3B
      Raspberry Pi 4B 2GB
      2x Raspberry Pi 4B 4GB
      I have Lenovo M93p Tiny working as VLAN router, DHCP, DNS and kerberos server
      I just managed to setup kerberised NFS (second time with 10 years between)
      I am happy with that
      I have Dell PowerEdge R715 and R815
      I shall be downloading whole RHEL repository (definitely release 7 and 8, maybe 6 too)
      I may end up at least trying downloading SLE too
      Now I can make mirror for Ubuntu as well
      I have full mirror of Debian already
      Now I can access all of this as file not through http or ftp (surprisingly very slow)

  • @samaitcheson7057
    @samaitcheson7057 2 года назад +3

    Really useful video Gary. Thanks.

  • @morselrafez3722
    @morselrafez3722 2 года назад +2

    You stopped your Speed test G videos. I miss them a lot.
    Are you going to test the S22 ultra ?

  • @TomLeg
    @TomLeg 2 года назад

    Love the background!

  • @jeffsadowski
    @jeffsadowski 2 года назад

    Wow!! Very useful video not just for iscsi not just for the pi. I wanted to do something similar for nfs mounts and your info near the end helps me with that too. I'll experiment with iscsi on other devices. I'll setup an iscsi server on another linux device.

  • @mikeulkheul
    @mikeulkheul 7 месяцев назад

    absolutely brilliant explanation, thank you!

  • @chromerims
    @chromerims 10 месяцев назад

    Technically correct and very well made video 👍
    But for my home, this would be a novelty, fun project only.
    Not sure iSCSI is advisable in a home lab or home network. Better for enterprise SAN.
    Kindest regards, neighbours.

  • @smile768
    @smile768 2 года назад

    Well explained. Easy when you know how.(I didn't before!)

  • @nicoladellino8124
    @nicoladellino8124 2 года назад

    Very nice video, TNX.

  • @AllwarappanSundararaj
    @AllwarappanSundararaj 2 года назад

    I love this Gary.. thank you.

  • @SchoolforHackers
    @SchoolforHackers 2 года назад

    Excellent as always. Thanks -

  • @lambiekvideo
    @lambiekvideo Год назад

    Many thanks for this topic. I'm complete new and just started with the raspberry pi 4. I manage to install the iSCSI. The folders are visual 'lost + found' Only I have no acces to the folders ie. no permission. So something went wrong but i'm lost to find a solution.
    😁

  • @LampJustin
    @LampJustin 2 года назад

    Hey there,
    you did a small mistake: the initiatorname on the pi should not be changed! It's the name of the pi and not the targets name. The pi needs to have a unique iqn. I don't know DSM but if you have a look into the UI it should now show the client with the same iqn as the target. As stated before that might be problematic.
    Other than that, great video, thank you very much! :)

    • @GaryExplains
      @GaryExplains  2 года назад +1

      Ah! Yes... I think you are right. I will edit my document on GitHub and leave a pinned comment on this video.

    • @LampJustin
      @LampJustin 2 года назад

      @@GaryExplains thank you :)

  • @or4n
    @or4n 2 года назад +1

    Shouldn't that InitiatorName be unique so you can distinguish between different initiators? Now what would happen if you had multiple initiators with same name?
    Also don't think you can specify multiple InitiatorNames in case you have multiple targets.

    • @GaryExplains
      @GaryExplains  2 года назад

      Ah, I see what you mean. Yes, I think I made a mistake there. I will edit my document on GitHub and leave a pinned comment on this video.

  • @adrianteri
    @adrianteri 2 года назад

    @Gary Explains a better way to mount after boot-up by using a #systemd service that ensures the network is already up? Credit to @ Chris Titus Tech (CTT) for the idea.... Apologies for any inappropriate fields and/or errors ...
    ## example systemd file
    [Unit]
    Description=Mount iSCSI drives on boot-up
    Wants=network-online.target
    After=network-online.target
    [Mount]
    What=/dev/sda1
    Where=/iscsimnt
    Type=ext4
    Options=defaults,rw,noatime
    [Install]
    WantedBy=mutli-user.target
    You may want to change the file permissions for the /iscsimnt as it's owned by only root...

  • @muddyexport5639
    @muddyexport5639 2 года назад +1

    Thanks, Professor!
    #question: If you have multiple drives across several Pis that your want to include in a muti/mass storage unit, is that doable via iSCSI commands? (I don't have a Synology bay. I do have several Pi 4Bs with SSD external storage.)

    • @SchoolforHackers
      @SchoolforHackers 2 года назад

      Yes, under ZFS. You might need GlusterFS if you want multi-host storage redundancy. Either way you lose quite a bit to redundancy. What do you think, Gary?

  • @Legend-pc4bo
    @Legend-pc4bo 2 года назад +1

  • @leightaylor8069
    @leightaylor8069 2 года назад

    Genius.

  • @firstprincipleswithsuhas
    @firstprincipleswithsuhas 2 года назад

    Hi, I already followed those instructions wrt initator name edits. My R pi hung and is not restarting. This happened just when I was filling up the '.sh' file. I am not sure if it was because of editing the isci/initiatorname. Anyone else encounter this?

  • @tonysheerness2427
    @tonysheerness2427 2 года назад

    scsi drives were parallel drives and there was a limit of how long the cables could be and had to have a termination plug to tell it the end of line. In a parallel cable all the bits have to arrive at the same time or it will not work, so the longer the cable the more chance of an imbalance between the lines of the cable. The irony now is the distance is no longer a problem or is it?

    • @vk3fbab
      @vk3fbab 2 года назад +1

      For direct attached drives there is a distance limit. Faster buses usually get smaller lengths. iSCSI and other SAN protocols increase these limits as they are networking protocols. However as the latency increases so does the chance of corruption. So while you could run iSCSI over the public internet people tend not to. Packet delays and dropouts make it challenging to run block level protocols. The filesystems that run on top of iscsi wouldn't handle networking issues very well. But you could run iSCSI over the internet if you wanted to.

  • @alokj.3291
    @alokj.3291 2 года назад

    Sir speed test g latest. Many new phones are out now with new soc

  • @wolf3five
    @wolf3five 8 месяцев назад

    can you flash it to ntfs

  • @WizardNumberNext
    @WizardNumberNext 2 года назад

    Why greping using single pattern?
    Why not grep 'scsi\|sd'
    I use grep 'scsi\|sd\|ata' to show everything concerning drives
    Not using basics of grep leads to nie being able to use sed and awk
    I use sed on daily basis, usually to shorten my one-liners (which quickly becomes litany or rather prayer to not mess up)

  • @christophhaug
    @christophhaug 11 месяцев назад

    Any reason why you didn't use crontab to run the script after boot?

    • @GaryExplains
      @GaryExplains  11 месяцев назад

      You can use whatever you are comfortable with. For me when I did my Unix system admin training (many years ago) we used rc.local, and that is what I still use now.

  • @QuimChaos
    @QuimChaos 2 года назад +2

    i just want to be able to buy a RaspberryPi...

    • @Mike-bs5pi
      @Mike-bs5pi 2 года назад

      I haven't look in about a month, but I've been trying to get a couple also. I've seen them, just way overpriced.

  • @whothefoxcares
    @whothefoxcares 2 года назад

    Q: can iscsi abuse cloud storage?

    • @timrobertson8242
      @timrobertson8242 2 года назад

      If I understand your question correctly, iSCSI is quite chatty and not a WAN type protocol and requires a pipe BIG in both directions. It is best to have the Target available locally, if it chooses to leverage a .img file as the backing from a Cloud Provider, it would be interesting to measure the impact. As I see from my searches, ubuntu, at least, has a tgt package to playing the Target and can be configured to have a .img file be the Source of the LUN.

  • @jeffsadowski
    @jeffsadowski 2 года назад

    ipv6 is still a pain to setup.

    • @wayland7150
      @wayland7150 2 года назад

      Hobbyists ignore IPv6. Maybe it's time we were more friendly towards her.

  • @philipthatcher2068
    @philipthatcher2068 2 года назад +1

    Was anybody else shouting 'lsblk" at the screen?

  • @funkmasterfrex
    @funkmasterfrex 2 года назад

    That’s cherry pie in the thumbnail…

  • @razisn
    @razisn 2 года назад

    Connecting through a block level protocol makes the storage device a SAN rather than a NAS.

    • @GaryExplains
      @GaryExplains  2 года назад

      Indeed which is why we use the SAN manager to create the Target. But it doesn't stop being a NAS. It isn't mutually exclusive.

    • @razisn
      @razisn 2 года назад

      @@GaryExplains well maybe not anymore since the advent of block level protocols over IP as iSCSI, but in the older days there was a clear distinction. A SAN was implemented over Fibre Channel using Fobre Channel switching equipment were required.

    • @GaryExplains
      @GaryExplains  2 года назад

      Well if "not anymore" why mention it?

  • @helge000
    @helge000 2 года назад

    The reason it hangs on ip6 is you are using link local address space (fe80::). Though I do not recommend using those, they will work if you specify the interface for the address, IE. fe80::1%eth0

    • @GaryExplains
      @GaryExplains  2 года назад

      The problem is that the ipv6 stuff is being discovered and used by the iscsiadm command, it isn't something I have explicitly setup.

    • @helge000
      @helge000 2 года назад

      @@GaryExplains right, and this in turn because iscsid assumes your network is properly set up. It's enterprise stuff; normally you would add fancy stuff like dm-multipath on top of that. Maybe a fix: turn off ip6 in your target daemon or better yet set your router to advertise FD:: private address/autoconf. Those will be global and work out of the box

    • @GaryExplains
      @GaryExplains  2 года назад

      Does that mean that ipv6 isn't setup correct by default on Raspberry Pi OS?

    • @helge000
      @helge000 2 года назад

      @@GaryExplains The OS (Synology Pi, ect) is doing the right thing: Falling back to link-local because it cannot get a global address. Your home network lacks correct ip6 advertisements. Since you likely get dual stack from your IP provider this topic might be worth a video?