zimbra HSM Configuration

zimbra HSM Configuration

 

HSM stands for Hierarchical Storage Management , Administrator con configure policy to move message from high performance/costly storage <SAN> to Low performance/inexpensive storage <NAS>. default policy in zimbra is 365 days, that meant message automatically from SAN to NAS older then 365 days. it is nature of users that will read frequently mails that is latest comparison to older mails

 

Create A storage and MAP into server or for testing purpose create directory /opt/zimbra/olermail_store and assign permission zimbra. below is step by step process to configure hsm policy.

 

As root.

[root@knowledgelinux.com ~]mkdir /opt/zimbra/olermail_store
[root@knowledgelinux.com ~]chown zimbra:zimbra /opt/zimbra/olermail_store

Then switch to zimbra.


 [zimbra@knowledgelinux.com ~]su - zimbra
 [zimbra@knowledgelinux.com ~]zmvolume -a -n hsm-volume -t secondaryMessage -p /opt/zimbra/olermail_store
 [zimbra@knowledgelinux.com ~]zmvolume -l
   Volume id: 2
        name: index1
        type: index
        path: /opt/zimbra/index
  compressed: false
     current: true

   Volume id: 1
        name: message1
        type: primaryMessage
        path: /opt/zimbra/store
  compressed: false
     current: true

   Volume id: 3
        name: hsm-volume
        type: secondaryMessage
        path: /opt/zimbra/olermail_store
  compressed: false
     current: false

Set HSM Volume To Current

Now let’s set the hsm-volume to “current”. Otherwise, if you try to run zmhsm you’ll get a error of “invalid request: None of the secondary message volumes are marked as current.”


 [zimbra@knowledgelinux.com ~]$zmvolume -sc -id 3
 [zimbra@knowledgelinux.com ~]$zmvolume -l
   Volume id: 2
        name: index1
        type: index
        path: /opt/zimbra/index
  compressed: false
     current: true

   Volume id: 1
        name: message1
        type: primaryMessage
        path: /opt/zimbra/store
  compressed: false
     current: true

   Volume id: 3
        name: hsm-volume
        type: secondaryMessage
        path: /opt/zimbra/olermail_store
  compressed: false
     current: true

Starting HSM For First Time

This is example is on a test server of mine. I don’t have any messages older than 30 days. The default global configuration for HSM Age is 30 days.


[zimbra@knowledgelinux.com ~]$ ls /opt/zimbra/olermail_store/
[zimbra@knowledgelinux.com ~]$ crontab -l | grep -i hsm
[zimbra@knowledgelinux.com ~]$ zmhsm -t
HSM process started.
[zimbra@knowledgelinux.com ~]$ zmhsm -u
Last HSM Session Stats
----------------------
Start time: Fri Aug 15 15:48:58 EDT 2008
End time:   Fri Aug 15 15:48:58 EDT 2008
Not currently running.
Moved 0 blobs dated earlier than Wed Jul 16 15:48:58 EDT 2008
  to volume 3.
Mailboxes processed: 7 out of 7.
[zimbra@knowledgelinux.com ~]$ ls /opt/zimbra/olermail_store/
[zimbra@knowledgelinux.com ~]$ zmprov gacf | grep zimbraHsmAge
zimbraHsmAge: 30d

So, it worked but didn’t have anything to Age.
Adjusting the zimbraHsmPolicy variable – ZCS

Default policy [ZCS 8.6] :


$ zmprov gacf zimbraHsmPolicy
zimbraHsmPolicy: message,document:before:-30days
$ zmprov desc -a zimbraHsmPolicy

zimbraHsmPolicy
The policy that determines which mail items get moved to secondary
storage during HSM. Each value specifies a comma-separated list of
item types and the search query used to select items to move. See the
spec for <SearchRequest> for the complete list of item types and
query.txt for the search query spec.

type : string
value :
callback :
immutable : false
cardinality : multi
requiredIn :
optionalIn : globalConfig,server
flags : serverInherited
defaults : message,document:before:-30days
min :
max :
id : 1024
requiresRestart :
since : 6.0.0_BETA2
deprecatedSince :

Adjusting the zimbraHsmAge variable – Deprecated since: 6.0.0_BETA2.

$ zmprov desc -a zimbraHsmAge
zimbraHsmAge
    Deprecated since: 6.0.0_BETA2. deprecated in favor for
    zimbraHsmPolicy. Orig desc: Minimum age of mail items whose filesystem
    data will be moved to secondary storage.. Must be in valid duration
    format: {digits}{time-unit}. digits: 0-9, time-unit: [hmsd]|ms. h -
    hours, m - minutes, s - seconds, d - days, ms - milliseconds. If time
    unit is not specified, the default is s(seconds).

               type : duration
              value :
           callback :
          immutable : false
        cardinality : single
         requiredIn :
         optionalIn : globalConfig,server
              flags : serverInherited
           defaults : 30d
                min : 0
                max :
                 id : 8
    requiresRestart :
              since :
    deprecatedSince : 6.0.0_BETA2


zimbraHsmAge must be a valid duration of: nnn[hsmd]

    "zimbraHsmAge variables unclear from output"
        http://bugzilla.zimbra.com/show_bug.cgi?id=32290

[zimbra@knowledgelinux.com ~]$ zmprov mcf zimbraHsmAge 30d
### example initially had to reproduce issue for my RFE - please don't use 1d ###
###  [zimbra@knowledgelinux.com ~]$ zmprov mcf zimbraHsmAge 1d ###
[zimbra@knowledgelinux.com ~]$ zmprov gacf | grep zimbraHsmAge
zimbraHsmAge: 1
[zimbra@knowledgelinux.com ~]$ zmhsm -t
HSM process started.
[zimbra@knowledgelinux.com ~]$ zmhsm -u
Last HSM Session Stats
----------------------
Start time: Fri Aug 15 15:56:39 EDT 2008
End time:   Fri Aug 15 15:56:40 EDT 2008
Not currently running.
Moved 63 blobs dated earlier than Fri Aug 15 15:56:38 EDT 2008
  to volume 3.
Mailboxes processed: 7 out of 7.
[zimbra@knowledgelinux.com ~]$ ls /opt/zimbra/olermail_store/
0
[zimbra@knowledgelinux.com ~]$ ls /opt/zimbra/olermail_store/0/
1  14  15  3

The above commands modified the zimbraHsmAge as a global setting. You can also modify it on a server basis.

[zimbra@knowledgelinux.com ~]$ zmprov gs knowledgelinux.com.internal.homeunix.com | grep zimbraHsmAge
zimbraHsmAge: 1d
[zimbra@knowledgelinux.com ~]$ zmprov gacf | grep zimbraHsmAge
zimbraHsmAge: 1d
[zimbra@knowledgelinux.com ~]$ zmprov ms knowledgelinux.com.internal.homeunix.com zimbraHsmAge 30d
[zimbra@knowledgelinux.com ~]$ zmprov gs knowledgelinux.com.internal.homeunix.com | grep zimbraHsmAge
zimbraHsmAge: 30d
[zimbra@knowledgelinux.com ~]$ zmprov gacf | grep zimbraHsmAge
zimbraHsmAge: 1d

Moving zimbraHsmAge Back To A Lower Number

Continuing after the above steps, let's see what happens if we now run zmhsm.

[zimbra@knowledgelinux.com ~]$ zmhsm -t
HSM process started.
[zimbra@knowledgelinux.com ~]$ zmhsm -u
Last HSM Session Stats
----------------------
Start time: Fri Aug 15 16:09:05 EDT 2008
End time:   Fri Aug 15 16:09:05 EDT 2008
Not currently running.
Moved 0 blobs dated earlier than Fri Aug 15 16:08:35 EDT 2008
  to volume 3.
Mailboxes processed: 7 out of 7.

Did the message files get moved back?

 [zimbra@knowledgelinux.com ~]$ find /opt/zimbra/store/0/15 -name *.msg -print
 [zimbra@knowledgelinux.com ~]$ find /opt/zimbra/olermail_store/0/15 -name *.msg -print
 /opt/zimbra/olermail_store/0/15/msg/0/269-21.msg
 /opt/zimbra/olermail_store/0/15/msg/0/263-10.msg
 /opt/zimbra/olermail_store/0/15/msg/0/268-14.msg
 /opt/zimbra/olermail_store/0/15/msg/0/261-8.msg
 /opt/zimbra/olermail_store/0/15/msg/0/266-13.msg
 /opt/zimbra/olermail_store/0/15/msg/0/259-4.msg
 /opt/zimbra/olermail_store/0/15/msg/0/265-12.msg
 /opt/zimbra/olermail_store/0/15/msg/0/257-2.msg