I'm trying to back up my entire system to an external disk using rsync, via a shell script which is run as root:
#!/bin/bash
rsync -vSHPhhaX --numeric-ids --delete --exclude-from=/home/rena/.scripts/exclude-list / /home/rena/video/.backup/>/home/rena/video/.backup.log
This script is running on the machine "akira". Originally, /home/rena/video was a USB hard disk attached directly to akira, and the script worked fine.
Recently I moved the disk; now it's mounted at the same path on another machine "yuki", and shared via NFS. So akira:/home/rena/video still refers to the same USB hard disk, only now it's attached to yuki and shared via nfs, instead of attached to akira directly. The disk is using ext3 and encrypted with Truecrypt.
yuki's /etc/exports is:
/home/rena akira(rw,subtree_check,nohide,no_root_squash) rei(rw,subtree_check,nohide,no_root_squash)
/home/rena/video akira(rw,subtree_check,nohide,no_root_squash) rei(rw,subtree_check,nohide,no_root_squash)
Now rsync gives an error for every file:
rsync: chown "/home/rena/video/.backup/boot/System.map-2.6.38-8-generic" failed: Invalid argument (22)
nfs seems to be "squashing" even though it's told not to?
rena@akira $ stat /home/rena/video/.backup/boot/abi-2.6.38-10-generic
File: `/home/rena/video/.backup/boot/abi-2.6.38-10-generic'
Size: 730457 Blocks: 1440 IO Block: 65536 regular file
Device: 19h/25d Inode: 38822526 Links: 1
Access: (0644/-rw-r--r--) Uid: (65534/ nobody) Gid: (65534/ nogroup)
Access: 2011-10-19 22:17:12.000000000 -0600
Modify: 2011-06-28 13:19:43.000000000 -0600
Change: 2011-10-19 22:17:12.000000000 -0600
rena@yuki $ stat /home/rena/video/.backup/boot/abi-2.6.38-10-generic
File: `/home/rena/video/.backup/boot/abi-2.6.38-10-generic'
Size: 730457 Blocks: 1440 IO Block: 4096 regular file
Device: fc04h/64516d Inode: 38822526 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2011-10-19 22:17:12.000000000 -0600
Modify: 2011-06-28 13:19:43.000000000 -0600
Change: 2011-10-19 22:17:12.000000000 -0600
from akira, the UID and GID appear different; maybe the reason for rsync failing?
[edit] In fact it looks like from akira, every file on the share has UID and GID 65534/nobody.
chown 22 test
succeeds on Yuki and the change is reflected by stat. I don't have a uid 22 on either system; I'm not sure where that number comes from.$ sudo find / -uid 22 -print
. EINVAL happens to be error code 22 though, so I'm guessing that's not a UID at all... I'm not sure how to use sshd debug mode with nfs?