Hi,
This might sound like a n00b question, but I've honestly never done this with a Linux machine... (it is running Centos3)
We have a 1U mail server with two 36GB SCSI drives in a hardware mirror config. There's no more room for any other drives in the case. It's filling up, so we now have two 74GB drives ready to take their place.
Possible solutions that I've come up with:
1) shutdown all the services (postfix, courier, etc.) backup the machine to another box, swap out the drives, install CentOS4, copy the email back. It's a pain, but I'd get a clean CentOS4 box when I'm done. whee!
2) bootup with a bootdisk and use some kinda drive image utility to backup the machine (partimage, g4u, etc), swap out the drives, and then restore the image. Less painful, but still running CentOS3 and I have to fumble around with those image utilities instead of good ol' tar-over-ssh. :)
any others?
In the past I've usually just moved services from an old machine to another one. So I had tons of time to configure/test the new server before making it live. This one has to be done in place so time is of the essence.
How would you do it?
Thanks, Ajay
On Mon, 2005-08-08 at 19:03 -0700, Ajay Sharma wrote:
Hi, This might sound like a n00b question, but I've honestly never done this with a Linux machine... (it is running Centos3)
It's not a noob question. It comes up regularly.
How would you do it?
I regularly do this on Linux and Solaris (and should be applicable to just about any other System-V UNIX flavor -- especially step #3) using the following procedure.
I recommend you do it from run-level 1 (or even init=/bin/sh), but it's not totally necessary (it all depends on what files are open and/or what is running).
1. Slice (partition) new disk and create new filesystems
NOTE: If you're using filesystem labels (e.g., e2label), we sure you enter them appropriate under #4 below. If you configure software RAID, remember your configuration files.
2. Create a new mount point, say /newroot, and mount new filesystem tree under /newroot
NOTE A: You do _not_ need a 1:1 filesystem setup, you can change your filesystem organization if you wish.
NOTE B: Also remember that /newroot/tmp, if a separate filesystem, should be chmod 1777, although #3 might correct this anyway.
3. Copy all existing data as follows ... (pretty much universal to all System-V UNIX flavors) ...
for i in / /fs1 /fs2 ...; do cd $i find . -mount | cpio -pmdv /newroot$i done
You can make this one line with: # for i in / /fs1 /fs2 ...; do cd $i; find . -mount | cpio - pmdv /newroot$i; done
NOTE A: The list of filesystems should be the _original_, not the new ones. Using the "-mount" (sometimes "-xdev" on other implementations) option to find does not cross filesystems, hence why you pass the existing filesystems. The new tree will be populated as appropriate.
NOTE B: "Sparse files" may be expanded after this operation and take up more disk space, depending on the filesystem(s) in use.
4. Modify filesystem (e.g., /newroot/etc/fstab), bootloader (e.g., /newroot/etc/grub.conf or lilo.conf), etc... as appropriate, including any LVM/MD disk organization.
6. Re-install bootloader (e.g., GRUB/LILO) to new disk
NOTE: You _may_ need to boot the distro's CD and recovery mode after you remove the former disk for proper BIOS-Linux device disk mapping. I've been able to do so in LILO without, but GRUB always seems to never likes the fact that my mappings don't line up until I make them actual (so I typically use the rescue CD).
On 8/8/05, Ajay Sharma ssharma@revsharecorp.com wrote:
Hi,
This might sound like a n00b question, but I've honestly never done this with a Linux machine... (it is running Centos3)
We have a 1U mail server with two 36GB SCSI drives in a hardware mirror config. There's no more room for any other drives in the case. It's filling up, so we now have two 74GB drives ready to take their place.
Make an image then restore back on your new HD's. I it will resize for the new drive also.