Hi Christian, Cristian Del Carlo wrote:
Hi list, I have some critical servers and i would want to clone it to have a secure image. I would want to use this images to have a secure image of my files and to use it to recover the server if the disck fail.
You don`t want a Disk Image. Servers don`t just dye due to Disk failure. You might have to use a Server from another Vendor, just to be fast enough.
I have found this bootable iso cd http://www.sysresccd.org/ that have partimage.
Great, but a Live-CD or Install-CD with rescue-System from the Distributor would probably be better.
Is this for you a good solution or there is other better way ?
Do this: Boot with a live CD supporting your Backup Medium and youre Server Hardware. (Maybe init s and starting Network services is enough.) (I use Knoppix and a cheap USB Harddisk (SLOW) or NAS (FAST)) Create /backup Mount the Filesystems in correct Order to /backup. cd /backup find . | cpio ... | (gzip ... |) (split ...) (> Target) cpio does a good Job preserving File-Types and Timestamps. use gzip only on reliable Medium (no Tape) use split to decrease File-Size to allowed Maximum. Be careful with Hardlinks. Restore: Boot new system with Vendor Install-CD. Continue Installation until File copying is beginning. (Harddisk Formatting etc. is done.) Reboot and Insert rescue System. Create /backup Mount the Filesystems in correct Order to /backup. cd /backup Restore the complete File-System. Edit restored fstab to match new Partioning Scheme. Edit Boot-Manager config. If needed Don`t forget lilo. reboot and pray. Edit Network config after Reboot to match new Hardware. Maybe you need to change some Modules. Check Applications and.... Youre done. Migrating a fully installed Webserver (Server Hardware, raid 5 scsi, etc..) to a Virtual Machine (VMware, single emulated ide Harddisk..) takes just a few hours. (You see, completely different Hardware.) Restore to the same Hardware just takes about half an hour. (I do this script based on a trainings-Server using ssh.) If you really _want_ a Image. (Maybe one of these old Windows servers using NTFS. ;-) ) Just use dd instead of find. (And no mounting before.) This works like a charm with my Windows Laptop. Need a example? Backup --------------------------------------- #!/bin/bash # # # backup script # Variables # MY_STARTDIR=/ MY_TODAY=`date +%Y%m%d` ##### FUNCTIONS ###################### my_cleanup () { # Remount Filesystems mount -a # Restart Services here. exit 0 } my_cleanup_sig () { cat <<- ---END-01--- Got Kill Signal PLEASE wait until system Services are restarted You might consider checking all Services. ---END-01--- sleep 6 my_cleanup } trap my_cleanup_sig 2 trap my_cleanup_sig 15 #STOP SERVICES HERE # Umount remote FS. umount REMOTEFS if mount | grep nfs then echo "Remote FS not unmounted" mount exit 10 fi # Go into STARTDIR cd ${MY_STARTDIR} # Find every File and cpio it. find * -path 'proc' -prune -o -print | \ cpio -o | gzip -9 - | ssh -2 SERVER \ "cat >FILENAME${MY_TODAY}.cpio.gz" my_cleanup RESTORE ----------------------------------------------- #!/bin/bash # # # restore script # # Variables # MY_STARTDIR=/ MY_TODAY=`date +%Y%m%d` ##### FUNCTIONS ###################### my_cleanup () { # Remount Filesystems mount -a # Restart Services exit 0 } my_cleanup_sig () { cat <<- ---END-01--- Got Kill Signal PLEASE wait until system Services are restarted You might consider checking all Services. You might have to start lilo by hand. ---END-01--- sleep 6 my_cleanup } trap my_cleanup_sig 2 trap my_cleanup_sig 15 # STOP SERVICES HERE # Umount remote FS. umount REMOTEFS if mount | grep nfs then echo "Remote FS not unmounted" mount exit 10 fi # Go into STARTDIR cd ${MY_STARTDIR} # Find backup Files and select one. MY_BACKUPLISTE=`ssh -2 SERVER \ "ls FILENAME*.cpio.gz"` PS3="SELECT PLEASE. > " select MY_BACKUP in ${MY_BACKUPLISTE} do break done # Now restore ssh -2 SERVER "cat < ${MY_BACKUP}" | gunzip -c - \ | cpio -i --unconditional lilo my_cleanup ------------------------------------------ This is just a quick and dirty Template. You will have to edit it to fit youre needs. After restore you should do a reboot. (Just to be shure, not really needed as this is linux. ;-)) )
Thanks,
Youre welcome.
Cristian Del Carlo
Dirk TRIA IT-consulting GmbH Joseph-Wild-Straße 20 81829 München Germany Tel: +49 (89) 92907-0 Fax: +49 (89) 92907-100 http://www.tria.de -------------------------------------------------------- working hard | for your success -------------------------------------------------------- Registergericht München HRB 113466 USt.-IdNr. DE 180017238 Steuer-Nr. 802/40600 Geschäftsführer: Richard Hofbauer kaufm. Geschäftsleitung: Rosa Igl -------------------------------------------------------- Nachricht von: Dirk.Schreiner@tria.de Nachricht an: delcarlo@osratoscana.it, suse-security@suse.com # Dateianhänge: 0 Die Mitteilung dieser E-Mail ist vertraulich und nur für den oben genannten Empfänger bestimmt. Wenn Sie nicht der vorgesehene Empfänger dieser E-Mail oder mit der Aushändigung an ihn betraut sind, weisen wir darauf hin, daß jede Form der Kenntnisnahme, Veröffentlichung, Vervielfältigung sowie Weitergabe des Inhalts untersagt ist. Wir bitten Sie uns in diesem Fall umgehend zu unterrichten. Vielen Dank The information contained in this E-Mail is privileged and confidental intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient or competent to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this E-Mail is strictly prohibited. If you have received this E-Mail in error, please notify us immediately. Thank you