User login

Drush and specifying source dump and target dump options

Using temporary files to store and transfer sql-dump. It is recommended that you specify --source-dump and --target-dump options on the command line, or set '%dump' or '%dump-dir' in the path-aliases section of your site alias records. This facilitates fast file transfer via rsync.

What exactly does that mean? Is some random location i make up really better than the temporary directory? Or should i be giving it some specific directory, on different serves or something? Guidance please.


in drushrc.php

['dump-dir'] = '/home/ben/tmp/dumps';

with no matter what i did to the folder:

[email protected]:~/code/sdl/web (continuum *)$ sudo chown root:root -R /home/ben/tmp
[email protected]:~/code/sdl/web (continuum *)$ sudo chmod 775 -R [email protected]:~/code/sdl/web (continuum *)$ ls -la /home/ben/tmp/dumpstotal 8
drwxrwxr-x 2 root root 4096 2011-08-28 22:12 .
drwxrwxr-x 3 root root 4096 2011-08-28 22:12 ..


drush sql-sync --alias-path=.. @sdl.stage @sdl.local

You will destroy data from sdl and replace with data from

You might want to make a backup first, using the sql-dump command.

Do you really want to continue? (y/n): y
mysqldump: Can't create/write to file '/home/ben/tmp/dumps/simone.mayfirst.org_drupal-sdl-stage.sql-1314585287' (Errcode: 2)
mv: cannot stat `/home/ben/tmp/dumps/simone.mayfirst.org_drupal-sdl-stage.sql-1314585287': No such file or directory
rsync: change_dir "/home/ben/tmp/dumps" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1526) [Receiver=3.0.7]
Could not rsync from [error]
to /home/ben/tmp/dumps/sdl.sql

But this works:

['dump-dir'] = '/tmp';

[email protected]:~/code/sdl/web (continuum *)$ ls -la /tmp/

total 27800
drwxrwxrwx 18 root root 4096 2011-08-28 22:50 .
drwxr-xr-x 24 root root 4096 2011-08-21 07:27 ..

Go figure.

Searched words: 
sync temp


put location-specific %dump-dir in aliases.drushrc.php

I agree this is a pretty big wtf, but it kinda make sense: specifying dump-dir in drushrc.php means the same folder must exist on all environments.

To get around this, add location-specific '%dump-dir' to your specific alias locations inside your aliases.drushrc.php file where you define @sdl.stage and @sdl.local.

This will allow you to have one dump location on your local environment, and another on your staging server.

I actually use the %dump option, to specify the exact file i want to use, instead of %dump-dir...

// @file ~/.drush/example.aliases.drushrc.php

// Development environment.

$aliases['local'] = array(
'uri' => 'example.local',
'root' => '~/Sites/example/www',
'db-url' => 'mysql://example:[email protected]/example',
'path-aliases' => array(
// Path for sql-sync dumps.
'%dump' => '~/Sites/example/assets/db_snapshot/development-' . date('Ymdhis') . '.sql',

// Staging environment.
$aliases['stage'] = array(
'uri' => '',
'root' => '/home/example/public_html/www',
'db-url' => 'mysql://example:[email protected]/example',
'remote-host' => '',
'remote-user' => 'example',
'path-aliases' => array(
// Path for sql-sync dumps.
'%dump' => '/home/example/public_html/assets/db_snapshot/staging-' . date('Ymdhis') . '.sql',

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.