Re: Tar CentOS installation and transfer it to new server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Mike wrote:
> Current Installation: CentOS 7.1503 with SerNet Samba 4 ver. 4.1.17
> configured as Active Directory Domain Controller.
> Current Installation: HP Workstation with dual Xeon quadcore cpu's and 4 x
> SATA hard drives NOT configured in RAID array.
>
> New Installation: CentOS 7.1503 minimal install
> New Installation: SuperMicro with single Xeon quadcore cpu and 4 x SATA
> hard drives configured in two pairs of RAID 1.
>
> The Current Install is about 3.5 GB's and has my Samba 4 setup all solid
> and working well. I want to know if it's possible to simply:
>
> - tar up the whole root partition
> - put it on a USB drive
> - boot the New server with a livecd
> - chroot into / partition
> - unpack the tar'ed root (/) from the USB drive into the New server root
> (/).
>
> Both installs used the automatic partitioning from anaconda, so /boot is
> on
> a separate partition.  Each server has an initrd and kernel that works
> from
> /boot partition.  Both CentOS installs are setup using the xfs filesystem
> on the root (/) partition.
>
> I saw someone do this successfully once but they left out certain
> directories like /srv , /tmp , and /var.
> But I'm not 100% certain which directories need to be left out of the
> tarball.
>
> Has anyone done this before?
> Do you know if it's doable?
>
> Thanks for reading.

What we've done a good bit of, to upgrade one server from another that's
already where we want it to be, is this:

1. On the target machine, mkdir /new /boot/new
2. rsync -HPavx <sourceserver>:/boot/. /boot/new/
3. rsync -HPavx -exclude=/old -exclude=/var/log/wtmp <sourceserver>:/.
/new/ (exclude anything else you want)
4. Copy  /etc/fstab, /etc/sysconfig/network,
/etc/sysconfig/network-scripts/ifcfg-e*, /boot/grub/device.map, and
/etc/exports, if any, to /boot/new and /new/etc/
5. Deal with /new/etc/udev.d/rules/70-persistant-net.rules
6. copy /etc/ssh/ssh_host* /new/etc/ssh/
7. IF THE NEW HARDWARE IS DIFFERENT THAN THE OLD, make a new initrd.
mount --bind /dev /new/dev
mount --bind /sys /new/sys
mount --bind /proc /new/proc
mount --bind /boot/new /new/boot
chroot /new
cd /lib/modules

VER=$(ls -rt1 | tail -1)
echo $VER

mkinitrd X $VER
mv X /boot/initrd-$VER.img

exit

8. I haven't been able to do the next in bash, my preferred shell, so:
zsh
zmodload zsh/files

cd /boot
mkdir old
mv * old
mv old/lost+found .
mv old/new/* .

# Root partition.
cd /
mkdir old
mv * old
mv old/lost+found .
#mv old/root . -- WHY?
mv old/scratch .
mv old/new/* .

sync
sync

9. touch /.autorelabel

reboot

And you can always go back via a rescue boot and a few moves.

       mark

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux