Portal Home > Knowledgebase > Articles Database > Retrieve data from 2nd HDD after server failed


Retrieve data from 2nd HDD after server failed




Posted by khoking, 02-03-2008, 08:32 AM
My server HDD got corrupted. My server provider mount a new HDD for me, and put the OLD HDD as secondary drive. This is what they emailed me: [root@ns1 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda3 149G 3.7G 138G 3% / /dev/hda1 99M 17M 77M 19% /boot none 498M 0 498M 0% /dev/shm /usr/tmpDSK 485M 13M 447M 3% /tmp /tmp 485M 13M 447M 3% /var/tmp /dev/hdc3 149G 23G 119G 16% /backup I have a forum data (files and database) that is still on the old HDD, I hope to retrieve it. May I know how can I access to the data? I tried SSH, can only go till /dev/, then don't know what to do. What is the command in SSH that I should type in order to go to the 2nd HDD? How can I retrieve the database and files to my new HDD? Please advice, really appreciate it. Many thanks in advance.

Posted by bear, 02-03-2008, 08:42 AM
mount /backup If you get an error saying it's already mounted: cd /backup Locate the backup files. mv ./backup* /home Then restore.

Posted by sbray, 02-03-2008, 08:43 AM
Looks like someone beat me to it, so I'm changing my answer, since it looks like the simple code has been provided. I say, always ask your provider first. Even when you think the solution may cost you money, most providers will provide simple INFO like this just to show you they appreciate you as a client and are real human beings who care. Last edited by sbray; 02-03-2008 at 08:49 AM.

Posted by khoking, 02-04-2008, 01:11 AM
Thanks bear! Really appreciate it! My server is with layeredtech...it is an unmanaged server, so they don't help me with restoring backup stuff... I got another question. I have managed to located the files of my previous domain now (eg. /backup/home/username01/) However, how do I retrieve the database? I only have experience via phpAdmin in database configuration, I don't know exactly how and where to backup or now restore the database of my username01 above.

Posted by Kaumil, 02-04-2008, 06:03 AM
If this is a cPanel server, you should be able to get the mySQL databases from /var/lib/mysql/yourusername_dbname

Posted by khoking, 02-04-2008, 06:29 AM
Hi VP-Kaumil, Thank you very much! Managed to copy the database. Regarding SSH command, what should I type if I want to copy everything in a directory (including subdirectories and files) to a new location? I tried (I am in the backup directory already): cp *.* /home/capkkk/public_html/ but it only copy the files, not the directories inside it.

Posted by khoking, 02-04-2008, 06:34 AM
Nevermind, I found the command: cp -av * /home/capkkk/public_html/ Another question. I have moved the database folder (not a zip file) to my new domain directory, how do I restore the database from the folder?

Posted by next-hop, 02-04-2008, 11:14 AM
You need to copy your databases from the backup folder to the /var/lib/mysql directory on the new drive. Once you do that do a : ls -la and make sure the owner and group are both belonging to mysql and not root. If they are root use the commands chown and chgrp to change the permission.

Posted by sirius, 02-04-2008, 11:44 AM
Moved to Technical and Security Issues.... Sirius

Posted by david510, 02-05-2008, 04:24 AM
Once you create the database, the folder /var/lib/mysql/dbname/ will be formed. Copy the contents from /home/capkkk/public_html/dbname/ to the new folder. Give necessary privileges to the database user from the control panel or from shell as follows. Type mysql to get into mysql prompt. mysql> grant all privileges on dbname.* to dbuser@localhost identified by 'password';



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read