HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=16)
-   -   Backup? (http://www.howtoforge.com/forums/showthread.php?t=1837)

ctroyp 27th December 2005 19:43

Backup?
 
I am in a bit of a unique situation with my server. I originally installed ISPConfig on my FC4 o/s, but eventually went to another drive using Debian as the o/s. Both of these drives are installed in a Dell Dimension 8200 and I need to detach the primary drive (FC4) so I can replace it with a larger drive that will be used as a image of the Debian drive which is running ISPConfig currently. The problem is, I have to make some changes to grub and some other files on the Debian hd because I cannot boot the Debian drive without the FC4 drive in place. ...strange issue, but I know how to fix it...

My question is, I need to copy any relevant data via ssh to another system. What files are necessary to copy in order to get ISPConfig, websites, mysql, and everything else running again? I have already copied many of the files from the hd, but I want to be sure I got all of the necessary ones.

Furthermore, in this particular situation, how would I begin the restore on a new drive? I am aware that using HA clusters are a good option as well as imaging over a network, but I don't think any of these would work for this specific issue. Okay, I'm sure someone could get it to work, but maybe not myself...:rolleyes:

Thanks in advance. I hope everyone had a Merry Christmas!

~~~edited~~~

Sorry, I forgot to include that I may be installing a new o/s (Mandriva). It will take the place of Debian. This should give more relevance to my post. The reason I may replace the o/s is due to the multiple issues I have had with postfix (http://www.howtoforge.com/forums/showthread.php?t=1234) and web_ftp (http://www.howtoforge.com/forums/showthread.php?t=1709). I am limited to < php5 (due to PHPBB limitations) on the o/s (not ISPConfig's php5) and Mandriva 2005 is one that installs php4x. Hope this all makes sense. It has been a very long road (several months) for me trying to get this server running so I can start hosting sites for others.

Special thanks to falko and till!

falko 27th December 2005 20:56

Quote:

Originally Posted by ctroyp
My question is, I need to copy any relevant data via ssh to another system. What files are necessary to copy in order to get ISPConfig, websites, mysql, and everything else running again? I have already copied many of the files from the hd, but I want to be sure I got all of the necessary ones.

http://www.howtoforge.com/forums/showthread.php?t=910

Also, you could make an image of your hard drive using SystemImager:
http://www.howtoforge.com/howto_linux_systemimager
http://www.howtoforge.com/dedicated_...e_systemimager

ctroyp 27th December 2005 21:31

Thanks falko!

Before I perform these steps:
Code:

This might give you an idea how to start:


Quote:
What is the best way to install an ISPConfig-Update?

Normally an ISPConfig-Update does not cause any problems. Since ISPConfig is installed on a multitude of different systems and because we have heard of sporadic problems with updates which we could not reproduce in spite of testing intensively, we publish some tips/hints here that should prevent a failed update to paralyse your system.

Please note: Placeholders are indicated by square brackets [ ].

1) First make a backup of your existing (working) ISPConfig installation:

Open a root shell (under Windows you can use PuTTY ( http://www.chiark.greenend.org.uk/~s.../download.html ) for this task).

cd /root/
tar -pczf root_ispconfig_old.tar.gz ispconfig/
cd /home/
tar -pczf home_admispconfig_old.tar.gz admispconfig/

If your MySQL database is protected by a password:

mysqldump -h [name of your server, e.g. localhost] -u [database user, e.g. root] -p[database password] -c --add-drop-table --add-locks --all --quick --lock-tables [name of the ISPConfig database] > existing_db.sql (no space character between -p and password!)

Otherwise:

mysqldump -h [name of your server, e.g. localhost] -u [database user, e.g. root] -c --add-drop-table --add-locks --all --quick --lock-tables [name of the ISPConfig database] > existing_db.sql

Save /etc/passwd, /etc/shadow and /etc/group.

Save /etc/init.d/ispconfig_server and (if existing) /etc/init.d/ispconfig_tcpserver.

You should transfer the files named above(existing_db.sql, /etc/passwd, /etc/shadow, /etc/group, /etc/init.d/ispconfig_server, /etc/init.d/ispconfig_tcpserver) to your workstation (e.g. with WinSCP: http://winscp.sourceforge.net/eng/ ).

2) Install the ISPConfig-Update (see here). Do not close your root shell immediately after the update (also do not close your WinSCP window)!

Open a second root shell and check if the root login still works! If it does not you can restore the root user in the root shell you have left open (e.g. by editing /etc/passwd and /etc/shadow or by playing back your backups of these two files via the open WinSCP window). Please take care that these files keep the same privileges as before!

3) Open the ISPConfig system in a browser and make a change (e.g. change a user's settings). After approx. 30 sec. you can check if the root login still works on the shell. If it does, you can undo the user settings change in the ISPConfig system and close all shells/WinSCP windows. Your ISPConfig update has been installed successfully!

4) If you realise with hindsight that the root login does not work on the shell you have the following possibilities to rescue your system (it is in no way necessary to format the system's hard disk and install a new system!):

4.1) If webmin ( http://www.webmin.com/ ) is installed as tar.gz (not rpm!), you can still login to webmin and fix the root user.

4.2) Boot your system from a Rescue-CD (e.g. http://sourceforge.net/projects/rescuecd/ ).

Login: root Password: rescue

Adjust your keyboard:

kbdmap

Mount the /-partition of your hard disk (mostly /dev/hda1):

mount -t [your filesystem, e.g. ext2|ext3|reiserfs|etc.] /dev/hda1 /mnt
chroot /mnt

Now you can find the passwd and shadow file under /etc and edit them in an editor (e.g. vi) or with programs like usermod. Repair your root user and reboot the system (do not forget ot remove the Rescue-CD from your CD-ROM):

shutdown -r now

4.3) If your server has a rescue mode (like the 1&1-Root-Server):

Boot your server into the rescue mode.

Mount the /-partition of your hard disk (mostly /dev/hda1):

mount -t [your filesystem, e.g. ext2|ext3|reiserfs|etc.] /dev/hda1 /mnt
chroot /mnt

Now you can find the passwd and shadow file under /etc and edit them in an editor (e.g. vi) or with programs like usermod. Repair your root user and reboot the system.

shutdown -r now

5) If you want to restore your old ISPConfig system, please do the following steps:

/etc/init.d/ispconfig_server stop
cd /root/
mv ispconfig/ ispconfig_new/
tar xvfz root_ispconfig_old.tar.gz
cd /home/
mv admispconfig/ admispconfig_new/
tar xvfz home_admispconfig_old.tar.gz

If your MySQL database is protected by a password:

mysql -h [name of your server, e.g. localhost] -u [database user, e.g. root] -p[database password] [name of the ISPConfig database] < existing_db.sql (no space character between -p and password!)

Otherwise:

mysql -h [name of your server, e.g. localhost] -u [database user, e.g. root] [name of the ISPConfig database] < existing_db.sql

Restore /etc/init.d/ispconfig_server (and /etc/init.d/ispconfig_tcpserver, where applicable) (e.g. by using WinSCP).

chmod 744 /etc/init.d/ispconfig_server
chmod 744 /etc/init.d/ispconfig_tcpserver (if existing)
/etc/init.d/ispconfig_server start 


BTW, I'd also backup the /etc folder, your Postfix configuration, your Apache configuration, the BIND configuration, ftp configuration and restore them on the new system.

I want to mention that I have already copied all of my directories from my hd to a remote (Windows) computer via WinSCP. I couldn't copy all of the files, but I got 99% and certainly the ISPConfig stuff and mysql backup scripts. Since I have done this already, is it necessary to follow your procedure or could I simply copy the files back to the new (Mandriva) server in the appropriate locations once I have it setup? I know that I wouldn't want to replace all of the files and directories, but which ones are absolutely necessary for ISPConfig, the websites, data, etc? Just the ones you mentioned in your instructions?

falko 27th December 2005 21:59

Quote:

Originally Posted by ctroyp
I want to mention that I have already copied all of my directories from my hd to a remote (Windows) computer via WinSCP. I couldn't copy all of the files, but I got 99% and certainly the ISPConfig stuff and mysql backup scripts.

But on Windows you lose all the information about the files' permissions and ownerships... On your new Linux system you'd have to restore these manually...

Quote:

Originally Posted by ctroyp
Since I have done this already, is it necessary to follow your procedure or could I simply copy the files back to the new (Mandriva) server in the appropriate locations once I have it setup? I know that I wouldn't want to replace all of the files and directories, but which ones are absolutely necessary for ISPConfig, the websites, data, etc? Just the ones you mentioned in your instructions?

You should follow one of the Mandriva tutorials on HowtoForge and then install ISPConfig on the system. Afterwards, you can restore all necessary files/databases, etc. Because the source and the destination system are using different distributions (Debian <-> Mandriva), you might have to experiment a bit...

ctroyp 27th December 2005 22:07

Quote:

Originally Posted by falko
But on Windows you lose all the information about the files' permissions and ownerships... On your new Linux system you'd have to restore these manually...

Ah-ha. Now that is a good reason. ;)

Quote:

Originally Posted by falko
You should follow one of the Mandriva tutorials on HowtoForge and then install ISPConfig on the system. Afterwards, you can restore all necessary files/databases, etc. Because the source and the destination system are using different distributions (Debian <-> Mandriva), you might have to experiment a bit...

I was already planning on using your setup for Mandriva on HTF. I have Debian on the 80GB disk and I may just dd or tar the data to another drive that I have. That should keep all of the permissions and ownerships, won't it? My plans are to utilize the 80GB drive since I don't have an additional one that large. So I will have to format the drive. How would I restore the necessary files and databases after I do this since I will only have the copied files on the 20 GB drive? Would I need to copy the /home/www/ directory to keep restore all of the websites, for example?

ZyanKLee 27th December 2005 23:10

in order to recover all websites I think you need the following:

/home/www - or whereever you told ispconfig to create the webs
the following mysql-databases: db_ispconfig, web1_db*, web2_db*, ... webN_db*
usefull might be the content of /home/admispconfig and /root/ispconfig, especially the config-files of ispconfig (forgott the exact names, sorry)

ctroyp 27th December 2005 23:17

Quote:

Originally Posted by ZyanKLee
in order to recover all websites I think you need the following:

/home/www - or whereever you told ispconfig to create the webs
the following mysql-databases: db_ispconfig, web1_db*, web2_db*, ... webN_db*
usefull might be the content of /home/admispconfig and /root/ispconfig, especially the config-files of ispconfig (forgott the exact names, sorry)

Thanks ZyanKLee. I think I will go ahead and copy over all directories since I have enough space on the secondary drive.

Really, this is my concern:
Quote:

How would I restore the necessary files and databases after I do this since I will only have the copied files on the 20 GB drive?
I think I will go ahead and generate the backup db scripts as well since that is where most of the sensitive data is stored. I run a forum and it would be a bad thing to lose all of that data.

till 28th December 2005 11:33

Quote:

Originally Posted by ZyanKLee
in order to recover all websites I think you need the following:

/home/www - or whereever you told ispconfig to create the webs
the following mysql-databases: db_ispconfig, web1_db*, web2_db*, ... webN_db*
usefull might be the content of /home/admispconfig and /root/ispconfig, especially the config-files of ispconfig (forgott the exact names, sorry)

The passwords for the users where not stored in the mySQL DB for security reasons, so you must also make a backup of /etc/passwd /etc/shadow /etc/group and /etc/gshadow. I recommend also to make a backup of your postfix, named, FTP and apache configuration files.


All times are GMT +2. The time now is 15:24.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.