Use volume name/label (rather than volume letter) in rclone config

What is the problem you are having with rclone?

I Need to use volume name/label (rather than volume letter) in rclone config.
The reason is that I backup routinely from a USB flash drive and whenever it's connected to the computer, while the volume name/label remains the same, the volume letter oftentimes changes.

Example that currently works (but problematic because I need to update the volume letter in the config every time before backup):

[remote_01]
type = alias
remote = F:\sync

Example of what I need to achieve:

[remote_01]
type = alias
remote = LABEL_01:\sync

Run the command 'rclone version' and share the full output of the command.

rclone v1.66.0
- os/version: Microsoft Windows 10 Pro 22H2 (64 bit)
- os/kernel: 10.0.19045.4170 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.22.1
- go/linking: static
- go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync remote_01: remote_02:

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[remote_01]
type = alias
remote = F:\sync

[remote_02]
type = alias
remote = C:\test

A log from the command that you were trying to run with the -vv flag

2024/09/28 12:26:22 DEBUG : rclone: Version "v1.66.0" starting with parameters ["rclone" "sync" "remote_01:" "remote_02:" "-vv"]
2024/09/28 12:26:22 DEBUG : Creating backend with remote "remote_01:"
2024/09/28 12:26:22 DEBUG : Using config file from "C:\\Users\\zac\\AppData\\Roaming\\rclone\\rclone.conf"
2024/09/28 12:26:22 DEBUG : Creating backend with remote "LABEL_01:/sync"
2024/09/28 12:26:22 Failed to create file system for "remote_01:": didn't find section in config file

Hi.

Are you able to use this "trick"?

Using the same prefix \\?\ it is also possible to specify path to volumes identified by their GUID, e.g. \\?\Volume{b75e2c83-0000-0000-0000-602f00000000}\some\path .

From Local Filesystem (rclone.org).

Run mountvol in command prompt to see what the specific path in your case is.

1 Like

Thanks, that works and it's definitely a partial solution.

Now the issue is that the GUID is not persistent between different machines (the USB flash drive gets different GUIDs in different machines).

My usage of rclone is mainly from within VMs (which are essentially different machines) so now it still requires to update the config whenever moving to new VM.

I wonder if there's still some way to achieve it with volume name/label?

here are two ways. in both cases, no config file is used.

  1. create the remote on-the-fly using environment variables.
# get drive letter
$drive=(Get-Volume -FileSystemLabel "LABEL_01").DriveLetter

# on-the-fly remote
$env:RCLONE_CONFIG_REMOTE01_TYPE="alias"
$env:RCLONE_CONFIG_REMOTE01_REMOTE=$drive + ":\sync"

rclone ls remote01:
  1. given the path is local, no need for remote. use connection string
# get drive letter
$drive=(get-volume -filesystemlabel "label_01").driveletter

rclone ls ""$drive":\sync"
1 Like

Thanks, that's a plausible approach though it would require to "hard code" the volume label in the script file.

Would you say rclone doesn't support specifying the volume label in the config file?

If not -- maybe a feature worth having? (for example GoodSync which I also use takes the volume label rather than the volume letter by default)

pass the label on the command line. no need to modify the script file.

param([string]$label); $drive=(Get-Volume -FileSystemLabel $label).DriveLetter

yes

maybe.
as i have shown, just a single line of powershell is needed to find the drive letter based on label.
no need to create remote, no need to update config file, no need to modify the script file.

1 Like