We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


How to backup a linux hosted server over ftp

maagnh asked
Medium Priority
Last Modified: 2008-02-01
I have a hosted FC4 server that I need to backup. The hosting company provides a ftp server for backup. No ssh or any other kind of access to this backup storage except ftp.

I need to backup not just selected files but the whole server so if needed I can do a complete system restore. I also have a MySQL database that I need to make sure is properly backed up as well.

I tried the idea of using fuse and curlftpfs to mount the ftp server and then use plain old dump or rsync but ended up in dependency hell. Is there an easy, I'm new to linux, way to backup my server over ftp or would it make sense for me to setup a small linux box at my location and then use rsync over ssh to backup my hosted server?

Any help would be greatly appreciated.
Watch Question

Senior Linux / DBA / DEVOPS
First of all use of FTP and NOT SFTP, that is to say allowing FTP access but NOT ssh access seems like a backward mentality. In good practice it should be the other way around. With SSHD enabled, then all you'ld have to do is use scp, (secure copy)

scp someremotehost.com:/some/path/files /some/local/path/

With mysql, use mysqldump to dump the database into a text file, or to do a 'host to host' dump

mysqldump -u user --password=somepass remotehost remotedbase | mysql -u user --password=somepass localhost localdbase

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
First, when you say "back up the whole server so if needed...can do a complete system restore", you mean restore the *functionality* of your system, not actually restore the the specific system itself, no?

The difference is like this:  if you've got identical hardware, then a bare-metal recovery from one box to another can be done, and is easier and faster in some respects than doing a simple re-construction of the original system's services and functionality (although it takes more skill and you will need to read up on a lot more details -- which can be done here:  http://tldp.org/HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO/).  But what i suspect is that you just want to make sure you've got the server's functionality, services and data available on your backup machine.

In that vein, i'd use rsync, simply because you can write one script, once, put it in crontab and then be done with it.  

With rsync, you can backup your config files in /etc and /usr, and your data files in /var, and if you've got the same services running on your backup machine you should be fine.

So what i'm wondering is whether you've got a different set of hardware on your backup machine and if that machine is the one you intend to substitute as the backup system;  if so, then you probably just want to install Fedora 4 on there and get all the services properly configured.  Presuming that, then there are two more questions:

* Does your hosted machine use proprietary software?  (like CPanel)
* Does your hosted machine have a lot of software that's been installed from source, rather than packages?

If the answer to either of these is "yes", then backing up your entire disk may be the right answer -- but you're going to need to guarantee that the identical hardware is available for that to be of any use.  Just backing up the entire system doesn't mean it will work with different hardware, and if what you really want is to have a functioning backup *system* then copying everything on the hosted server is not just overkill but in the absence of identical hardware is actually more trouble than it's worth.  

However, if your answer to those two questions is "no", then really the only thing you need to do is get a dump of the rpm repositories and the installed software on the original system, get all of that installed onto your backup system, and then from there you can simply coordinate the data-, data-base, and config files with rsync.
boy, a hosting company and only ftp... !!!  are you sure that rsync / ssh / scp is not allowed as well. then that is a easier way to go than what is below.

my suggestion would be to use a similar setup like what kyle says.  setup a small box (with enough hard disk space available) on FC5 (which has MySQL 5, php, etc by default which are higher).  

if you do not even have access to mysqldump, then you can simply copy all the files from /var/lib/mysql/some_data_base and move it to the FC5 /var/lib/mysql.

change the ownership

chown mysql:mysql /var/lib/mysql/some_data_base -R
chmod 660 /var/lib/mysql/some_data_base -R

now you can do a simple "service mysqld start" and get going with the database.  

html, php, cgi files can be a simple copy paste or a download again through ftp.

take your pick.  but ask for some secure access.  you can even suggest to them that they can allow "putty" or some similar access where you would have send your key file for them to import into their key ring / known_hosts and still want a password for added security which should be a wise option to have.


please note that the mysql 5 version databases would be backward compatiable and you would necessarily have to run a mysqldump to take backup and restore from them.

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.