Total Pageviews

Sunday, 29 December 2024

Automount Rclone on Linux


Step-by-Step Guide to automount rclone on linux

Automatically Mounting rclone Remote Directory on Debian 11 (pikpak)

To automatically mount the remote directory using rclone on system restart in Debian 11, you can create a systemd service unit. Here’s how you can do it:

Create a systemd service unit file: Open a terminal and create a new service unit file using your favorite text editor. For example:

sudo nano /etc/systemd/system/rclone-mount.service

Add the following content to the file:


Replace <YOUR_USERNAME> with your actual username.


Save and close the file: In Nano, you can do this by pressing Ctrl + O to write the file, then Enter, and finally Ctrl + X to exit.


Reload systemd: After saving the service unit file, reload the systemd daemon to ensure it recognizes the new service:


sudo systemctl daemon-reload

Enable the service: You need to enable the service so it starts automatically on system boot:


sudo systemctl enable rclone-mount.service

Start the service: You can manually start the service now:


sudo systemctl start rclone-mount.service

Now, your remote directory should be mounted automatically on system startup. 🚀


Remember to replace pikpak: and /mnt/data/media/pikpak with your actual rclone remote and local mount path. Also, make sure rclone is installed in /usr/bin/rclone or specify the correct path in the ExecStart directive.


Note: If your rclone binary is installed in a different location, you’ll need to specify the correct path in the ExecStart directive of the systemd service unit file.


To find out where rclone is installed on your system, you can use the which command:


which rclone

After making this change, save the file, reload systemd, and restart the service as described in the previous instructions.


Disabling Automatic Mounting

If you no longer want the remote directory to be automatically mounted on system startup, you can remove the systemd service unit that you created earlier. Here’s how you can do it:


Disable the service: First, you should disable the systemd service to prevent it from starting automatically on system boot:


sudo systemctl disable rclone-mount.service

Stop the service: Next, stop the running instance of the service:


sudo systemctl stop rclone-mount.service

Remove the service file: Finally, you can remove the systemd service unit file that you created:


sudo rm /etc/systemd/system/rclone-mount.service

After completing these steps, the automatic mounting of the remote directory should be disabled, and the systemd service unit file will be removed from your system. 

No comments:

Post a Comment