WebFaction
Community site: login faq

I had a question and info to offer people with a django or other project and how to copy that locally for backup. Don't panic webfaction makes backups for you but I just think you can't have too many backups.

I had tried to use Cyberduck, a rather common ftp client for the mac to download a django project i have on WF.

My project/site sits at /home/myusername/webapps/mywebsite on a webfaction server.

This process, as the more experienced would know, takes a long time with GUI ftp client to scan your whole source directory(folder) before beginning a copy on each file, down to your local computer. Think maybe about 15+ minutes? So cancelling that, I tried to zip the whole directory to a file but this can't be done to the same webapps directory. It complains zip I/O error: Permission denied so I just modified the process to save the archive to the home directory (~)

How to use zip on a folder.

zip -9 -r <zip file> <folder name>

From home folder this is what i did.

cd ~/webapps
zip -9 -r ~/sitebackup.zip mywebsite

You can then use whatever ftp style tool you so choose, to download this whole project as a single file to your local computer. Much faster.

You could I guess, alternatively use gzip, tar or 7za, but zip was available by default, and was convenient for me. Guru's might like to post alternative ways to do this.

I guess for a test site, a real guru would just use mercurial(hg) and push the contents locally to WF?

http://blog.enrii.com/2007/05/31/zip-a-folder-in-linux/

asked 11 Apr '11, 01:02

unclechris
112
accept rate: 0%


I prefer to make a full backup of a directory using something like this:

tar -czf ./backup.tar.gz . --exclude ./backup.tar.gz

This creates a new archive named "backup.tar.gz" in the current directory, which contains everything in that directory (including hidden files).

It also doesn't require write access to a parent directory, which means that you can use this method to backup your entire home directory:

cd $HOME
tar -czf ./backup.tar.gz . --exclude ./backup.tar.gz

Before doing the tar backup command, you might want to make backups of your databases (which aren't in your home directory) using this method:

http://docs.webfaction.com/user-guide/databases.html#import-and-export-database-records

Which will then create a database dump file inside of the current directory that can then be included in the compressed archive along with everything else.

Note that Windows tools like 7zip are able to extract tar.gz files.

> "I guess for a test site, a real guru would just use mercurial(hg) and push the contents locally to WF?"

Using a repository to manage an application is strongly encouraged. Having the entire revision history at your fingertips makes tracking down bugs a lot easier.

I personally prefer git, and use the method described here to manage my own applications:

http://community.webfaction.com/questions/1246/using-git-with-applications

permanent link

answered 11 Apr '11, 01:19

ryans ♦♦
5.0k103860
accept rate: 43%

edited 11 Apr '11, 01:26

FYI: I tried the "tar -czf ./backup.tar.gz . --exclude ./backup.tar.gz" solution with my ~2GB account. I stopped it once the archive was around 3.2GB.

I was hoping for a file smaller than the account to begin with, but I'm not sure why the backup became so large. From what I can gather tar is not supposed to treat symlinks as normal files/folders by default. I realize archives can have some overhead with many small files, but this seems like more than that.

I did not wait to see how large the file would get. Did not want ot be a drain on the server or anything. I will just delete it and consider the backup of higher priority directories until I can figure something else out.

permanent link

answered 04 Sep '11, 16:50

Mick
1911
accept rate: 0%

edited 04 Sep '11, 16:51

It looks like it got caught in a loop on your backup file. I've used a command like the following, maybe give that a try:

nice tar cCpfj ~/ ~/backup/<username>.tar.bz2 --exclude-from ./exclude-list.txt ~/ 2>> /dev/null

You can always change the --exclude-from to --exclude=backup.tar.bz2

(04 Sep '11, 18:51) bmeyer71 ♦♦

FYI: I tried the following today. Nothing happened. I tried changing cCpfj to -cCpfj. Still nothing. I am going into town later today, would be a good time to download a backup over city lines.

nice tar cCpfj ~/ ~/backup/username.tar.bz2 --exclude=username.tar.bz2 ~/ 2>> /dev/null

(24 Sep '11, 14:59) Mick

Try using just:

nice tar cCpfj ~/ ~/backup/username.tar.bz2 --exclude=username.tar.bz2* ~/

to see what errors you get.

(24 Sep '11, 15:03) bmeyer71 ♦♦

Well "mkdir backup" was required.

I see these two errors more or less once each while it works:

tar: Removing leading /' from member names tar: Removing leading/' from hard link targets

I stopped it around 2.8GB this time. That seems too large. Seemed like it was doing the same thing as before.

(24 Sep '11, 17:28) Mick

Yes you need to run "mkdir backup" to create the directory first. I had assumed that you already had that directory. Sorry, I missed the * at the end of the exclude statement. I updated the command to reflect that now. You don't need to worry about the tar: Removing leading /, messages.

(24 Sep '11, 17:57) bmeyer71 ♦♦

Hi Mick - after you create the backup directory, try running tar like this:

nice tar vcCpfj ~/ ~/backup/username.tar.bz2 --exclude=username.tar.bz2* ~/

I'm thinking that the inclusion of the -v option might give you some clue as to what's causing it to bloat (I'm thinking maybe a recursive link somewhere).

(24 Sep '11, 18:19) seanf
showing 5 of 6 show 1 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×36
×1

question asked: 11 Apr '11, 01:02

question was seen: 8,848 times

last updated: 24 Sep '11, 18:24

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM