Move fails to mounted gdrive but moveto works

rclone move fails when going from a local Linux directory to a mounted gdrive cached remote. It attempts a server-side rename and fails with invalid cross-device link. This makes sense as it’s not really a local to local move. What has me scratching my head is that the “moveto” command has the same error but will fallback to a copy and then delete the source files. rclone move just fails, period. I would think the expected behavior here should be the same unless I am doing something wrong.

WhenI tried it it worked for both move and moveto - what are you doing differently?

/tmp$ tree test
test
└── hello.txt

0 directories, 1 file
/tmp$ rclone -vv move /tmp/test/ /dev/shm/
2018/02/25 09:58:24 DEBUG : Using config file from "/home/ncw/.rclone.conf"
2018/02/25 09:58:24 DEBUG : rclone: Version "v1.39-175-g749fb01c-vfs-update" starting with parameters ["rclone" "-vv" "move" "/tmp/test/" "/dev/shm/"]
2018/02/25 09:58:24 INFO  : Local file system at /dev/shm: Modify window is 1ns
2018/02/25 09:58:24 DEBUG : Local file system at /dev/shm: Using server side directory move
2018/02/25 09:58:24 INFO  : Local file system at /dev/shm: Server side directory move failed - fallback to file moves: can't copy directory - destination already exists
2018/02/25 09:58:24 ERROR : hello.txt: Can't move: rename /tmp/test/hello.txt /dev/shm/hello.txt: invalid cross-device link: trying copy
2018/02/25 09:58:24 DEBUG : hello.txt: Can't move, switching to copy
2018/02/25 09:58:24 INFO  : Local file system at /dev/shm: Waiting for checks to finish
2018/02/25 09:58:24 INFO  : Local file system at /dev/shm: Waiting for transfers to finish
2018/02/25 09:58:24 INFO  : hello.txt: Copied (new)
2018/02/25 09:58:24 INFO  : hello.txt: Deleted
2018/02/25 09:58:24 INFO  : 
Transferred:      6 Bytes (569 Bytes/s)
Errors:                 0
Checks:                 1
Transferred:            1
Elapsed time:          0s

2018/02/25 09:58:24 DEBUG : Go routines at exit 3
2018/02/25 09:58:24 DEBUG : rclone: Version "v1.39-175-g749fb01c-vfs-update" finishing with parameters ["rclone" "-vv" "move" "/tmp/test/" "/dev/shm/"]
/tmp$
/tmp$ mv /dev/shm/hello.txt test/
/tmp$ 
/tmp$ rclone -vv moveto /tmp/test/hello.txt /dev/shm/hello.txt
2018/02/25 09:59:20 DEBUG : Using config file from "/home/ncw/.rclone.conf"
2018/02/25 09:59:20 DEBUG : rclone: Version "v1.39-175-g749fb01c-vfs-update" starting with parameters ["rclone" "-vv" "moveto" "/tmp/test/hello.txt" "/dev/shm/hello.txt"]
2018/02/25 09:59:20 INFO  : Local file system at /dev/shm: Modify window is 1ns
2018/02/25 09:59:20 DEBUG : hello.txt: Couldn't find file - need to transfer
2018/02/25 09:59:20 ERROR : hello.txt: Can't move: rename /tmp/test/hello.txt /dev/shm/hello.txt: invalid cross-device link: trying copy
2018/02/25 09:59:20 DEBUG : hello.txt: Can't move, switching to copy
2018/02/25 09:59:20 INFO  : hello.txt: Copied (new)
2018/02/25 09:59:20 INFO  : hello.txt: Deleted
2018/02/25 09:59:20 INFO  : 
Transferred:      6 Bytes (743 Bytes/s)
Errors:                 0
Checks:                 1
Transferred:            1
Elapsed time:          0s

2018/02/25 09:59:20 DEBUG : Go routines at exit 3
2018/02/25 09:59:20 DEBUG : rclone: Version "v1.39-175-g749fb01c-vfs-update" finishing with parameters ["rclone" "-vv" "moveto" "/tmp/test/hello.txt" "/dev/shm/hello.txt"]
/tmp$
/tmp$ mv /dev/shm/hello.txt test/
/tmp$ 
/tmp$ rclone -vv move /tmp/test/hello.txt /dev/shm/
2018/02/25 09:59:36 DEBUG : Using config file from "/home/ncw/.rclone.conf"
2018/02/25 09:59:36 DEBUG : rclone: Version "v1.39-175-g749fb01c-vfs-update" starting with parameters ["rclone" "-vv" "move" "/tmp/test/hello.txt" "/dev/shm/"]
2018/02/25 09:59:36 INFO  : Local file system at /dev/shm: Modify window is 1ns
2018/02/25 09:59:36 INFO  : Local file system at /dev/shm: Waiting for checks to finish
2018/02/25 09:59:36 ERROR : hello.txt: Can't move: rename /tmp/test/hello.txt /dev/shm/hello.txt: invalid cross-device link: trying copy
2018/02/25 09:59:36 DEBUG : hello.txt: Can't move, switching to copy
2018/02/25 09:59:36 INFO  : Local file system at /dev/shm: Waiting for transfers to finish
2018/02/25 09:59:36 INFO  : hello.txt: Copied (new)
2018/02/25 09:59:36 INFO  : hello.txt: Deleted
2018/02/25 09:59:36 INFO  : 
Transferred:      6 Bytes (760 Bytes/s)
Errors:                 0
Checks:                 1
Transferred:            1
Elapsed time:          0s

2018/02/25 09:59:36 DEBUG : Go routines at exit 3
2018/02/25 09:59:36 DEBUG : rclone: Version "v1.39-175-g749fb01c-vfs-update" finishing with parameters ["rclone" "-vv" "move" "/tmp/test/hello.txt" "/dev/shm/"]

I don’t think I’m doing anything differently. I have intentionally kept the command simplistic while troubleshooting. Here is my output:

mm@vps-01:~$ mkdir ‘test folder’
mm@vps-01:~$ touch ‘test folder/test file’
mm@vps-01:~$ touch ‘test folder/test file 2’
mm@vps-01:~$ touch ‘test folder/test file 3’
mm@vps-01:~$ tree ‘test folder’/
test folder/
└── test file
└── test file 2
└── test file 3
0 directories, 3 files
mm@vps-01:~$ rclone move ‘./test folder’ ‘/mnt/gdrive_media/test folder/’ -vv
2018/02/25 09:09:41 DEBUG : Using config file from “/home/mm/.config/rclone/rclone.conf”
2018/02/25 09:09:41 DEBUG : rclone: Version “v1.39” starting with parameters [“rclone” “move” “./test folder” “/mnt/gdrive_media/test folder/” “-vv”]
2018/02/25 09:09:41 INFO : Local file system at /mnt/gdrive_media/test folder: Modify window is 1ns
2018/02/25 09:09:41 DEBUG : Local file system at /mnt/gdrive_media/test folder: Using server side directory move
2018/02/25 09:09:41 ERROR : Local file system at /mnt/gdrive_media/test folder: Server side directory move failed: rename /home/mm/test folder /mnt/gdrive_media/test folder: invalid cross-device link
2018/02/25 09:09:41 ERROR : Attempt 1/3 failed with 1 errors and: rename /home/mm/test folder /mnt/gdrive_media/test folder: invalid cross-device link
2018/02/25 09:09:41 DEBUG : Local file system at /mnt/gdrive_media/test folder: Using server side directory move
2018/02/25 09:09:41 ERROR : Local file system at /mnt/gdrive_media/test folder: Server side directory move failed: rename /home/mm/test folder /mnt/gdrive_media/test folder: invalid cross-device link
2018/02/25 09:09:41 ERROR : Attempt 2/3 failed with 1 errors and: rename /home/mm/test folder /mnt/gdrive_media/test folder: invalid cross-device link
2018/02/25 09:09:41 DEBUG : Local file system at /mnt/gdrive_media/test folder: Using server side directory move
2018/02/25 09:09:41 ERROR : Local file system at /mnt/gdrive_media/test folder: Server side directory move failed: rename /home/mm/test folder /mnt/gdrive_media/test folder: invalid cross-device link
2018/02/25 09:09:41 ERROR : Attempt 3/3 failed with 1 errors and: rename /home/mm/test folder /mnt/gdrive_media/test folder: invalid cross-device link
2018/02/25 09:09:41 Failed to move: rename /home/mm/test folder /mnt/gdrive_media/test folder: invalid cross-device link

Some more info:
Ubuntu 16.04
rclone 1.39
rclone mount gdrive_cache: /mnt/gdrive_media --allow-other --cache-info-age=1h

mv works. rclone moveto works for individual files. The latter fails with the same cross-device link error and then success with a copy then delete.

I see what the difference is now… The move fails because the destination directory doesn’t exist… If you create it first the move will succeed.

This is because if the directory doesn’t exist then rclone is trying to move the whole directory…

I’ve added a fix for this here:

https://pub.rclone.org/v1.39-176-g724120d2-fix-local-dirmoveβ/

Let me know what you think!

It works as expected now. Thank you very much. I prefer using rclone when moving files to my mounted gdrive due to features such as --bwlimit. Thank you again.

Thanks for testing! I’ll merge to master shortly…

On a sort of related note is the plan to still downgrade the invalid cross-device link messages to debug status? I’m using the beta and still getting them. I read something about that here:

Hmm, yes… Fancy sending a PR?

If only I was a software engineer :slight_smile:

Unfortunately, I’m more of a network admin than any kind of programmer. Maybe I will try to figure it out for this.

Well it was really only the work of a couple of minutes so I’ve done it!

Here is the beta with it in

https://beta.rclone.org/v1.39-190-gfdebf9da/ (uploaded in 15-30 mins)

Thanks once again! It was so simple:

1 Like