LucidLink manual Linux systemd service

  • Updated

Overview

How to create and enable a LucidLink systemd service to survive a system reboot, re-activate and automatically mount a filespace at a preferred mountpoint.

Alternatively, we have a purpose-built script for managing filespace systemd services available in this KB article which will assist the more general implementations. 

In this article, we will break down certain elements and provide guidance on how to achieve advanced configuration changes to your instance once connected and linked to your filespace.

Requirements

An appropriately privileged user to install LucidLink and perform systemd systemctl operations. The root user, a member of the sudo group, or the sudoers file modified accordingly for your user or group.

Installing the LucidLink client

It is recommended that your distribution is fully updated prior to installing LucidLink.

Debian based (.deb):

wget https://www.lucidlink.com/download/new-ll-latest/linux-deb/stable/ -O lucidinstaller.deb
sudo apt install ./lucidinstaller.deb -y

Red Hat based (.rpm):

wget https://www.lucidlink.com/download/new-ll-latest/linux-rpm/stable/ -O lucidinstaller.rpm
sudo dnf install lucidinstaller.rpm
Create the lucidlink.service within /etc/systemd/system
 
sudo nano /etc/systemd/system/lucidlink.service
[Unit]
Description=LucidLink filespace Daemon
After=network-online.target
[Service]
Type=simple
#User=<user>
#Group=<group>
#WorkingDirectory=/home/<user>
ExecStart=/usr/local/bin/lucid daemon --fs <filespace.domain> --user <fsuser> --password <fsusrpwd> --mount-point <mount>
ExecStop=/usr/local/bin/lucid exit
Restart=on-abort
[Install]
WantedBy=multi-user.target

Passwords with special characters will require single ' ' or double " " quoting, or sufficient escaping, depending on the special characters or consult our KB which leverages systemd-escape.

Modify the command-line arguments accordingly
lucid daemon --fs filespace.domain --user user1 --password password1 --mount-point /media/filespace

You can create multiple systemd unit files to start multiple instances, either the same filespace, different filespaces, or perhaps snapshots. Using the option --instance within the daemon sub-command on both the ExecStart and ExecStop lines. If you do not specify this then the instance number will default to 0 and 2 daemons cannot use the same instance number simultaneously on the same system.

Also consider including the --root-path </cache/location> option if you want to specify the data, and metadata, cache location.

Uncomment and modify the systemd unit file's User, Group and WorkDirectory variables should you choose to run the service as a different Linux user. The default is root when no user or group is specified.
If you require a Linux User, other than the one specified in the systemd unit file, to access the mountpoint you should consider the --fuse-allow-other option, see below for more information.

Reload systemd unit files (to pick up modifications to the unit files):

systemctl daemon-reload

Start the LucidLink daemon systemd service:

systemctl start lucidlink.service

Check the LucidLink systemd service:

systemctl status lucidlink.service 

If you have a systemd error or the filespace did not mount, or if you make changes to the systemd service, you will need to reload the systemd daemon systemctl daemon-reload.

If there are no errors in the systemd service check that the filespace mount-point exists.

ls /media/<mount>

Review the systemd service history:

journalctl -u lucidlink.service

Enable the LucidLink systemd service:

systemctl enable lucidlink.service

 

Optionally if you would like to run your systemd service as a different user other than root, you can uncomment and specify the appropriate systemd unit User, Group and WorkingDirectory.

You can then provide the daemon with the --fuse-allow-other option, to enable other users on the same Linux machine to access the mount-point. 

Note: Filesystem in Userspace (FUSE) allow_other is separate to user permissions. The user running the daemon controls their permissions, other users on the Linux system must have appropriate permissions.

Edit fuse.conf and uncomment (remove #) if you'd like the mount-point to be accessible to other users.

sudo nano /etc/fuse.conf
user_allow_other
Alternatively, run sed -i 's/#user_allow_other/user_allow_other/g' /etc/fuse.conf
[Unit]
Description=LucidLink filespace Daemon
After=network-online.target
[Service]
Type=simple
User=<user>
Group=<group>
WorkingDirectory=/home/<user>
ExecStart=/usr/local/bin/lucid daemon --fs <filespace.domain> --user <fsuser> --password <fsusrpwd> --mount-point <mount> --fuse-allow-other
ExecStop=/usr/local/bin/lucid exit
Restart=on-abort
[Install]
WantedBy=multi-user.target

If you are seeing timeouts due to slow network initialisation in a virtual environment, try adding the following extra line after WorkingDirectory ExecStartPre=/bin/sleep 30 to inject a sleep before ExecStart.

 
Advanced post operations such as increasing the client cache and or configuring the object storage maximum upload and download rates can be achieved with ExecStartPost systemd unit option.
Multiple ExecStartPost command lines are allowed and the commands are executed one after the other, serially.
 
[Unit]
Description=LucidLink filespace Daemon
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/bin/lucid daemon --fs <filespace.domain> --user <fsuser> --password <fsusrpwd> --mount-point <mount>
ExecStop=/usr/local/bin/lucid exit
ExecStartPost=/bin/bash -c "until lucid status | grep -q "Linked" ; do continue ; done"
ExecStartPost=/usr/local/bin/lucid config --set --local --DataCache.Size 25GB
ExecStartPost=/usr/local/bin/lucid config --set --local --ObjectScheduler.MaxUploadRate 10MB
ExecStartPost=/usr/local/bin/lucid config --set --local --ObjectScheduler.MaxDownloadRate 10MB
Restart=on-abort
[Install]
WantedBy=multi-user.target
Make sure the lucid daemon is successfully connected (linked to the filespace and or mounted) before applying any additional commands in your ExecStartPost steps. Otherwise, these steps might fail and trigger the ExecStop command. 
In our example we've included a lucid status until loop to ensure the client status is "Linked" before continuing.

As always, please reach out to our support should you require any additional information or assistance with advanced configuration.

Was this article helpful?

0 out of 0 found this helpful