LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   changing faulty hard drive (https://www.linuxquestions.org/questions/linux-hardware-18/changing-faulty-hard-drive-873732/)

dime111 04-08-2011 03:59 AM

changing faulty hard drive
 
Hello
our problem is as follow
our main sata hard drive on server has started to fail so we need to change it with new hard drive before any real damage
i dont have such a experience on how we can do this
the OS ( centos) and all installed services (apache + mysql + php ) and all our virtual host and domains ( using whm /cpanel ) are on this faulty hard drive
also i dont have physical access to server and use SSH and whm to manage server
so how should this faulty hard drive be changed and all data be transfered to the new hard drive correctly so the system boot from new hard drive with all content in place ?
i have not done such a thing and im really confused
regards

corp769 04-08-2011 04:02 AM

Quote:

Originally Posted by dime111 (Post 4317822)
also i dont have physical access to server and use SSH and whm to manage server

Hold on a minute.... So you don't have physical access to the server, yet you are trying to change the hard drive? This makes no sense.... Unless you are saying that someone else is going to change it out, correct?

dime111 04-08-2011 04:12 AM

Hello
Yes data center will plug new hard drive
I just totally do not know what to do next
Thank you

corp769 04-08-2011 04:19 AM

Ahh ok, got ya. Do you have a RAID setup? I really hope so.... :)

dime111 04-08-2011 04:23 AM

unfortunately no
only two 750 gig hard drives
the main one (which is faulty now ) and second one for whm/cpanel backups

corp769 04-08-2011 04:26 AM

Well then I suggest to back up as much data you can from the hard drive and then have it replaced. You should really set up RAID next time so you don't have to worry about constantly backing up and worrying all the time....

dime111 04-08-2011 04:30 AM

Yes i should have raid them this time
But my main question remains how to restore full structure of faulty drive with on new one ?
boot , OS and so on
Thanks

corp769 04-08-2011 04:33 AM

Well first of all, how badly damaged is the hard drive? Can you recover anything from it? I can't really help you restore your data if you can't access it....

dime111 04-08-2011 04:43 AM

Yes data is fully accessible in fact the drive is still working
but i can see in logs that it has started to throw I/O errors

corp769 04-08-2011 04:47 AM

Oh ok, well in that case, you could use dd to create an exact clone of the data that is still accessible and go from there. I use dd a lot when it comes to creating clones - http://linux.die.net/man/1/dd

dime111 04-08-2011 04:53 AM

Thanks
So basically i need to format new hard drive and create partitions ?
Sorry but i did not get how DD work to clone whole hard drive which is as follow (having to partitions)
What should the command be ?
Also will it take care of boot info ? and will boot the system from new hard or i need other changes too ?

/dev/sda3 688G 206G 448G 32% /
/dev/sda2 2.0G 86M 1.9G 5% /boot

Latios 04-08-2011 04:57 AM

Buy the new drive

Partition and format it similar to the original drive (you can make partitions of different size than the original, just be sure that the amount of data from each partition in the origina drive + expected extra fits in the new one)

Boot the server from a live disk or take the original drive to another computer

Copy with cp -pR the contents of each partition

Fix /etc/fstab and /boot/grub/menu.lst if needed

Install grub on the new drive. In grub 1 (not grub 2) its

Code:

grub-install --root-directory=[where the root partition of the new drive is mounted in the live system]
if you use separate /boot then it must be mounted too before you run this

Put the drive back and test




Notice that not all IO failures are caused by the drive. Test the sata cable, computer and baord for excess dirt, bad capacitors and bad power supply

dime111 04-08-2011 05:02 AM

Thanks
But as i said i dont have physical access to server
This is making things harder for me

Latios 04-08-2011 06:44 AM

If you can be root on the system, close all the server tasks and backup the other partitions

The running OS cannot (maybe can but gonna be a trouble) be completely backed up from within itself. You must boot another OS to backup the first one when it is not running. You can ask the techs that have physical access to boot a live usb / cd and open ssh for you (with all needed protections : firewall + custom root password + etc)

Next time install a dual boot with 2 OSes (one main and one small with just some tools and ssh). This way you'll be able to reboot between them to backup each

beowulfnode 04-10-2011 11:28 PM

Are the datacenter people just adding a 3rd drive to the system? or are they replacing the original failing drive leaving a maximum of 2 disks?

If you are getting a 3rd drive you could possibly convert to raid 1 with the new drive. There are various instructions for how to do this such as https://wiki.archlinux.org/index.php...system_to_RAID. Then have them replace the failing drive.

If there can only be 2 disks in the system at once and you don't want to have them take the backup drive out temporarily you will likely have to use the backup and restore features.


All times are GMT -5. The time now is 01:33 PM.