Recover from a failed rename operation ?

Rob Siemborski rjs3 at andrew.cmu.edu
Wed Apr 30 13:53:46 EDT 2003


On Wed, 30 Apr 2003, Christian Schulte wrote:

> I just added a new partition to my cyrus-installation and tested to
> rename a users' INBOX to move it to that new partition. Here I made a
> mistake. The file-permissions of the new partition were incorrect so
> that cyrus was not able to move the INBOX to the new partition because
> of "permission denied". While cyrus trying to create
> /newpartition/domain directory I got permission denied error. What now
> happened is that the INBOX has gone completely also on the old
> partition. Even running ctl_cyrusdb -r "that INBOX" did not bring it up
> again and that INBOX keeps missing in mailboxes.db ! Any chances to
> reconstruct it anyways or have I lost it ? The data in
> /oldpartition/domain/etc... got deleted so I think I lost it...Would it
> be possible to only delete data from the old partition if the actual
> move to the new partition was successfull ? Glad that I tested it before
>  starting to move my users to the new partition ;-)

I agree, this behaviour is incorrect.  However, I cannot replicate this.
Atleast not in full.

Here is what I tried to do:

I have a mail server with 2 partitions, /imap/u1 and /imap/u2, and a
mailbox "user.cyrus" on /imap/u1.  In /imap/u2 I change the permissions of
/imap/u2/c to be owned by root (not cyrus), and mode 700.

Renaming user.cyrus to the new partition generates a System I/O error, and
(sadly) the mailbox dissapears from the mailbox list (obviously
incorrect).  The data is still in the original location, however.

The following patch fixes the dissapearing-from-mailbox-list issue:

-Rob

Index: mboxlist.c
===================================================================
RCS file: /afs/andrew.cmu.edu/system/cvs/src/cyrus/imap/mboxlist.c,v
retrieving revision 1.211
diff -u -r1.211 mboxlist.c
--- mboxlist.c  24 Apr 2003 23:20:33 -0000      1.211
+++ mboxlist.c  30 Apr 2003 17:47:06 -0000
@@ -1078,7 +1078,7 @@
     } else {
        DB->commit(mbdb, tid);
        tid = NULL;
-       newreserved = 1;
+       if(!partitionmove) newreserved = 1;
     }

     /* 4. Open mupdate connection and reserve new name (if needed) */


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Rob Siemborski * Andrew Systems Group * Cyert Hall 207 * 412-268-7456
Research Systems Programmer * /usr/contributed Gatekeeper





More information about the Info-cyrus mailing list