Error while trying to mount GCP bucker to ProxMox Backup Server with rclone

What is the problem you are having with rclone?

I created a google cloud storage remote type as you can see bellow:
Name Type
==== ====
GCPbucket google cloud storage

when I try to mount a gcp bucket to PBS with the bellow command
rclone mount GCPbucket:project_id/my-bucket/TestOnly /mnt/GcpInfraStorage/

it looks like it worked. however when I go to PBS /GUI to create a datastore using local mount point as a backing up path which is pointed to the GCP bucket, I get the bellow error.
Bad Request (400)
unable to open chunk store 'GCPBucket' at "/mnt/GcpInfraStorage/.chunks" - No such file or directory (os error 2)

Could you please help me on that?

Kind regards,

hello and welcome to the forum

--- does rclone lsd GCPbucket: work?
---try adding --allow-other

and if that does not help, then when you posted there was a template of questions for you to answer.

@asdffdsa thanks for the welcoming and your help too :slight_smile:

Yes, it works. here is the output of lsd and lsf

root@dw-pbs001:/mnt# rclone lsd GCPbucket:my-bucket/TestOnly
root@dw-pbs001:/mnt# rclone lsf GCPbucket:my-bucket/TestOnly
testrclone.txt
root@dw-pbs001:/mnt#

I did not get your point here, what do you mean by:
---try adding --allow-other

the remote in the mount command does not match the remote in the rclone lsd/lsf example?
GCPbucket:project_id/my-bucket/TestOnly versus GCPbucket:my-bucket/TestOnly

add --allow-other to the mount command

Let me add that, sorry infact they are matched is just I had tried with and without project_id that I just copy paste the wrong one here sorry about that :frowning: otherwise they exactly the same I can confirm that.

@asdffdsa using --allow-other worked I don't have the same error I can even say it created the datastore successfully

Now I have this error within the terminal!

2022/07/26 16:00:35 ERROR : .lock: WriteFileHandle: Can't open for write without O_TRUNC on existing file without --vfs-cache-mode >= writes

Do you have an idea about that?

I really appreciate your help :slight_smile:

if you plan to write/edit files in the mount, need to add
--vfs-cache-mode=writes
or
--vfs-cache-mode=full

I am planning to it as a secondary backup storage.

--vfs-cache-mode=writes "Is this command adds only writing permission?"
--vfs-cache-mode=full "Is this command adds both read/writing permissions?"

both vfs cache modes allow for reading and writing but in different ways.
it depends on the backup program that is accessing the mount.

https://rclone.org/commands/rclone_mount/#vfs-file-caching

1 Like

@asdffdsa thanks a lot

Ok that's great all looks good.

I felt one thing when I close the terminal I think it unmounts, please correct me if I am wrong.

Is it possible to add the mount command to fstab or crontab? or is there a way to automate that?

yes, that is discussed at the rclone mount documentation.

1 Like

Hello @asdffdsa,

I am trying to understand how to add the mount command to fstabl or corntab but I really don't know where to start, could you please help me?

Rclone as Unix mount helper

The core Unix program /bin/mount normally takes the -t FSTYPE argument then runs the /sbin/mount.FSTYPE helper program passing it mount options as -o key=val,... or --opt=.... Automount (classic or systemd) behaves in a similar way.

rclone by default expects GNU-style flags --key val. To run it as a mount helper you should symlink rclone binary to /sbin/mount.rclone and optionally /usr/bin/rclonefs, e.g. ln -s /usr/bin/rclone /sbin/mount.rclone. rclone will detect it and translate command-line arguments appropriately.

Now you can run classic mounts like this:

mount sftp1:subdir /mnt/data -t rclone -o vfs_cache_mode=writes,sftp_key_file=/path/to/pem

or create systemd mount units:

# /etc/systemd/system/mnt-data.mount
[Unit]
After=network-online.target
[Mount]
Type=rclone
What=sftp1:subdir
Where=/mnt/data
Options=rw,allow_other,args2env,vfs-cache-mode=writes,config=/etc/rclone.conf,cache-dir=/var/rclone

optionally accompanied by systemd automount unit

# /etc/systemd/system/mnt-data.automount
[Unit]
After=network-online.target
Before=remote-fs.target
[Automount]
Where=/mnt/data
TimeoutIdleSec=600
[Install]
WantedBy=multi-user.target

or add in /etc/fstab a line like

sftp1:subdir /mnt/data rclone rw,noauto,nofail,_netdev,x-systemd.automount,args2env,vfs_cache_mode=writes,config=/etc/rclone.conf,cache_dir=/var/cache/rclone 0 0

@asdffdsa I just realized that when I create/backup something into the mount point nothing is appearing at the gcp level, do you know why?

See my mounted points:
root@dw-pbs001:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 393M 716K 392M 1% /run
/dev/mapper/pbs-root 82G 11G 67G 14% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
10.10.0.23:/volume1/PBS-Backups 11T 5.8T 4.8T 55% /mnt/PBS-Backups
tmpfs 393M 20K 393M 1% /run/user/0
GCPbucket:project_id/my-bucket/PBSBackups 1.0P 0 1.0P 0% /mnt/GCPBucket

See what I have created or backedup into the mount point:

root@dw-pbs001:~# ls -l /mnt/GCPBucket/
total 1
drwxr-xr-x 1 root root 0 Jul 27 12:48 Test
-rw-r--r-- 1 root root 5 Jul 27 10:31 test.tex
drwxr-xr-x 1 root root 0 Jul 27 12:48 vm
root@dw-pbs001:~#

But I can't see nothin within the buck at GCP level? see screeenshot bellow

FYI this is done, it mounts automatically when the server restarts.

I got this error when I try to backup my VMs?
2022/07/27 15:54:41 ERROR : .chunks/5bf4/5bf4490306a6f46befefcf4b2342c3f64457a11e2071f51caa5bbefba0efc6d6: Failed to copy: googleapi: Error 400: Cannot insert legacy ACL for an object when uniform bucket-level access is enabled. Read more at Uniform bucket-level access  |  Cloud Storage  |  Google Cloud,

have you read https://rclone.org/googlecloudstorage/#gcs-bucket-policy-only

and please post the redacted rclone config file

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.