Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am at 98% of an 8GB SSD, and I have a 3 GB mysql data that I need to gzip and or tar and then download it, so then I can delete it.

How can I tar or gzip the sql (or the mysql tables) so that that I don't have to make a copy of the 3GB file and get disk full errors.

Running Debian 6.

share|improve this question
Can you mount some network file system and put it there? – cjc Jan 8 '13 at 21:57
You do know that tar doesn't compress the file, right? Gzipped file will be smaller than the original, but a tar file will be bigger (unless the tar file is zipped). – Andy Lester Jan 8 '13 at 22:00
Yes I am aware, but if I tar the mysql /var/lib folder then I can just mv it to /var/www and wget it from another server. – ParoX Jan 8 '13 at 22:13
Since you have access to another server, why don't you just rsync or scp to that other server without moving files around? (Or creating a new archive.) – Aaron Copley Jan 8 '13 at 22:34
Transferring that much data to your average 4 GB stick would probably be painfully slow. And external drive would be better if he has a decent interface if the add-a-drive route is preferable. – Bart Silverstrim Jan 11 '13 at 13:56
up vote 13 down vote accepted

Use the mysqldump utility to direct the file wherever you like:

mysqldump -A -u[username] -p[password] > /path/to/dest/backupname.sql

If you need to, you can pipe the output through gzip:

mysqldump -A -u[username] -p[password] | gzip -c > /path/to/dest/backupname.gz

Further, you can send the output from gzip to another server via ssh:

mysqldump -A -u[username] -p[password] | gzip -c | ssh user@ 'cat >  /path/to/dest/backupname.gz'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.