| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
02-05-2010, 09:28 PM
|
#1
|
|
Member
Registered: Dec 2009
Posts: 59
Rep:
|
USB enclosure MySQL data dump and file access
Operating System: CentOS 5
Processor: Intel Pentium 4 - 3.0 GHz
RAM: 1 GB
Total Disk Space: 120 GB
RAID: None
Bandwidth Quota: 500 GB
My server recently crashed and now I'm reprovisioning a new hard drive.
I paid the 150 USD to have a USB enclosure of the old hard drive.
How do I perform the following?
Export mysql from the websites on the hard drive?
EDIT: I found it.
EXPORT
Code:
# mysqldump -u username -ppassword database_name > FILE.sql
IMPORT
Code:
# mysql -u username -ppassword database_name < FILE.sql
BUT Where does this stuff get exported to?
How do I move it from the old hard drive to the new one?
So far I understand I have to mount the hard drive on to my new hard drive.
Code:
mkdir /olddrive
mount /dev/sdb3 /olddrive
I can use all the help if anyone has some free hanging around and helping time.
I figure if I can get help with the first website the other 8 will be no problem...
Last edited by bbrian017; 02-06-2010 at 09:14 AM.
Reason: added server specs!
|
|
|
|
02-06-2010, 09:52 AM
|
#2
|
|
Member
Registered: Dec 2009
Posts: 59
Original Poster
Rep:
|
I managed to successfully mount the hard drive and visit it's /home/ root
Please see attachment.
Questions
Am I looking at the sql data or physical files such as html, tpl, and php?
If it's SQL Data how do I see the physical files such as html, tpl, and php?
If it's the physical files such as html, tpl, and php how do I see the sql data?
I ran this,
# mysqldump -u username -ppassword database_name > blogengage.sql
It seem to have worked but I'm not sure where it put blogengage.sql
Thanks,
Brian
|
|
|
|
02-06-2010, 10:03 AM
|
#3
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
All those files listed in blue are probably directories.
If you have lost blogengage.sql then you can use locate to find it. First update the database, then use the command, like this:
As root:
Code:
updatedb # wait a while then, when the prompt comes back:
locate blogengage.sql
It'll tell you where it is.
If you are sure it is on the olddrive then you could just
Code:
find /path/to/olddrive -name blogengage.sql
and it'll print the path to the file, if it exists, otherwise, nothing happens.
|
|
|
1 members found this post helpful.
|
02-06-2010, 10:45 AM
|
#4
|
|
Member
Registered: Dec 2009
Posts: 59
Original Poster
Rep:
|
Thanks so much for the help tredegar
I have successfully managed to import the old hard drives sql files into my new linux server. (8 more websites to go lol)
Now I could really use some help with moving the physical files from the old drive to the new drive.
Any advice?
|
|
|
|
02-06-2010, 10:51 AM
|
#5
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
Quote:
|
Now I could really use some help with moving the physical files from the old drive to the new drive.
|
You are joking? Use the co py command:
Code:
cp /path/to/source /path/to/destination
cp has lots of options, depending if you want to preserve permissions, timestamps etc.
Code:
cp -a /path/to/source/* /path/to/destination/
is an option I find useful.
man cp for all the gory details
Don't delete any files until you are sure you have done it all correctly (which means use cp not mv or rm !)
|
|
|
1 members found this post helpful.
|
02-06-2010, 11:08 AM
|
#6
|
|
Member
Registered: Dec 2009
Posts: 59
Original Poster
Rep:
|
I'm sorry I really am an extreme noob! I thank you for helping because Google search is full of unrelated content. Much black hat seo!
When I do the command
Code:
cp olddrive/home/root/blogengagenew home/root/blogengage
I'm getting
Code:
cp: cannot stat `/olddrive/home/root/blogengagenew': No such file or directory
How can I find the actual location of my files in blogengage
I thought it would had been cp olddrive/home/root/blogengagenew
or maybe even olddrive/home/root/public_html/blogengagenew
Thanks,
Brian
Last edited by bbrian017; 02-06-2010 at 11:18 AM.
|
|
|
|
02-06-2010, 11:20 AM
|
#7
|
|
Moderator
Registered: Aug 2002
Posts: 10,704
|
I assume you installed CentOS from scratch on the new drive and want to move the old data form the USB drive to the new one. Unless your booting from the old drive mysqldump is not going to dump the correct data. The default data location is /usr/local/mysql/var/. I am not real familiar with mysql but assuming your old system was kept updated you might be able to get away with copying the data and configuration files.
FYI. mysqldump exports a database by generating SQL commands i.e. create, insert. It is a plain text file.
home should contain all your users home directories. CentOS default html directory is /var/www/html which is also where the rest of your files are probably located. What web application are you running?
|
|
|
1 members found this post helpful.
|
02-06-2010, 11:23 AM
|
#8
|
|
Member
Registered: Dec 2009
Posts: 59
Original Poster
Rep:
|
Yes I'm trying to change the path of the old php and tpl files to the new hard drive!
I think my web application is simple control panel or do you mean SSH?
Thanks for the insight by the way.
EDIT:
When I'm in var/www/html/ I use LS and it's not showing anything...
Last edited by bbrian017; 02-06-2010 at 11:32 AM.
|
|
|
|
02-06-2010, 11:43 AM
|
#9
|
|
Moderator
Registered: Aug 2002
Posts: 10,704
|
I assume you are running cpanel.
|
|
|
|
02-06-2010, 11:47 AM
|
#10
|
|
Member
Registered: Dec 2009
Posts: 59
Original Poster
Rep:
|
It's called simple control panel from godaddy! It's very basic! Most of everything still has to be done using SSH.
Right now I'm trying to find the actually html, tpl and php files on my old drive so I can change it's location to my new hard drive.
Code:
cp olddrive/home/root/public_html/blogengagenew home/root/public_html/blogengage
Code:
cp olddrive/var/www/html/blogengagenew /var/www/html/public_html/blogengage
So far I only got this message,
Code:
cp: cannot stat `/olddrive/home/root/blogengagenew': No such file or directory
Last edited by bbrian017; 02-06-2010 at 11:50 AM.
|
|
|
|
02-06-2010, 11:51 AM
|
#11
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
Missposted
|
|
|
|
02-06-2010, 12:10 PM
|
#12
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
Sorry about post #11, I hit return and the unfinished post got uploaded by accident. [Mistakes can happen, see below].
I think you are getting lost because you do not know any basic bash commands, and you do not know your way around the filesystem.
You are in a very dangerous situation:
- You are running as root (one tiny typo and all your data can be gone!)
- You do not know what you are doing 
- In a situation like this it is very very easy to make a complete mess of things, from which you cannot recover
If these databases and websites are valuable or important to you, I suggest you get a professional to help you, or have very good backups and you are confident you know how to restore from them.
For example, if your USB drive holds all your website & database data, it would have been a very good idea, when you mounted it, to mount it as "Read Only" - That way it is much more difficult to delete your data before it has been safely copied over.
I also fear you are about to run, at full speed, into a shedload of problems with UIDs, GIDs, ownerships and permissions.
Please, get help.
[Where did this system come from? I very much doubt you installed it. I mean this nicely, as perhaps the person who installed it can help you out].
|
|
|
1 members found this post helpful.
|
02-06-2010, 12:11 PM
|
#13
|
|
Member
Registered: Dec 2009
Posts: 59
Original Poster
Rep:
|
Perhaps the files are not there.
I use this,
I can see all my directories!
For some reason I can enter some and I cannot enter others.
If I try to enter my blogengage one
Code:
/olddrive/home/blogengagenew
Code:
-bash: cd: /olddrive/home/blogengagenew: Not a directory
But as mentioned if I got into another directory.
Code:
/olddrive/home/blogserp
When I use ls I see cert and public_html
Why can I not access some of the directories?
|
|
|
|
02-06-2010, 01:01 PM
|
#14
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
Quote:
|
Why can I not access some of the directories?
|
Did you read my post at #12 ? You did not answer any of my questions.
This is a case of
Quote:
|
I also fear you are about to run, at full speed, into a shedload of problems with UIDs, GIDs, ownerships and permissions.
|
So, as I said, please get help.
|
|
|
|
02-06-2010, 01:02 PM
|
#15
|
|
Member
Registered: Dec 2009
Posts: 59
Original Poster
Rep:
|
Alright I cannot seen to actually find the blogengage directory.
If I do the command
Does this mean I don't have the directory?
It turns out the blogengagenew in the attachment above is actually a file and contains rsa keys. I don't know what that is about! I cannot seen to locate my blogengage files.
@tredegar sorry I don't answer your questions it's pretty hectic in my pc chair right now lol
Godaddy is the company that installed my new server.
The odd thing is the folder structure should be the same for all websites.
They were all installed in a home/foldername/public_html
Some are directories some are not it's so strange for me!
Last edited by bbrian017; 06-05-2010 at 12:20 PM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:33 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|