Hi,
I want to create a directory which is read-only but on a filesystem which is mounted as read-write, without using chmod. Does anyone have any ideas how to do this?
If you'd like more details about why this is needed, please see below:
I'm trying to create a rsync backup system similar to
Mike Rubels, but while he requires the backup-server to mount the client machines directory to do the backup, I want it the other way around: the client machine mounts the backup servers directory and so it is the client that does the backup (when the user logs off from their machine).
But this setup means that the backup data on the server is writable by the client (it must be to make the backup in the first place), so I thought about using a nightly cronjob on the backup-server to move the backup to a read-only location. Then ideally the client machine would run rsync as:
rsync -a --delete --link-dest=/nfs_mount/backup_server/ro/backup.1/ /home/mark /nfs_mount/backup_server/backup.0/
The intent here is that the client compares files in the local /home/mark directory to those in a read-only directory /nfs_mount/backup_server/ro/backup.1, and if they are the same, makes hard-links under the writable directory /nfs_mount/backup_server/backup.0/home/mark/... to the read-only version of the file in backup.1, but for any files which are different, it will create a new file in the backup.0 location instead.
In order to create hard links to a file, the source file and the dest file must be on the same filesystem - so I can't use NFS readonly loopback mounting, or the rofs FUSE module etc... to store the read-only backup, as then I can't symlink to it from the writeable backup.0 directory. And I can't use chmod to remove write permissions from the files in backup.1 as if the files have different permissions, rsync will think the files are different and will copy all the files from /home/mark to backup.0, instead of using hard links from backup.0 to backup.1.
If anyone has any ideas how to solve this, I'd be keen to hear about them!
Cheers,
Mark