Move messages to new secondary volume

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Situation : Three volumes in use :

 Primary
 Index1
 Secondary  ("sec")

Problem : The secondary volume is full and I need to add another volume. However I would like to move messages from my existing secondary volume (sec) to the new secondary volume (sec2)

Solution :

1. Add New volume using Admin Console -> Server Settings -> Volumes. Lets call is sec2.

2. Copy all messages from existing secondary volume to new secondary volume :

  cp -dpR /mnt/secstore /mnt/secstore2

3. There are two approaches here, either edit mysql to toggle the volume_id's of the volume or move message to the new volume id.

Edit mysql

   mysql zimbra
   select * from volume;
   SET foreign_key_checks = 0; (to ensure that foreign key check is turned off to be able to change the ids)
   update volume set id=5 where id=3; (set arbitary value for volume "sec")
   update volume set id=3 where id=4; (set id of sec to sec2)
   update volume set id=4 where id=5; (set id of sec to 4, to maintain sanity)
   SET foreign_key_checks = 1; (bring back foreign key check) 
 Before :
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+
| id | type | name     | path              | file_bits | file_group_bits | mailbox_bits | mailbox_group_bits | compress_blobs | compression_threshold |
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+
|  1 |    1 | message1 | /opt/zimbra/store |        12 |               8 |           12 |                  8 |              0 |                  4096 |
|  2 |   10 | index1   | /opt/zimbra/index |        12 |               8 |           12 |                  8 |              0 |                  4096 |
|  3 |    2 | sec      | /mnt/secstore     |        12 |               8 |           12 |                  8 |              0 |                  4096 |
|  4 |    2 | sec2     | /mnt/secstore2    |        12 |               8 |           12 |                  8 |              0 |                  4096 |
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+
 After : 
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+
| id | type | name     | path              | file_bits | file_group_bits | mailbox_bits | mailbox_group_bits | compress_blobs | compression_threshold |
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+
|  1 |    1 | message1 | /opt/zimbra/store |        12 |               8 |           12 |                  8 |              0 |                  4096 |
|  2 |   10 | index1   | /opt/zimbra/index |        12 |               8 |           12 |                  8 |              0 |                  4096 |
|  3 |    2 | sec2     | /mnt/secstore2    |        12 |               8 |           12 |                  8 |              0 |                  4096 |
|  4 |    2 | sec      | /mnt/secstore     |        12 |               8 |           12 |                  8 |              0 |                  4096 |
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+

or

3. Use "zmsoap" to move messages to the new volume :

zmsoap -z MoveBlobsRequest @types=all @sourceVolumeIds=3 @destVolumeId=4 query=is:anywhere
Mark the new volume id 4 as current from Global Config -> Server Settings -> Volumes


4. Rename or move old store to ensure old volume is not accessed.

  mv /mnt/secstore /mnt/secmoved

5. Restart Mailboxd, this is required for the mysql changes to come into effect.

  zmmailboxdctl restart

6. Test, check for a few messages which should have been present in "sec" and if they can be accessed.

Jump to: navigation, search