diff --git a/drush/provision_tasks_extra.drush.inc b/drush/provision_tasks_extra.drush.inc
index 24e0698..3b2c465 100644
--- a/drush/provision_tasks_extra.drush.inc
+++ b/drush/provision_tasks_extra.drush.inc
@@ -47,6 +47,14 @@ function provision_tasks_extra_drush_command() {
     'description' => 'Reverts all Features modules on a site.',
     'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
   );
+  $items['provision-hmselfupdate'] = array(
+    'description' => 'Migrate a hostmaster site between platforms.',
+    'options' => array(
+      'generatedirname' => dt('The new dir name.')
+    ),
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
+  );
+
 
 
   return $items;
@@ -193,3 +201,20 @@ function drush_provision_tasks_extra_provision_features_revert_all() {
   provision_backend_invoke(d()->name, 'features-revert-all');
   drush_log(dt('All features reverted.'));
 }
+
+/**
+ * Implements the provision-hmselfupdate command.
+ */
+function drush_provision_tasks_extra_provision_hmselfupdate() {
+  drush_errors_on();
+
+  // FIXME almost static for now.
+  $drupal_dir = '/var/aegir/hostmaster-7.x-3.x-' . date('Y-m-d_H-i');
+  $aegir_domain = d()->uri;
+  $arguments = array($aegir_domain, $drupal_dir);
+  // TODO make configurable.
+  $options = array('working-copy' => TRUE);
+  //drush_log('hostmaster-migrate' . print_r($arguments, 1) . ' ' . print_r($options, 1));
+  provision_backend_invoke('@hostmaster', 'hostmaster-migrate', $arguments, $options);
+  drush_log(dt('Drush provision-hmselfupdate task completed'));
+}
diff --git a/hosting_tasks_extra.module b/hosting_tasks_extra.module
index 3cbd01d..81f68df 100644
--- a/hosting_tasks_extra.module
+++ b/hosting_tasks_extra.module
@@ -24,6 +24,12 @@ function hosting_tasks_extra_hosting_tasks() {
     'description' => t('Runs database updates on this site.'),
     'dialog' => TRUE,
   );
+  $tasks['site']['hmselfupdate'] = array(
+    'title' => t('Self upgrade hostmaster'),
+    'description' => t('Build a new platform and migrates hostmaster to it..'),
+    'access callback' => 'hosting_site_hmselfupdate_access',
+    'dialog' => TRUE,
+  );
   $tasks['site']['features_revert_all'] = array(
     'title' => t('Revert features'),
     'description' => t('Reverts all features overrides on this site.'),
@@ -91,6 +97,15 @@ function hosting_site__action($node) {
   hosting_add_task($node->nid, '');
 }
 
+function hosting_site_hmselfupdate_access($node) {
+  if ($node->nid == hosting_get_hostmaster_site_nid()) {
+    return TRUE;
+  }
+  else {
+    return FALSE;
+  }
+}
+
 /**
  * Implements hook_permission().
  */
@@ -137,6 +152,17 @@ function hosting_task_update_form($node) {
 }
 
 /**
+ * Implements hosting_task_TASK_TYPE_form().
+ */
+function hosting_task_hmselfupdate_form($node) {
+  $form['foo'] = array(
+    '#markup' => t('Warning ....'),
+    '#value' => 'Foo',
+  );
+  return $form;
+}
+
+/**
  * Implements hook_hosting_task_update_ops().
  *
  * @see: hosting_task_update_form().
