vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   moving form to a new server/webhost (https://vborg.vbsupport.ru/showthread.php?t=172597)

webspawner 03-10-2008 10:20 AM

moving form to a new server/webhost
 
I searched these forums but could not find the answer:

I need to know if moving server would be a straight swap for the forums.

In other words, is it as simple as backing up the sql database and files from FTP (forum has already been installed obviously) and then just restoring them in the new database, reuploading the config and altering the database information and script paths in config?

Is it as simple as that? What about permissions?

Are permissions automatically set when installed or can I re-CHMOD these files/directories?

Please help,

Thanks,

Marco van Herwaarden 03-10-2008 10:29 AM

Moving Servers

snakes1100 03-10-2008 10:30 AM

The permissions should stay the same, depending on how they was backed up, most host panels will retain the correct permissions for the file structure.

To answer your question though, it is as you asked, dump the db, tar/zip everything up, un tar/zip on the new host, dump the db into the new db, edit the config file for the db info and you should be all set.

If you manually tar the files up, use the -p switch to retain file permissions if it doesnt do it for you automatically.

tar -czfp - tar.gz
tar -cjfp - tar.bz2

webspawner 03-10-2008 10:44 AM

I was going to backup via FTP (just downloading the files)

Do you think so logging in via ssh would be the best way to go?

What would be the full command to zip them via SSH to retain the permissions?

any idea's?

Cheers,

snakes1100 03-10-2008 12:32 PM

Backing up thru ssh would be a lot faster for you, also as you have ssh access, you can simply ftp thru ssh and send the files directly to the new server.

As far as ssh commands go, if you do not know ssh commands very well, the tar commands might not help you much if you do not know how to use the rest of hte ssh commands, like cd'ing to the right directories etc

tar -cjfp directory-name.bz2 /path/to/directory

That will compress the entire directory for you, so yo ucan tar the entire public_html in one shot.

webspawner 03-10-2008 01:37 PM

Thanks, and that command retains the correct file permissions?

So I should do that, then download the tar'd file with FTP and then reupload the tar'd file to new server.

How would I then extract this?

Thanks for your help!

snakes1100 03-10-2008 02:32 PM

In ssh type tar --help

c = compress
x = uncompress
p = retain file permissions

In ssh, type ftp ipaddy and hit return on the keyboard, enter the login info and hit return, then do the following

bin
put
local filename = filename u tar'd
remote filename = same name as above

and it will ftp everything for you server to server, no need to dl it and then re-upload it.

webspawner 03-18-2008 11:41 PM

I cd to the htdocs and type in:

[domainXXXXXX@ssh-server htdocs]$ tar -cjfp sitebackup.bz2 /full/path/to/folder/htdocs
tar: sitebackup.bz2: Cannot stat: No such file or directory
tar: Removing leading `/' from member names
tar: /full/path/to/folder/htdocs/p: file changed as we read it
tar: Error exit delayed from previous errors

Any idea's why this is happening :S

could I try anything else?

I have my database backed up (and did that via ssh- im not a noob with it but unsure what to try next)

any idea?s

thanks

PS: also when i do the command:

tar -cjfp backup.bz2

It returns as though it has been successful and when I check files in htdocs it is there but at 0kb

Dismounted 03-19-2008 05:22 AM

Goto a temporary backup directory (not in htdocs!) and type this command:
Code:

tar -cvzf sitebackup.tar.gz /path/to/htdocs

snakes1100 03-19-2008 06:24 AM

This error is why you cant back it up:

tar: /full/path/to/folder/htdocs/p: file changed as we read it

I would guess your in a directory or in the same and you have something there that is writting to a file as your try and compress everything, you will need to use an exclude switch in the command to exclude it.

The command you used is fine, there is no need to change to tar.gz as bz2 will do better compression and still use the p in the command to force it to keep the permissions/ownership intact.

Marco van Herwaarden 03-19-2008 08:12 AM

tar -cjfp sitebackup.bz2 /full/path/to/folder/htdocs

that this line does not work makes sense.

f = filename
p = Preserve (only usefull on a restore!)

by using "-cjfp " you are telling the tar command that it should out put a file (because of the f-flag) and that the name of that file is 'p' (the string immediately following the f-flag).

PS I suggest you do not tar a fullpath, but rather a relative path, as this will make restoring to a different location much easier.

Use:

cd /full/path/to/folder/htdocs
tar -cvzf sitebackup.tar.gz . <-- Use this if your forum is in the root of htdocs
or:
tar -cvzf sitebackup.tar.gz ./forum <-- Use this if your forum is in the 'forum' subdirectory of htdocs

Dismounted 03-19-2008 08:32 AM

I use this command as part of my backup cronjobs:
Code:

tar -czf /home/user/backups/data-`date --iso-8601`.tar.gz -C /home/user htdocs vbalbumpic vbattach
I may get around to releasing the whole code (which automatically deletes backups older than X days).

snakes1100 03-19-2008 08:53 AM

-f, --file=ARCHIVE - this is telling it to use the file/archive name you are giving in the command, so how does that not make sense to you marco?

-p - it doesnt matter if you use it while compressing or uncompressing, it just preserves the ownership/permissions and will do no harm if its there while compressing

if you want to delete backups older than 5/10/15/20/25/30 days, you can simply use this in your cron job, simply change the number after the + in the command below.

cd /$backupdir

find /$backupdir -atime +30 -exec rm -rf {} \;

You can place that that the end of your cron file for backups

Marco van Herwaarden 03-19-2008 09:13 AM

Quote:

Originally Posted by snakes1100 (Post 1468535)
-f, --file=ARCHIVE - this is telling it to use the file/archive name you are giving in the command, so how does that not make sense to you marco?

Where did i say that using the f-flag doesn't make sense? I only commented on the fact that the p-flag was following the f-flag, making 'p' the filename to use.

Quote:

Originally Posted by snakes1100 (Post 1468535)
-p - it doesnt matter if you use it while compressing or uncompressing, it just preserves the ownership/permissions and will do no harm if its there while compressing

The p-flag does not do anything when creating the archive. In the best situation it is ingnored, worse case the command will return an error (depending on the distribution/implementation)

snakes1100 03-19-2008 09:34 AM

I never said it did anything while creating a archive, as long as it isnt at the end as he did it, its fine, just like the v switch isnt needed in the command.

webspawner 03-19-2008 10:28 AM

When I try tar -cvzf sitebackup.tar.gz .

it tars all file/folders into a folder called ./htdocs/contents

I need to just extract to /contents *** (as the new host has a public_html not htdocs)

So if i opened the new tar'd file I would just see the contents.

When im in htdocs and i try tar -cvzf sitebackuphtdocs.tar.gz

i get
tar: Cowardly refusing to create an empty archive

What is the command for this because when I try tar -cvzf sitebackup.tar.gz full/path/to/folder/htdocs

when i open the archive i get full/path/to/folder/htdocs/contents**

and when im in the htdocs and do tar -cvzf sitebackup.tar.gz

Marco van Herwaarden 03-19-2008 10:31 AM

Quote:

When im in htdocs and i try tar -cvzf sitebackuphtdocs.tar.gz
You forgot the period (.) at the end.

webspawner 03-19-2008 08:52 PM

I tried again (with period)

tar -cvzf sitesfiles.tar.gz .

and it went through the list of files/folders that it was tar'ing but the last lines were:

./sitesfiles.tar.gz
tar: ./sitesfiles.tar.gz: file changed as we read it

That appears to of TAR'd/zipped it still but when i open the TAR'd file (when downloaded) I have to click the directory
' . '(period) before seeing the contents

I wants the contents to be listed as soon as the TAR folder is opened

Any idea's? and do the few lines mentioned above after matter? f(ile changed as we read it)

thanks,

snakes1100 03-19-2008 09:50 PM

As i posted before, you have a file thats being wrote to while your tar'ing the htdocs folder, do you have logs files or stats files in there?

If so you need to stop the program that is writing to the file or use the --exclude switch in the tar command.

webspawner 03-19-2008 09:52 PM

Thanks for your help.

Could you please provide me with a full command and tell me where to try it from

maybe the directory before htdocs?

could you give me full command?

Also I wants the TAR'd file to display the contents of htdocs not a folder then contents.

thanks in advance

PS is there also a way to retain permissions - the previous command you gave me didnt work.

snakes1100 03-19-2008 10:15 PM

If your taring the htdocs folder, then there is a sub folder or file within the htdocs folder that is being written to by another program on the server and therefore is changing while tar is trying to compress the htdocs directory.

tar --help

/var/www/localhost/htdocs <-- typical path

cd /var/www/localhost

tar -cjf htdocs.tar.bz2 htdocs/

That will tar the entire htdocs directory and everything in it.

As i said, if there is a file being wrote to while its taring then its going to spit out the error again and say something changed while reading it. You will need to use the exclude switch in the tar command

Marco van Herwaarden 03-20-2008 08:08 AM

You are creating a backup to a file and you place that file in the directory that your are archiving. The file that is "changing" is the backup file itself.


All times are GMT. The time now is 09:21 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01077 seconds
  • Memory Usage 1,783KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete