PDA

View Full Version : Moving server -> tar-commando's


Mas*Mind
Mon 24th Jul '00, 5:30am
I'm planning to move my server ASAP from pair to site5 and want to tar my old site with permissions and all that's in need to limit the work I have to do to make it work again...

Anyone who can give me the tar-commands to tar the whole bunch (with permissions and directory structure etc) and the commands to untar it again?

Thanks in advance :)

FamMan
Tue 25th Jul '00, 1:35am
tar cvf file.tar dir/file

gzip file.tar

you can use tar cvfo - the o is supposed to, according to the manpage, retain Ownership info. However, manpage also states that this is default for any user other than root, which I assume you are not.

to restore,

gunzip file.tar.gz

tar xvf file.tar

Mas*Mind
Tue 25th Jul '00, 2:21am
Thanks, I allready found it out...You may wanna use the p option too...the permissions are included then:

tar -cpPvzf bla.tar.gz /www

untar:

tar --same-permissions -xvzf bla.tar.gz

MattLight
Tue 25th Jul '00, 3:02am
Hi there!

Just a tip... if you can get your mySQL databases tarred up (the actual directories - usually located at in /var/lib/mysql/databasename), we would be happy to untar them on our servers and add them to your account. This saves you the trouble of trying to copy databases over.

have your host do the following:
tar -C /var/lib/mysql -zcf /your/doc/root/databasename.tar.gz databasename

If you are able to get these tarred up, simply upload them to your account and drop our tech support a line, we will do the rest.

We're looking forward to working with you!


Best Regards,
Matt Lightner
Site5 Tech Support
mlightner@site5.com


-------<added to post>-------

I should also note that the mysqldump method will also work fine for movnig your data. Use the syntax below:

On old server:
mysqldump -p -u[db_username] [databasename] > databasename.txt

On Site5 servers:
mysql -p -u[db_username] [databasename] < database.txt



[Edited by MattLight on 07-25-2000 at 02:18 AM]

eva2000
Tue 25th Jul '00, 4:53am
hi ya Matt... you probably don't remember me eva2000 from your site5 UBB forum a while back :D - the planned entertainment network guy who you referred me to a colocation provider ?

well i am on my own dedicated red hat linux server now - so are the above tar commands the same for a root user ?

i have done 3 mysqldumps on my vbulletin database and now need to compress them....

what's the commands from telnet if i log in as root ?

MattLight
Tue 25th Jul '00, 5:10am
Actually, I do remember you. You're George right?

How are you doing? Did you end up at Maxim? I would love to hear how that's working out for you!

Anyway, on to business :)

To compress your mysql dump files

do this (while logged in as root or a user with proper permissions):
gzip -9 filename.txt

where filename.txt is the name of your mysqldump file.
(note that it does not need to have a .txt extension)

You will then have the compressed mysql dump files. When you get them onto the new server, you will need to decompress them first by doing:

gzip -d filename.txt.gz

and then you put it into the database like so:
mysql -p -u[db_username] [databasename] < filename.txt

NOTE: If you're logged in as root and you have a config file located at ~/.my.cnf(or /root/.my.cnf) which specifies your mysql database password, then you can leave out the "-p -u[username]" part and simply enter:

mysql [databasename] < filename.txt

Hope that answers your question, if not please let me know! Also, if you would like me to show you how to setup your .my.cnf file so that you don't have to enter your mySQL password when you login, let me know. It's really really easy.


Best Regards,
Matt Lightner
Site5 Tech Support
mlightner@site5.com

eva2000
Tue 25th Jul '00, 5:34am
you remembered correctly, yep it's me:D

hi ya Matt http://www.animeboards.net/forums/images/smilies/wavey.gif

I corresponded with Maxim and the bandwidth pricing is excellent (my main concern after admin ease), but i don't know a thing about admin for a server and their support rates are expensive for setting up stuff i.e. US$200 for setting up a domain and stuff

I decided to go with Rackspace.com for a linux server running a webmin control panel (currently i have 11 of my sites on the server with more to come) - i am learning alot and once i get some admin knowledge under my belt, my 2nd server will be with Maxim :D

i dump to a filename.sql file, so this command for compressing would be

gzip -9 filename.sql
then ?

and uncompressing

gzip -d filename.sql.gz ?

what if i need to specify a directory location ?

cause i dump my filename.sql to the directory named 'sql'
i.e.
/home/usr/htdocs/sql

MattLight
Tue 25th Jul '00, 5:52am
Yep!

You can replace the filename.txt with a relative path or an absolute path.. If you want to decompress to a certain filename, you can do this..

gzip -dc filename.txt.gz > /home/usr/htdocs/sql/filename.sql

and that will decompress it to the specified path instead.


Just a side note: You might want to check out Site5's dedicated server plans. They were just released, and come with a bunch of control panel features, a full-featured server manager and of course.. help from our *friendly* system administrators when you need it ;)


Best Regards,
Matt Lightner
Site5 Tech Support
mlightner@site5.com