diff --git a/_knowledge-base/mounting_network_share_linux.md b/_knowledge-base/mounting_network_share_linux.md
index 828b448..7ccb3f4 100644
--- a/_knowledge-base/mounting_network_share_linux.md
+++ b/_knowledge-base/mounting_network_share_linux.md
@@ -5,15 +5,15 @@ but the current go-to is **systemd mount**.
There are two distinct ways to mount with systemd
-* **mount** service is enabled
+* **mount** unit is enabled
straight up simple mounting at boot, high expectation that the network share
is always available during the boot, it's simple and easy to control
- order of execution, retries, time outs, easy to debug,
+ order of execution, time outs, easy to debug,
best for servers, docker hosts,...
-* **automount** service is enabled
+* **automount** unit is enabled
the mounting happens at the first demand to access the path,
does not wait during boot for the mount to really happen, less predictable,
- can auto-umount on idle, good for users machines
+ can auto-unmount on idle, good for users machines
# Samba / SMB / CIFS
@@ -21,9 +21,12 @@ There are two distinct ways to mount with systemd
[Arch wiki](https://wiki.archlinux.org/title/samba#As_systemd_unit)
on samba systemd mount
-* Have `/mnt/pool` directory ready on the client - `sudo mkdir /mnt/pool`
-* will be creating a mount file in `/etc/systemd/system/`
- the name MUST correspond with the planned mount location,
+* **install samba** support package, on most distros it's `cifs-utils`
+* **test** if you can access the share,
+ visit the IP of the NAS in your file explorer `smb://10.0.19.80`
+* Have the **mount path ready** on the client - `sudo mkdir /mnt/pool`
+* will be creating a **mount file** in `/etc/systemd/system/`
+ the name MUST correspond with the planned mount location,
just slashes `/` are replaced with dashes `-`
So if the share should be mounted at `/mnt/pool` the file is:
`/etc/systemd/system/mnt-pool.mount`
@@ -43,20 +46,18 @@ on samba systemd mount
[Install]
WantedBy=multi-user.target
```
-* enable the mount service `sudo systemctl enable mnt-pool.mount`
+* **enable the mount unit** `sudo systemctl enable mnt-pool.mount`
* done
### Automount version
-If the machine is just an end user PC or a notebook,
-or no service really depends on that share being present straight from boot,
-or a notebook moves between networks and share is not always there...
-we can use automount that mounts the share only when something tries to access
-the path.
+If the machine is just an end user PC or a notebook that moves between networks
+and share is not always there... we can use automount that mounts the share
+only when something tries to access the path.
-* disable mount service if already enabled:
+* **disable the mount unit** if already enabled:
`sudo systemctl disable mnt-pool.mount`
-* we add another file next to the mount file, named exactly the same,
+* **add another file** next to the mount file, named exactly the same,
except the extension is `automount`, so here it would be:
`/etc/systemd/system/mnt-pool.automount`
```ini
@@ -70,7 +71,7 @@ the path.
[Install]
WantedBy=multi-user.target
```
-* we enable this automount service:
+* we **enable the automount unit**:
`sudo systemctl enable --now mnt-pool.automount`
* done
@@ -78,15 +79,17 @@ the path.
### Useful commands
`smbclient -L 10.0.19.11` - list shares mounted from the ip
-`systemctl list-units -t mount --all`
+`systemctl list-units -t mount --all` - list all mount unit
# NFS
[Arch wiki](https://wiki.archlinux.org/title/NFS#As_systemd_unit)
on NFS systemd mount
-All the stuff regarding mount vs automount from Samba section above applies,
-only the content of the systemd unit files changes.
+All the stuff regarding mount vs automount from Samba section above applies.
+You need to **install nfs support package**,
+it's `nfs-utils` or `nfs-common` or `nfs-client` depending on the distro.
+
`/etc/systemd/system/mnt-pool.mount`
```
@@ -121,9 +124,79 @@ WantedBy=multi-user.target
```
-Enable the mount service: `sudo systemctl enable --now mnt-pool.mount`
+Enable the mount: `sudo systemctl enable --now mnt-pool.mount`
Or for automount `sudo systemctl enable --now mnt-pool.automount`
+
+# iSCSI
+
+[Arch wiki](https://wiki.archlinux.org/title/Open-iSCSI)
+detailed instructions.
+
+* **install** `open-iscsi` and enable two services
+ `sudo systemctl enable --now iscsid` - daemon managing iscsi sessions
+ `sudo systemctl enable --now iscsi` - provides automatic login to targets
+* to **discover** available targets at an IP,
+ run `sudo iscsiadm -m discovery -t sendtargets -p 10.0.19.80`
+ something like *10.0.19.11:3260,1 iqn.2005-10.org.freenas.ctl:test_2*
+ should be an answer, it also creates a node entry in /var/lib/iscsi/...
+* **login** to all discovered iscsi targets - `sudo iscsiadm -m node --login`
+ * to list current sessions - `sudo iscsiadm -m session`
+* **autologin at boot** to all discovered targets:
+ `sudo iscsiadm -m node --op update -n node.startup -v automatic`
+ * verify: `sudo iscsiadm -m node -o show | grep node.startup`
+* **format** the iscsi drive
+ * `lsblk` - to see new block devices and
+ `sudo iscsiadm -m session -P 3` to confirm that sdx is really
+ the block device we want to work with
+ * format the sdx directly, no need for sdx1 partitioning
+ if all the space is used.
+ It makes lsblk output cleaner, where iscsi devices easily recognizable.
+ * `sudo mkfs.ext4 /dev/sdx -L test_2`
+* **mount** the share somewhere and **take ownership**
+ * `sudo mkdir /mnt/test_2`
+ * `sudo mount /dev/sdx /mnt/test_2`
+ * `sudo chown $USER:$USER /mnt/test_2`
+ * test stuff, all should work
+* for **automatic mount** on boot systemd mount will be used,
+ typical mount unit file and automount file.
+ * get the uuid - `lsblk -f`
+ * `/etc/systemd/system/mnt-test_2.mount`
+ ```
+ [Unit]
+ Description=Truenas 6TB in stripe
+ After=iscsi.service
+ Requires=iscsi.service
+
+ [Mount]
+ What=/dev/disk/by-uuid/5a16cc72-b251-4eb9-9ea7-af2984df01b4
+ Where=/mnt/test_2
+ Type=ext4
+ Options=_netdev,noatime
+
+ [Install]
+ WantedBy=multi-user.target
+
+ ```
+ * `/etc/systemd/system/mnt-test_2.automount`
+ ```
+ [Unit]
+ Description=Truenas 6TB in stripe
+
+ [Automount]
+ Where=/mnt/test_2
+ # TimeoutIdleSec=3600 # Unmount after 1 hour idle
+
+ [Install]
+ WantedBy=multi-user.target
+ ```
+ * enable either mount or automount, depending on preference,
+ as explained at the top
+ `sudo systemctl enable --now mnt-test_2.mount`
+ `sudo systemctl enable --now mnt-test_2.automount`
+
+Of note is change of nodes location from /etc/iscsi to /var/lib/iscsi for nodes.
+
# Windows Client
### Samba - windows
@@ -142,3 +215,7 @@ information. Something like this:
* must be windows pro, not windows home
* add windows component in the control panel - `Services for NFS` - `Client for NFS`
* cmd, not powershell - `mount \\10.0.19.80\mnt\pool N:`
+
+### iSCSI - windows
+
+...