Rclone: Difference between revisions

From NixOS Wiki
Onny (talk | contribs)
Add example configuration, SFTP mount
Onny (talk | contribs)
Note on Sshfs
Line 23: Line 23:
   ];
   ];
};
};
</syntaxhighlight>
</syntaxhighlight>This can be also done with [[SSHFS]] while Rclone seems to be more robust for unstable connections.
[[Category:Applications]]
[[Category:Applications]]
[[Category:Backup]]
[[Category:Backup]]

Revision as of 21:35, 4 July 2024

Rclone is a command-line program that synchronizes files and directories between different cloud storage services, including Google Drive, Amazon S3, Microsoft OneDrive, Dropbox, and more. With its flexible configuration options and robust feature set, Rclone provides a powerful tool for managing and accessing data stored in the cloud.

Configuration

Mounting remote filesystem, in this example via SFTP. The remote profile is called myremote, and authentication is done with user myuser and key file /root/.ssh/id_rsa against 192.0.2.2. The remote directory /my_data is than mounted to the local directory /mnt.

environment.systemPackages = [ pkgs.rclone ];
environment.etc."rclone-mnt.conf".text = ''
  [myremote]
  type = sftp
  host = 192.0.2.2
  user = myuser
  key_file = /root/.ssh/id_rsa
'';

fileSystems."/mnt" = {
  device = "myremote:/my_data";
  fsType = "rclone";
  options = [
    "nodev"
    "nofail"
    "allow_other"
    "args2env"
    "config=/etc/rclone-mnt.conf"
  ];
};

This can be also done with SSHFS while Rclone seems to be more robust for unstable connections.