Edit file error on ESXI NFS datastore which is rclone mounted from linux

What is the problem you are having with rclone?
I use rclone mount to mount google drive to VM local and set the systemd

vim /etc/systemd/system/rclone.service
[Unit]
Description=Rclone Service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/root/.config/rclone/rclone.conf
KillMode=none
RestartSec=5
ExecStart= /usr/bin/rclone mount idrive: /idrive
--allow-other
--rc
--rc-addr :5572
--rc-no-auth
--log-level INFO
--poll-interval 10s
--umask 0
--allow-non-empty
--vfs-cache-mode full
--buffer-size 64M
--write-back-cache
--vfs-write-back 10s
--vfs-cache-max-age 300s
--vfs-cache-max-size 5000M
--vfs-cache-poll-interval 60s
--dir-cache-time 12h
--vfs-read-chunk-size 128M
--vfs-read-chunk-size-limit off
--cache-dir /tmp \

ExecStop=/bin/fusermount -uz /idrive
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 127.0.0.1:5572 _async=true
Restart=on-failure
User=root
Group=root

[Install]
WantedBy=default.target

and type below command

systemctl enable rclone.service
systemctl start rclone.service

mount successfully(vm redhat & NFS server)
idrive: on /idrive type fuse.rclone (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)

I use NFS to mount a google drive to ESXI host(as a NFS client) from VM
esxcli storage nfs add -H xxx.xxx.xxx.xxx -s /idrive -v NFS

df -h (on ESXI host)
Filesystem Size Used Available Use% Mounted on
NFS 15.0G 20.0K 15.0G 0% /vmfs/volumes/NFS
...
...

however,
i try to add some content to the file which mount on the NFS datastore, but it cant be edit and show the gibberish.

vi /vmfs/volumes/NFS/zxc

5465
aasssdfe
"123456"
sdjakfhujh

there "" is added to the file
and than save :x

again vi zxc
show the gibberish

5465
aasssdfe

sdjakfhujh
^@^@^@^@^@^@^@^@

and i use the command to see the error log
cat /var/log/vmkernel.log | grep error | tail -n 5

2023-01-29T06:17:38.047Z cpu22:2106834)BC: 414: write to zxc (b00f 28 27dcf561 3069029f 81010001 1 0 8 c 0 0 0 0 0) 22 bytes failed: I/O error
2023-01-29T06:30:33.366Z cpu2:2106881)BC: 414: write to zxc (b00f 28 27dcf561 3069029f 81010001 1 0 8 c 0 0 0 0 0) 29 bytes failed: I/O error
2023-01-29T06:30:33.367Z cpu2:2106881)BC: 414: write to zxc (b00f 28 27dcf561 3069029f 81010001 1 0 8 c 0 0 0 0 0) 29 bytes failed: I/O error
2023-01-29T06:35:54.779Z cpu43:2106911)BC: 414: write to zxc (b00f 28 27dcf561 3069029f 81010001 1 0 8 12 0 0 0 0 0) 33 bytes failed: I/O error
2023-01-29T06:35:54.780Z cpu43:2106911)BC: 414: write to zxc (b00f 28 27dcf561 3069029f 81010001 1 0 8 12 0 0 0 0 0) 33 bytes failed: I/O error

and i verify another server NFS clinet(redhat) and mount /idrive to it.
it works to add the content and show what i edit correctly

i dont which part did wrong.

rclone version on VM
rclone v1.61.1

  • os/version: redhat 8.6 (64 bit)
  • os/kernel: 4.18.0-372.9.1.el8.x86_64 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.19.4
  • go/linking: static
  • go/tags: none

Change that to DEBUG

add in --log-file /some/directory/you/want/rclone.log

Share the rclone debug log.

That generally means you unmounted the rclone mount cleanly in some situations.

Are you exporting the rclone mount via NFS or something?

i edit the export file on VM
cat /etc/exports
/idrive *(rw,sync,fsid=1,no_root_squash,no_all_squash)

and exportfs -var

i follow what you said to change the systemd

--log-level DEBUG
--log-file /tmp/rclone.log \

but it still goes wrong with gibberish(^@^@^@^@^@^@^@^@)

you can refer to the attachment /tmp/rclone.log for more detail

rclone.log (29.4 KB)

In your log rclone is returning bad file descriptor errors

2023/01/29 21:56:59 DEBUG : zxc(0xc000510d80): >_readAt: n=0, err=Bad file descriptor
2023/01/29 21:56:59 DEBUG : &{zxc (rw)}: >Read: read=0, err=bad file descriptor
2023/01/29 21:56:59 DEBUG : zxc(0xc000511140): >_readAt: n=0, err=Bad file descriptor
2023/01/29 21:56:59 DEBUG : &{zxc (rw)}: >Read: read=0, err=bad file descriptor
2023/01/29 21:57:00 DEBUG : zxc(0xc000511600): >_readAt: n=0, err=Bad file descriptor
2023/01/29 21:57:00 DEBUG : &{zxc (rw)}: >Read: read=0, err=bad file descriptor

This is apparently because the file was opened write only, but the application read from it

2023/01/29 21:56:59 DEBUG : zxc: Open: flags=OpenWriteOnly
2023/01/29 21:56:59 DEBUG : zxc: Open: flags=O_WRONLY
2023/01/29 21:56:59 DEBUG : zxc: newRWFileHandle: 
2023/01/29 21:56:59 DEBUG : zxc: >newRWFileHandle: err=<nil>
2023/01/29 21:56:59 DEBUG : zxc: >Open: fd=zxc (rw), err=<nil>
2023/01/29 21:56:59 DEBUG : zxc: >Open: fh=&{zxc (rw)}, err=<nil>
2023/01/29 21:56:59 DEBUG : &{zxc (rw)}: Read: len=4096, offset=0
2023/01/29 21:56:59 DEBUG : zxc(0xc000510d80): _readAt: size=4096, off=0
2023/01/29 21:56:59 DEBUG : zxc(0xc000510d80): >_readAt: n=0, err=Bad file descriptor
2023/01/29 21:56:59 DEBUG : &{zxc (rw)}: >Read: read=0, err=bad file descriptor

So this looks like a bug in the app not rclone.

I verify to build a general folder which is not mounted and export the folder to ESXI host.
it works find to add the content to the file in that folder.

so i'm not sure which port goes wrong.

I think this is something to do with NFS.

Can you export with a different protocol? SMB maybe?

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