How I copied DA

Dixiesys

Verified User
Joined
Aug 2, 2003
Messages
137
Location
The South
Had a harddrive die yesterday but I had a mirror copy of the data (linux raid-1 and 2 drives) but for whatever reason (likely corrupted /boot partition thanks to drive 1 dying) it wouldn't boot off this drive.

So I put in 2 new drives, setup a new mirror installed RH9 and directadmin as if for a new server then I put the "good" mirror in and mounted the / partition to /olddrive

Then this is exactly what I did to copy DA and all use files and databases from olddrive to the new drive:

Code:
service mysqld stop
service httpd stop
service named stop
service crond stop
service xinetd stop
service exim stop
service vm-pop3d stop
service proftpd stop
service directadmin stop

cp -vp /olddrive/etc/passwd /etc/
cp -vp /olddrive/etc/shadow /etc/
cp -vp /olddrive/etc/group /etc/
cp -vp /olddrive/etc/gshadow /etc/
cp -vpr /olddrive/home/* /home/
cp -vp /olddrive/etc/exim.conf /etc/
cp -vp /olddrive/etc/exim.pl /etc/
cp -vp /olddrive/etc/system_filter.exim /etc/
cp -vp /olddrive/etc/exim.crt /etc/
cp -vp /olddrive/etc/exim.key /etc/
cp -vp /olddrive/etc/proftpd.conf /etc/
cp -vp /olddrive/etc/proftpd.vhosts.conf /etc/
cp -vp /olddrive/etc/proftpd.passwd /etc/
cp -vp /olddrive/etc/hosts /etc/
cp -vp /olddrive/etc/resolv.conf /etc/
cp -vp /olddrive/etc/named.conf /etc/
cp -vpr /olddrive/etc/virtual/* /etc/virtual/
cp -vpr /olddrive/etc/httpd/* /etc/httpd/
cp -vpr /olddrive/var/named/* /var/named/
cp -vpr /olddrive/var/spool/virtual/* /var/spool/virtual/
cp -vpr /olddrive/var/spool/mail/* /var/spool/mail/
cp -vpr /olddrive/var/www/* /var/www/
cp -vpr /olddrive/var/log/* /var/log/
cp -vpr /olddrive/var/lib/mysql/* /var/lib/mysql/
cp -vpr /olddrive/usr/local/directadmin/* /usr/local/directadmin/


Then I rebooted. This has worked for me twice so far and I haven't had anybody report complaints so this seems to work pretty good.

Additionally if you wanted a quick and dirty backup of all the important data for DA change the cp commands above just a bit and you have a pretty decent simple backup script for the whole server.
 
good info.

I'm wondering, are your users' mySQL db copied over too? where are all these db stored?

in cp -vpr /olddrive/var/lib/mysql/* /var/lib/mysql/ ???
 
etegration said:
good info.

I'm wondering, are your users' mySQL db copied over too? where are all these db stored?

in cp -vpr /olddrive/var/lib/mysql/* /var/lib/mysql/ ???

Yep /var/lib/mysql/*

hence why you want to turn off mysql before you copy else you may end up with a buncha corrupted databases if you copy while it's active.
 
Dixiesys said:
Yep /var/lib/mysql/*

hence why you want to turn off mysql before you copy else you may end up with a buncha corrupted databases if you copy while it's active.

i've got a hdd corrupted and tried retreiving the databases from /var/lib/mysql

Why are the files stored in xxx.MYI, .MYD etc??? how to i import it back into regular mySQL databases???
 
etegration said:
i've got a hdd corrupted and tried retreiving the databases from /var/lib/mysql

Why are the files stored in xxx.MYI, .MYD etc??? how to i import it back into regular mySQL databases???


i figured just copying all those funny files back to /var/lib/mysql works! :D
 
Back
Top