Re: How to mirror a Linux Server?



fAnSKyer wrote:
Sorry that I forget mention, I have several services in the old
machine and we planned to move everything to the new machine and let
the old machine as the back up. So it is totally clone. :)

I think put hard disk out and duplicate hard disk may be the easiest
solution, but what is the command? DD? or if I use partimage, I can
image a drive, can I restore the image to another hard drive?

Thanks a lot fellows, really appreciate that

Cheers


If you either use an IDENTICAL disk or at lest create IDENTICAL PARTITIONS on the new one to the old one, dd will clone either the whole disk or just the partitions.

I am not sure about the boot sector though. I hope others will tell you..

To clone a partition, you need to identify what it is at raw level

For example, My system has a single hard drive. and eeh WHOLE DISK is /dev/hda. the 'a' refers to the actual first disk...the hd mens ide disk controller.

Vis
# mount

/dev/hda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda9 on /home type ext3 (rw)
/dev/hda8 on /tmp type ext3 (rw)
/dev/hda5 on /usr type ext3 (rw)
/dev/hda6 on /var type ext3 (rw)
tmpfs on /dev type tmpfs (rw,size=10M,mode=0755)

Each partition is /dev/hda1, /dve/hda2 etc. As you see.

Now if I had an identical disk wired up as the second disk on the IDE bus, but otherwise un partioned and empty the command

dd if=/dev/hda of=/dev/hdb

would mirrors the disk *exactly*: You SHOULD do this in single user mode to prevent the disk contents changing. This command takes a LONG time to finish..its a sector by sector rewrite of the entire disk, including all the unused ones.


That disk is now suitable for booting in an identical machine, but not in one whose hardware is changed, as different device drivers or configs may need to be added.

If the hardware is identical, but the disk is bigger, you can clone partitions as long as they are the same size..what that usually means is usinf DD on things like / /usr and so on and using tar to get the data from different sized partitions.

So lets say you have cerated a new disk with partition the same size for te first few..but want to have a bigger /home or /var.


put that disk in and use fdisk to partition it.

dd the partitions that are identical using dd but with /dev/hda1 and /deb/hdb1 as teh source and target for example.

Then mointy the odd sized partitions onbe ay atime

e.g. say /var is partition #6

mount /dev/hdb6 /mnt

will mount it an then you can do a tar (whose exact synax escapes me) to copy the FILES across.


If finally you are cloning to new hardware and a different sized disk, you have a much bigger job on your hands. You need to craate a bootable unix and partitioned disk FIRST, and selectively copy across what you need from the old disk or machine.

You will need a LOT of coffee. Not only will you need to copy across all the data from e.g. /var /usr and /home (easy) but you will need BITS of / as well. For example, you want the same users, groups and passwords..? thats in /etc/passwd /etc/group and /etc/shadow.

Maybe you need to duplicate the web server..so across comes /etc/apache or whatever and all its contents..

I have forgotten which bits of the configs deal with the actual hardware: Perhaps its best if you tell us EXACTLY what the game is here.

I have never done this except when we needed to put a more powerful machine or a bigger disk into play, and in those cases we would spend some time setting the machine up first, making sure the user accounts worked, and the networking stuff was running right, and then we would pull off using tar and ftp all the bits that were not 'live data' until as far as we could tell we had a pretty much identical machine apart from the data..in the case I remember most it was a mail server with over 5000 users mail going through it..and then we stopped all mail daemons, pulled off all the mailboxes and queues, put them on the new machine (RAID) also in pretty much with mail disabled, then brought down the old machine, put the new into single user, changed its IP address to match the old one, and brought it back up to multiuser. Then watched with bated breath to see if it was working..

The whole process was planned down to every move, and written down BEFORE we even started, and reviewed by the whole IT team. Most of whom were up all night just in case it went badly wrong. We picked 2 a.m. to did the switchover..as our stats showed that 2 a.m. to 6 a.m. was te quietest period.

So thats how you do an upgrade to a core ISP machine :-)











Hi, I met a problem, I have a Linux Server and I want duplicate this
server in another linux computer. Is there any easy way to do so?

Thanks a lot


.



Relevant Pages

  • Re: Software to clone disk and resize target partiions at same time?
    ... >> resize any or all of the partitions. ... That only means that partitions it doesnt understand the format ... I think its best to clone from the bootable rescue CD too, ... > I have to be sure and unplug it and plug the target disk in it's place so ...
    (comp.sys.ibm.pc.hardware.storage)
  • LVM on SW RAID for sarge - success
    ... I've just had success migrating Debian Sarge to root on LVM on RAID. ... First make sure the SCSI BIOS boots from the first disk. ... I made reiserfs on all the filesystem partitions and completed the ... The remaining two disks were partitioned and used to create RAID arrays ...
    (Debian-User)
  • Re: Replace SCSI Drive
    ... from there you can manipulate other hard drives attached to the machine. ... It should 'just work' but watch out that you keep disk devices ... vi-a) Write a BSD partition table into the slice, then set up your required FreeBSD partitions: ... items under the 'Custom Install' to achieve the desired result. ...
    (freebsd-questions)
  • Re: Upgrade to new drive issues
    ... I started the clone anyway with a proportional parttion copy which ran ... partition and got a disk error. ... I am reluctant to use partition magic to delete the partitions since I do ... resolved your problem as it involves the cloning of partitions from one HDD ...
    (microsoft.public.windowsxp.hardware)
  • Re: RAMDisk and HardDisk strikes back!
    ... One disk with only one partition as large as FBA setup; ... Two disk with one or more partitions for each. ... @ 20:32:55.252 #W059 Selecting best compatible driver failed. ... @ 20:53:51.166 #T211 Install Device: Changing registry settings as specified ...
    (microsoft.public.windowsxp.embedded)