Manually Transfer SME Server Data to New Install

SEQUENCE OF HOW WE GOT HERE

-3 drives (sda, sdb, sdc) in RAID 5 config.
-sudden power outage.
-sme won't boot.
-bad block on sda which makes up MD1.
-removing sda doesn't work for some reason.


WHAT I DID

Install Fresh SME Server

-buy new HD
-remove all old HD's
-install new HD
-install fresh SME on new HD
-shutdown machine

Re-insert Old HD

-remove new HD
-insert one of the good old HD drives

Boot from CD

-put in SME SERVER cd
-boot
-type: sme rescue
-hit enter
-don't start network
-accept other defaults

Change the LVM Name

(It's ok to run these commands. Only the last command affects the setup. Which can be easily changed back if needed)
-lvm vgscan
-lvm lvscan
-lvm vgchange -a y
-lvm pvscan
-lvm lvscan
-lvm vgrename main mainold
-exit

Re-insert New HD

-remove old HD
-insert new HD drive

Boot New HD & Access Old HD

-boot up via new HD
-connect old HD via USB caddy.
-it should be /dev/sdb
-type: fdisk -lu /dev/sdb
-mdadm -AR /dev/md8 /dev/sdb2
-lvm vgscan
-lvm lvscan
-lvm vgchange -a y
-mkdir -p /mnt/olddrive
-mount -t ext3 /dev/mainold/root /mnt/olddrive

Manually Copy Old Info

-cd /
-signal-event pre-restore
-/bin/cp -Ra /mnt/olddrive/etc/e-smith/templates-custom/ /etc/e-smith/
-/bin/cp -Ra /mnt/olddrive/etc/e-smith/templates-custom/ /etc/e-smith/
-/bin/cp -Ra /mnt/olddrive/etc/group /etc/
-/bin/cp -Ra /mnt/olddrive/etc/gshadow /etc/
-/bin/cp -Ra /mnt/olddrive/etc/passwd /etc/
-/bin/cp -Ra /mnt/olddrive/etc/samba/secrets.tdb /etc/samba/
-/bin/cp -Ra /mnt/olddrive/etc/samba/smbpasswd /etc/samba
-/bin/cp -Ra /mnt/olddrive/etc/shadow /etc/
-/bin/cp -Ra /mnt/olddrive/etc/smbpasswd /etc/
-/bin/cp -Ra /mnt/olddrive/etc/ssh/ /etc/
-/bin/cp -Ra /mnt/olddrive/etc/sudoers /etc/
-/bin/cp -Ra /mnt/olddrive/root/ / (I cheated here. I only grabbed the htop config file. I left the rest)
-/bin/cp -Ra /mnt/olddrive/opt/ /
-/bin/cp -Ra /mnt/olddrive/home/e-smith/db/ /home/e-smith/
-/bin/cp -Ra /mnt/olddrive/home/e-smith/Maildir/ /home/e-smith/
-/bin/cp -Ra /mnt/olddrive/home/e-smith/web/ /home/e-smith/

Manually Copy Mysql Info

service mysqld stop
/bin/cp -Ra /mnt/olddrive/var/lib/mysql/ /var/lib/
cd /var/lib/
chown -R mysql:mysql ./mysql
service mysqld start

Reboot with Transferred Configuration

-signal-event post-upgrade
-reboot
-this allows people to work/access iinternet

Manually Copy Rest of Data

/bin/cp -Ra /mnt/olddrive/home/e-smith/files/ /home/e-smith/


Copy to New External HD

-leave HD's in the server.

Boot from CD

-plug in new HD via usb
-put in SME SERVER cd
-boot
-type: sme rescue
-hit enter
-don't start network
-accept other defaults

The new drive should show up as /dev/sdd.

Parition New HD

-type: fdisk /dev/sdd
-Press p > Press n > Press p, partition 1, default 1 > Press w
-type: mkfs.ext3 /dev/sdd1

Change to Old Info

-chroot /mnt/sysimage

Mount New HD

-mkdir -p /mnt/newdrive
-mount /dev/sdd1 -t ext3 /mnt/newdrive

Copy Info

-/bin/cp -Ra /home/ /mnt/newdrive