Results 1 to 2 of 2

Thread: Unexpected Blob - Cleanup Script

  1. #1
    Join Date
    May 2010
    Posts
    272
    Rep Power
    5

    Default Unexpected Blob - Cleanup Script

    Just in case someone needs it ife made a little dirty script to cleanup unexpected blobs.

    since they arent referenced in the database anymore it SHOULD be safe to move em away.
    of course do DB integrity check first
    also do a

    Code:
    zmblobchk --incorrect-revision-rename-file
    First. Use it only if you know what youre doing, no Guarantes here.

    What does it do:
    it uses zmblockchk to generate a list of unexpected blobs
    then we create a mirror directory structure in a safe path
    then it moves all the unxpected there - if something is wrong you still have the backup

    WARNING dont use it in HSM or something, its very simple it just expect usual storage

    Adjust the global vars as you need em
    you may notice i reset every variable i use in the loop, shouldnt be nessesary but since this is a very touchy operation we do i just wanted to be dam shure

    Code:
    #!/bin/bash
    blobfile="/storage/archiv/unexp-blobs.lst #listfile name and path to generate"
    savedir="/storage/archiv/unexpected-blobs" #full path to your archive directory, structure will be created under it
    storepath="/opt/zimbra/store/0/" #path to our storage where will find our mailbox directorys
    #make savedir if not exist
    if [ ! -d "$savedir" ]; then
        mkdir -p $savedir
    fi
    #kill unexpected bloblist file if exist
    if [ -f $blobfile ]; then
        rm -f $blobfile
    fi
    zmblobchk --unexpected-blob-list $blobfile  start;
    for i in $(cat $blobfile); do
         tmpvar1="";mbxdir="";filename="";
    
        tmpvar1="$(dirname $i)"
        mbxdir=${tmpvar1#$storepath}
        #filename=$(basename $i)
        echo $savedir/$mbxdir/$filename
        #create target dir if not exist the dirty way
        if [ ! -d "$savedir/$mbxdir" ]; then
            mkdir -p $savedir/$mbxdir
        fi
        #do operation
        mv -v $i $savedir/$mbxdir/;
    
      done

    have fun

  2. #2
    Join Date
    May 2010
    Posts
    272
    Rep Power
    5

    Default

    PS: One thing i noticed.
    I got a lot of unexpected filesizes / unexpected blobs and wrong filename revision in there
    all related to the briefcase

    looks like if you use the briefcase as mounted directory under windows / and or maybe together with zdesktop this is the result

    all this was a result WIHTOUT anykind of crash - jsut normaly daily operation - looks like nothing got lost - its just
    wrong handling of deletions/revisions whatsoever by zimbra

    just a hint what it could be, investigate first bevore you do anything or you may break your hole installation and datastorage

Similar Threads

  1. Postfix/Cleanup
    By civilwar in forum Administrators
    Replies: 1
    Last Post: 10-01-2011, 04:30 AM
  2. How to I cleanup error messages
    By COD in forum General Questions
    Replies: 5
    Last Post: 05-10-2010, 08:38 PM
  3. Cleanup after many upgrades
    By tobru in forum Installation
    Replies: 1
    Last Post: 12-23-2007, 08:21 AM
  4. SPAM Cleanup
    By swu in forum Administrators
    Replies: 6
    Last Post: 07-18-2007, 10:24 AM
  5. Cleanup Inbox from SPAM
    By dealt in forum Administrators
    Replies: 3
    Last Post: 03-19-2007, 11:15 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
  •