<p>I have made a backup from my internal drive to a USB drive with rsync. My script look something like this:<br></p><p><font face="courier new,monospace">#!/bin/sh</font></p><p><font face="courier new,monospace">BACKUPDISK="/media/Backup"</font><font face="courier new,monospace"><br>
</font><font face="courier new,monospace">BACKUPFOLDER1="${BACKUPDISK}/PB1"</font><font face="courier new,monospace"><br></font><font face="courier new,monospace">BACKUPFOLDER2="${BACKUPDISK}/PB2"</font><font face="courier new,monospace"><br>
</font><font face="courier new,monospace"></font><font face="courier new,monospace"><br></font><font face="courier new,monospace">LOGFOLDER="${HOME}/Eget/.Backup/PB/Logg"</font><font face="courier new,monospace"><br>
</font><font face="courier new,monospace">LOGBACKUP="${LOGFOLDER}/Backup"</font><font face="courier new,monospace"><br></font><font face="courier new,monospace">LOGRESTORE="${LOGFOLDER}/Återställning"</font><font face="courier new,monospace"><br>
</font><font face="courier new,monospace">LOGPREPARE="${LOGFOLDER}/Förberedelse"</font><font face="courier new,monospace"><br></font><font face="courier new,monospace">LOGBACKUPFOLDER="${BACKUPFOLDER1}/guraknugen/Eget/.Backup/PB/Logg"</font><font face="courier new,monospace"><br>
</font><font face="courier new,monospace"><br></font><font face="courier new,monospace">EXCLUDELIST="${HOME}/Eget/.Backup/PB/Skript/Undantag/Excluded"</font><font face="courier new,monospace"><br></font><font face="courier new,monospace">EXCLUDE="--exclude-from ${EXCLUDELIST}"</font><font face="courier new,monospace"><br>
</font></p><p><font face="courier new,monospace"></font></p><p><font face="courier new,monospace"># Lot of commands for checking things and let the user select (with Xdialog) what kind of backup to run.</font><font face="courier new,monospace"><br>
<font face="courier new,monospace"></font></font></p><p><font face="courier new,monospace">rsync -auv ${EXCLUDE} "${HOME}" "${BACKUPFOLDER1}/" >> "${LOGBACKUP}"</font></p><p><font face="courier new,monospace"># Some more commands</font></p>
<p><font face="courier new,monospace"></font></p><p><font face="arial,helvetica,sans-serif">This works perfectly well.</font></p><p><font face="arial,helvetica,sans-serif">The same script is also supposed to be able to restore tha backup. The rsync command for that is:</font></p>
<p><font face="courier new,monospace">rsync -auv "${BACKUPFOLDER1}/${LOGNAME}/" "${HOME}/" >> "${LOGRESTORE}"</font></p><p><font face="arial,helvetica,sans-serif">As you can see, it's basically the same as the backup one, except we don't exclude anything.</font></p>
<p><font face="arial,helvetica,sans-serif"></font></p><p><font face="arial,helvetica,sans-serif">Now the problems start. When running the script from a console and then selecting Restore in a dialogue box, I get the following error message:</font></p>
<p><font face="courier new,monospace">$ ./Backup <br>rsync: chgrp "/home/guraknugen/Eget/Datorer/Operativsystem/Dokumentation/Tangentbordslayout Ubuntu 20080217.ods" failed: Operation not permitted (1)<br>rsync error: some files could not be transferred (code 23) at main.c(1058) [sender=3.0.3]<br>
$ </font></p><p><font face="arial,helvetica,sans-serif">The file mentioned is actually a soft link to a file with the same name. Its permissions are "</font><font face="courier new,monospace">rw-r--r--</font><font face="arial,helvetica,sans-serif">". I then noticed that all of my other links had permissions such as "</font><font face="courier new,monospace">rwxrwxrwx</font><font face="arial,helvetica,sans-serif">" or at least "</font><font face="courier new,monospace">rwxr-xr-x</font><font face="arial,helvetica,sans-serif">", so I thought that thre could be some kind of special thing about links or something, so I changed the permissions to </font><font face="arial,helvetica,sans-serif">"</font><font face="courier new,monospace">rwxr-xr-x</font><font face="arial,helvetica,sans-serif">" using Nautilus, but I still get the same error message. When I lok at the file again after the error message, I notice that the permissions are switched back to the same status as they were before I changed them! I try this several times, but each time rsync is run, the permissions are changed back!</font></p>
<p><font face="arial,helvetica,sans-serif">I have several other links to files and to folders, but rsync doesn't have any troubles with them, it's this particular link ONLY. I can't really see what's the difference between that link and all the others. Everything is the same. Permissions, owner, group, everything. However, this particular one is maybe the only link pointing to an ODF, but I'm not sure about that either,</font></p>
<p><font face="arial,helvetica,sans-serif">And why can I copy that link one direction but not the other?</font></p><p><font face="arial,helvetica,sans-serif">I can solve this problem by adding the following ahead of the rsync command:</font></p>
<p><font face="courier new,monospace">gksudo -user $LOGNAME</font></p><p><font face="arial,helvetica,sans-serif">However, I think this is an ugly solution and I also need to enter my password, which shouldn't be necessary for copying my own files wherever I want them in my very own system.</font></p>
<p><font face="arial,helvetica,sans-serif">I can't really see why this doesn't work for that particular link. It shouldn't shouldn't it?</font></p><p><font face="arial,helvetica,sans-serif">Thanks</font></p>
<p><font face="arial,helvetica,sans-serif"></font></p><p><font face="arial,helvetica,sans-serif">Johnny Rosenberg</font></p>