Use iSCSI block storage from your Synology NAS, with Fedora.

iSCSI has become something of a staple in the world of Linux block storage. It’s quick, it’s reliable I wouldn’t consider it the most secure option but it does “just work”.

I often use iscsi block storage for persistent container storage, as well as a cheap way to add more disk to my VM.

This used to be something of a chore, with iscsiadm and manually copying and pasting long target names, trying to keep track of what is where. Remembering what order to do things, and testing over and over. The Cockpit package within Fedora makes this totally simple now.

This walkthrough will show you how to use your Synology NAS with Fedora 31 to mount remote storage within minutes. NOTE: I’m not using CHAP authentication, as this is just for my own vm’s. In a production environment, you should be using “at least” CHAP.

Ok, what you will need – a volume on your NAS and a local area network. Ideally a Fedora (https://getfedora.org/) vm to test.

Configure the LUN on the NAS

The LUN is the block of storage you want to present. The target is the device that will present that storage to the rest of the network.

Create the LUN

Log into the Synology NAS as an administrator and select the iscsi manager icon.

iscsi-manager

Click on LUN, and create.

Give your LUN a meaningful name, and select how much space you want to allocate from the Synology Volume.

iscsi-manager-2

In order to access the LUN you are creating, you’ll need a target. This can be done at the same time by selecting “Create a new iscsi target”.

iscsi-manager-3

Here you can give your target a sensible name, and the complex “iqn” name will be generated automatically. If you were running a production system you would enable chap authentication at this point on the target.

iscsi-manager-4

Now that is finished, we can see our target with a mapped LUN. How simple was that?

iscsi-manager-6

 

Configuring the client (the Linux box)

In your web browser, connect to your Fedora server with your administrative user. I’m connecting as root for testing, but ideally, this should be your user with SUDO privileges,

cockpit-1

Once logged in, click on the storage tab and scroll down to iscsi targets. This is a list of iscsi targets that your Linux box is aware of. As we don’t have any, we’ll need to add a target and scan for available LUNS.

cockpit-2

To scan for LUNS on a target, click the + button and you’ll be asked for a server address. This is the IP, or hostname of your synology server. Click Next to start scanning.

cockpit-3

Here you can see a list of targets that it’s found. You are probably wondering why we see 3 targets when we only created 1 ? Well, we have IPv6 enabled so they all present the same lun, it’s just a mixture of ipv4 and ipv6 interfaces. As I use ipv4, i’ll be selecting that one and clicking add.

cockpit-4

 

When we now look at our storage drivesin cockpit, we can see a new disk drive. This is the LUN we selected in the previous step. It can be formatted and treated like any other disk.

cockpit-5

Click on the new Synology drive and you can create a partition table on that disk.

cockpit-6

Personally, I like ext4 and I’ve chosen to zero the disk. I’ll be mounting it on  /home/iscsi

cockpit-9

When this completes, you’ll have a 1gb drive mounted from your synology server to the directory /home/iscsi of 1gb. As seen below.

cockpit-11

That’s it. A really simple, effective way to add more disks to a VM or physical hosts without having to touch a screwdriver.

Please let me know if you have any comments or feedback.

Matt

 

Use iSCSI block storage from your Synology NAS, with Fedora.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.