Debian Tutorials Copy/Paste tutorials for Debian based Linux distros

15Oct/096

Automated backups to FTP server using rsync and curlftpfs

Using curlftpfs and FUSE, a ftp site is mapped to the local file system and rsync will backup files to the ftp server automatically.

1. Install required packages

apt-get install curlftpfs rsync

2. Create directory to mount the ftp site

mkdir /mnt/ftpbackup

3. Add the curlftpfs mount into fstab to make it mount everytime the system is started (pico /etc/fstab)

curlftpfs#{username}:{password}@{host} /mnt/ftpbackup fuse rw,allow_other,uid={userid} 0 0

{username} = FTP username
{password} = FTP password
{host} = FTP host/ip
{userid} = ID of a local user (ex. 1001)

4. Mount the ftp site

mount /mnt/ftpbackup

5. Backup using rsync

rsync -avz --no-owner --no-group /var/www /mnt/ftpbackup

All files in the /var/www folder will be synced to the remote machine into a folder named backup

6. Automate the backup using cron (crontab -e)

0 3 * * * rsync -az --no-owner --no-group /var/www /mnt/ftpbackup >> /dev/null 2>&1

Your /var/www will be synced to the remote machine at 3am every day

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • Technorati
  • email
  • Live
  • Slashdot
  • LinkedIn
  • Print
  • Tumblr
  • Twitter
  • Netvibes
  • Netvouz
  • PDF
  • Yahoo! Bookmarks
Comments (6) Trackbacks (0)
  1. I am getting an error like
    rsync: mkstemp “/mnt/ftp_backup/backup/Documents/myfile.eqU6Y0″ failed: Operation not supported (95)

  2. Does not seem to be possible with curlftpfs 0.9.2, since buffered writing
    has been turned off. A lot of tools fail now (rsync, tiobench, iozone, etc.) The project seems to be abandoned :-(

  3. Is it necessary to close the connection after the server has stored the data?
    With “mount / mnt / ftpbackup”?

    Thx

  4. Sorry, with “umount / mnt / ftpbackup” ??

  5. No matter what I tried, this is unable to work on files over 1gb in size.

  6. Great, all my data are in safe now .)


Leave a comment


No trackbacks yet.