Results 1 to 9 of 9

Thread: per-folder size from command line?

  1. #1
    anthonyclark is offline Member
    Join Date
    Jul 2008
    Location
    Ann Arbor, MI
    Posts
    10
    Rep Power
    7

    Default per-folder size from command line?

    Hi All,

    We have an account here with 140GB in their mailbox. We'd like to get a size for each of their folders without viewing their mailbox in the admin web interface. Ideally this would be a single line command as the zimbra user on the command line interface.

    zmmailbox can get all folders, or a single folder but doesn't show message size. Is there any way to do that?

    Thanks!

  2. #2
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    Sorry I don't think it can. Just tried myself and it would appear all you can get is the number of messages and how many are unread

  3. #3
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    That data is actually returned by the server. If zmmailbox isn't displaying it, you can still get at it by turning on debug/verbose mode and looking at the "s" attribute on the folder.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  4. #4
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    dkarp, what commands would need to be used from the CLI ?

  5. #5
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    Same commands as normal for fetching folders, only adding either -v for verbose or -d for debug. (Not sure which is the one you want -- try and see.)
    Bugzilla - Wiki - Downloads - Before posting... Search!

  6. #6
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    Code:
    su - zimbra
    zmmailbox -v -d
    mbox> aa admin@zcs admin_password
    mbox> selectMailbox user@domain.com
    mbox> gf Inbox
    gf -v Inbox
    {
     "id": "2",
     "name": "Inbox",
     "path": "/Inbox",
     "parentId": "1",
     "flags": null,
     "color": "defaultColor",
     "unreadCount": 0,
     "messageCount": 85,
     "view": "message",
     "url": null,
     "effectivePermissions": null
    }
    even specifying -v when called with gf it does not show any additional attributes. Even when using gaf only the number of messages/unread are shown.

  7. #7
    anthonyclark is offline Member
    Join Date
    Jul 2008
    Location
    Ann Arbor, MI
    Posts
    10
    Rep Power
    7

    Default

    I used "zmmailbox -d -z -m REMOVED@removed.edu gaf" and got the SOAP response back. Piping that into " grep -E '\"name\"|\"s\"' " will, with some editing, give you a per-folder list for that user.

  8. #8
    shan is offline Active Member
    Join Date
    Feb 2008
    Posts
    26
    Rep Power
    7

    Default

    Quote Originally Posted by anthonyclark View Post
    I used "zmmailbox -d -z -m REMOVED@removed.edu gaf" and got the SOAP response back. Piping that into " grep -E '\"name\"|\"s\"' " will, with some editing, give you a per-folder list for that user.
    Thanks for the tip.

    I found another way to get folder size by using mysql as zimbra user. The size information is in metadata field in mboxgroupX .mail_item table. Here are steps (and I have script if anyone is interested):

    1. Find account's zimbraID - zmprov ga <account> zimbraID

    2. Find folder id that you are interested - zmmailbox -z -m <account> gf /folder, store the id number in folder_id.

    3. Find group_id and id using mysql from zimbra.mailbox table:
    mysql -N -e "select group_id, id from zimbra.mailbox where account_id='zimbraID'

    For next mysql select, the mboxgroup database is mboxgroup$group_id, and the mailbox_id is id.

    4. Find the folder message count and size:
    mysql -N -e "select size,metadata from $mboxgroup.mail_item mailbox_id=$mail box_id and id=$folder_id

    The "size" field is actually the message counts in the folder, and the size of the folder is in metadata, for example: you has something like this for the metadata:

    d1:ai1e3:i4ri145047e4:mseqi307394e2:szi155818706e4 :unxti148219e1:vi10ee

    The folder size is the number after the :szi, in bytes.

  9. #9
    stsimb is offline Junior Member
    Join Date
    Oct 2013
    Location
    Greece
    Posts
    5
    Rep Power
    1

    Default

    Here is a shell script to automate what shan described above..
    https://github.com/stsimb/zimbra-scr...zimbra-size.sh

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. .pst migration issues
    By jimklein in forum Migration
    Replies: 13
    Last Post: 02-16-2009, 01:55 AM
  2. Error when Using Outlook PST Importer
    By chh in forum Zimbra Connector for Outlook
    Replies: 1
    Last Post: 01-19-2009, 05:20 AM
  3. can't you help me
    By iwan siahaan in forum Administrators
    Replies: 6
    Last Post: 12-17-2007, 06:53 PM
  4. Replies: 3
    Last Post: 08-11-2007, 12:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •