• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Plesk migrator error

Hello,

I am trying to migrate sites from a linux server to a windows one (both with plesk and the migrator extension). I am trying to follow the steps on migrating with custom hosting, and I created the config.ini fileon the target server. However, when I run the plesk-migrator utility I receive the following error (IP removed). Do you have any suggestions?

[ERROR] Failed to fetch basic information about resellers, clients and domains data from source servers
Cause: Failed to execute local command 'echo y | ssh-keygen -q -t rsa -P "" -f "C:\Program Files (x86)\Parallels\Plesk\var\modules\panel-migrator\sessions\migration-session\ssh-keys\id_rsa.xxx.xxx.xxx.xxx"': [Error 2] The system cannot find the file specified
That is a critical error, migration was stopped.
 
Thank you for your response Peter. Is there any other way of doing the transfer? As far as I can understand from the documentation, creating custom hosting descriptions is (probably) one option, by creating the yaml or json file detailing for each subscription on the source server, including httphosts directory, databases and e-mail accounts for each; quite a bit of labour work, but doable I suppose. What troubles me is that it appears that in this way there is no way of bringing e-mail accounts content on the new server.

Is creating manual backups for each domain a vial path, by copying the backup file or storing it on the target server by means of FTP repository, and then using the restore utility on the target server?

Again, thank you for your time.
 
No, transfer by backup between Linux and Windows is not supported either.
Transferring Data Between Plesk Servers
As far as I understand it, Migrator is using backup components and vice versa.
From a programmer's perspective I'd find it extremely difficult to migrate a webhosting package between the two platforms. Think about disk space permissions and differences between file systems, think about system services, think about mail hosting, antivirus solutions - all is completely different. I wonder why someone would migrate from Linux to Windows anyway. Less possibilities, higher operating costs, more crashes ...

From general knowledge of Windows and Linux, I don't think that there is an easy, direct way to migrate mailbox contents. The easiest is to open the two mailboxes, source and target, by IMAP within the same client and then drag & drop the content from source to target.
 
Last edited:
Hi Konstantinos,

Good news! Starting from Plesk Migrator 2.6 released on the last week (please, always update Plesk Migrator extension to the most recent version as we are constantly improving it - for example, 2.6.11 includes major bugfixes for this very feature), there is such a feature as migration for websites, including сross-OS. That says a customer (or admin on customer behalf) can transfer website content
from Windows to Linux hosting (no matter which hosting panel there is used on the source server) and vice versa together with MySQL database related to this site. Either way, if there is WordPress site, it will be found and transferred "as is".

This type of migration designed for the use on customer level in Plesk so if you choose to migrate multiple sites, you will need to migrate them one by one, entering FTP (and probably MySQL DB credentials) for every source site you need to migrate.

To use migration of а website, please open domain main screen and click on "Website Importing" icon. In one of next Plesk Migrator releases we will add to usability for Plesk admin could choose a domain to migrate to on server-level, without a need to enter into each destination domain to initiate site transfer.

Migration of a mailbox over IMAP is also in plans to implement in one of next versions of Migrator.

Look forward to seeing your feedback on website migration/import from Linux to Window.
 
Hello,

@Peter, thank you for your time. I actually logged in in order to apologize for not doing this earlier, as I had seen your response yesterday but I did not manage to do so. Got anxious about planning and performing manual transfers, I suppose. The differences and the difficulties are more or less obvious, and not only from a programmer's perspective. As for reasons for migrating from Linux to Windows, well, sometimes you don't have a word either on application requirements (e.g. third party software) or costs (separate web, db and/or mail servers and/or some redundancy would make such a migration irrelevant); in such cases, you have to figure out things, even if suboptimal. The problem is our provider claimed the migration is possible, but I had to perform better search on my own. My fault :( Again, thank you for your time. Especially for the IMAP trick. I had never dealt with this, found it to be ingenious.

@eug this is good news indeed. I promise I will provide feedback on the process.
 
Last edited:
I have a set of scripts that can do migrate all the mailboxes from 1 IMAP-server to the localhost or vice versa with 1 command.
Code:
pleskmailmigrate <domain>

If you want it to work with only that 1 command, you need to have your mailboxes setup on your Plesk server exactly as they are on the remote server.
It also assumes that the current server is not yet doing the mail.

The real work is done by imapsync
I just wrote 2 wrappers (one is wrapped in the other) so that it is simplified and works with Plesk.

I could post them, but they are a bit quick-and-dirty written and when things become custom, you need to do things a bit different.

pleskmailmigrate is the outer wrapper.
It checks with Plesk for the domain and loops through all the mailboxes and writes configuration files to be used for the 2nd wrapper (syncimap).
With the option -o (old) you can keep it from overwriting the configuration files (in case you manually edited them)

The wrapper syncimap is a simple wrapper for imapsync
It is for syncing a mailbox with the use of a config file (same name as email-adress placed in your home folder).

You of course need "imapsync"

cat /usr/local/sbin/syncimap
Code:
#!/bin/bash

if [ -z "$1" ] ; then
  echo "You need to give a config file"
  exit 1
fi

if [ ! -e ~/$1 ] ; then
  echo "~/$1 does not exist!"
  exit 1
fi

. ~/$1

if [ -z "HOST1" ] ; then
  echo "HOST1 does not exist in ~/$1"
  exit 1
fi


echo "$PASS1" >~/$1.secret1
echo "$PASS2" >~/$1.secret2

echo "Migrating mail from \"$USER1\" on host \"$HOST1\" to \"$USER2\" on host \"$HOST2\""

imapsync --host1 $HOST1 \
         --user1 $USER1 --passfile1 ~/$1.secret1 \
         --host2 $HOST2 \
         --user2 $USER2 --passfile2 ~/$1.secret2 \
         --syncinternaldates \
         --noauthmd5 \
         --useheader 'From' \
         --useheader 'Subject' \
         --useheader 'Message-id' \
         --skipsize \
         --subscribe \
         ${OPTION}

         # --exclude 'Deleted|Trash' \

EXITCODE=$?

if [ ${EXITCODE} -eq 0 ] ; then
  rm ~/$1.secret1
  rm ~/$1.secret2
fi
exit ${EXITCODE}


cat /usr/local/sbin/pleskmailmigrate
Code:
#!/bin/sh

while getopts osrnd: OPTION
do
  case $OPTION in
    o)   OLDCONFIGS=1;;
    s)   SSLFOREIGN=1;;
    r)   REVERSE=1;;
    n)   NODOMAIN=1;;
    d)   DAYS="$OPTARG";;
    ?)   printf "Usage: %s: [-r] [-s] [-o] [-n]  [-d <days>] <domain> \n" $0
    exit 2;;
  esac
done
shift $(($OPTIND - 1))


if [ -z "${1}" ] ; then
  echo "You have to at least supply a domain" >&2
  exit 1
fi

TMP1=`mktemp`
TMP2=`mktemp`
TMP3=`mktemp`
TMP4=`mktemp`

[ ${DAYS} ] && DAYS=`echo "${DAYS}" | tr -cd '0-9'`

# mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa -e 'select CONCAT(mail_name,"@",name) as email_address, substring(accounts.password, '1') from mail left join domains on domains.id=mail.dom_id left join accounts on accounts.id=mail.account_id;' | egrep ".+@$1" >${TMP1}

mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa -e 'select CONCAT(mail_name,"@",name) as email_address from mail left join domains on domains.id=mail.dom_id left join accounts on accounts.id=mail.account_id;' | egrep ".+@$1" >${TMP2}
/usr/local/psa/admin/bin/mail_auth_view | grep "@${domein}" |  grep -f ${TMP2} | awk -F\| '{print $2" "$4}' >${TMP1}


awk '{print $1}' ${TMP1} | awk -F@ '{print $2}' | sort | uniq >${TMP2}

DOMAINS=`cat ${TMP2} | wc -l`

if [ ${DOMAINS} -eq 0 ] ; then
  echo "This server has no email-addresses for domain $1"
  exit 1
elif [ ${DOMAINS} -gt 1 ] ; then
  echo "Ambiguous!  This server has more than 1 domain containing $1  (`cat ${TMP2}`)" >&2
  echo "\"`cat ${DOMAINS}`\"" >&2
  exit 1
fi

DOMAIN=`cat ${TMP2}`

FAILED=0
MIGRATED=0

if [ -z $2 ] ; then
  MX=`host -t MX ${DOMAIN} | egrep -o 'handled by [0-9]+ .*' | head -n1 | awk '{print $4}' `
  if [ ! -z "${MX}" ] ; then
    MAILIP=`host -t A ${MX} | egrep -o 'has address .*' | head -n1 | awk '{print $3}'`
    if [ ! -z "${MAILIP}" ] ; then
      if ifconfig | grep 'inet' | grep -q " ${MAIL} " ; then
        echo "If this server is already handling the mail, then you have to supply a domain to sync" >&2
        exit 1
      fi
    fi
  fi
else
  HOSTRAW=`echo $2 | tr 'A-Z' 'a-z'`
  HOST="`echo "${HOSTRAW}" | tr -cd 'a-z0-9.-' | egrep '.+\..+'`"
  if [ "${HOST}" = "${HOSTRAW}" ] ; then
    MAILIP=`echo $2 | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'`
    [ -z "${MAILIP}" ] && MAILIP=`host -t A $2 2>/dev/null | egrep -o 'has address .*' | head -n1 | awk '{print $3}'`
  else
    echo "\"${HOSTRAW}\" is not a valid domain or IP-address (${HOST})"
  fi
fi

# Make it easy for accounts at gmail
if echo "${MX}" | grep -q 'google' ; then
  SSLFOREIGN=1
  MAILIP=imap.gmail.com
fi

if [ -z "${MAILIP}" ] ; then
  echo "Unable to resolve the foreign mailserver" >&2
else
  echo ${DOMAIN}
  while read CREDENTIAL ; do
    LOGINHERE="`echo ${CREDENTIAL} | awk '{print $1}'`"
    PASS="`echo ${CREDENTIAL} | awk '{print $2}'`"
    if [ -z "${CREDENTIAL}" ] ; then
      echo "Error, unable to fetch the credentials of \"${LOGINHERE}\""
      let FAILED+=1
      echo "${LOGINHERE}" >>$TMP4
    else
      LOGINTHERE="${LOGINHERE}"
      [ ${NODOMAIN} ] && LOGINTHERE="`echo ${CREDENTIAL} | awk '{print $1}' | awk -F@ '{print $1}'`"

      FILE=~/`echo "${LOGINHERE}" | sed 's/@/\\@/'`

      if [ ! -f ${FILE} ] || [ ! ${OLDCONFIGS} ] ; then

        echo -e "HOST1=${MAILIP}\nUSER1=${LOGINTHERE}\nPASS1=\"${PASS}\"\nHOST2=127.0.0.1\nUSER2=${LOGINHERE}\nPASS2=\"${PASS}\"" >${FILE}

        OPTIONS='--automap'
        OPTIONS=''
        echo "${HOSTRAW}" | grep -q 'gmail' && OPTIONS='--exclude \"\\[Gmail\\]$\" ${OPTIONS}'

        [ ${SSLFOREIGN} ] && OPTIONS="--ssl1 ${OPTIONS}"
        [ ${DAYS} ]       && OPTIONS="--maxage ${DAYS} ${OPTIONS}"

        if [ -z "${OPTIONS}" ] ; then
          echo -e "#OPTION=\"--maxage 1 \"" >>${FILE}
        else
          echo -e "OPTION=\"${OPTIONS}\"" >>${FILE}
        fi

        if [ ${REVERSE} ] ; then
          sed -i 's/1=/0=/' ${FILE}
          sed -i 's/2=/1=/' ${FILE}
          sed -i 's/0=/2=/' ${FILE}
          sed -i 's/ssl1/ssl2/' ${FILE}
        fi
      fi
      syncimap "${LOGINHERE}" 2>>${TMP3}

      if [ $? -ne 0 ] ; then
        let FAILED+=1
        echo "${LOGINHERE}" >>$TMP4
      else
        let MIGRATED+=1
      fi
    fi
  done <${TMP1}
  echo -e "\n\n\n\nMigrated ${MIGRATED} successfully for ${DOMAIN}"
  if [ ${FAILED} -ne 0 ] ; then
    echo -e "${FAILED} accounts failed:"
    cat ${TMP3}
    cat ${TMP4}
  fi
fi

rm ${TMP1}
rm ${TMP2}
rm ${TMP3}
rm ${TMP4}
 
Last edited:
Back
Top