Koozali.org: home of the SME Server

Backup in CD SME Rescue Mode

Offline kruhm

  • *
  • 680
  • +0/-0
Backup in CD SME Rescue Mode
« on: January 11, 2014, 12:44:05 PM »
Hi,

Let's say you have a SME server that won't boot correctly but you can access via CD SME Rescue Mode. What's the best option for a backup at this point?

Thanks,

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Backup in CD SME Rescue Mode
« Reply #1 on: January 11, 2014, 02:01:50 PM »
kruhm

One option is to connect another drive, mount it, & copy files directly to it.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline kruhm

  • *
  • 680
  • +0/-0
Re: Backup in CD SME Rescue Mode
« Reply #2 on: January 12, 2014, 01:26:26 PM »
Hi,

Gotcha. So a manual transfer to a new HD is the best option. I guess it would look like this:

Boot to SME Rescue

-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.

Partition 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/
-/bin/cp -Ra /etc/e-smith/templates-custom/ /mnt/newdrive/etc/e-smith/
-/bin/cp -Ra /etc/e-smith/templates-custom/ /mnt/newdrive/etc/e-smith/
-/bin/cp -Ra /etc/group /mnt/newdrive/etc/
-/bin/cp -Ra /etc/gshadow /mnt/newdrive/etc/
-/bin/cp -Ra /etc/passwd /mnt/newdrive/etc/
-/bin/cp -Ra /etc/samba/secrets.tdb /mnt/newdrive/etc/samba/
-/bin/cp -Ra /etc/samba/smbpasswd /mnt/newdrive/etc/samba/
-/bin/cp -Ra /etc/shadow /mnt/newdrive/etc/
-/bin/cp -Ra /etc/smbpasswd /mnt/newdrive/etc/
-/bin/cp -Ra /etc/ssh/ /mnt/newdrive/etc/
-/bin/cp -Ra /etc/sudoers /mnt/newdrive/etc/
-/bin/cp -Ra /root/ /mnt/newdrive/
-/bin/cp -Ra /opt/ /mnt/newdrive/


I actually elected to do a fresh install on a fresh HD and reverse the above (copy from the old drive rather than copy to a new drive).

The hard part was getting the SME Rescue to recognize the lvm on the old hd as it's the same name as the current lvm.

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/sdd
-type: fdisk -lu /dev/sdd
-mdadm -AR /dev/md8 /dev/sdd2
-lvm vgscan
-lvm lvscan
-lvm vgchange -a y
-mkdir -p /mnt/olddrive
-mount -t ext3 /dev/mainold/root /mnt/olddrive

Copy from Old HD

-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/ /
-/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/
-service mysqld stop
-/bin/cp -Ra /mnt/olddrive/var/lib/mysql/ /var/lib/
-cd /var/lib/
-chown -R mysql:mysql ./mysql
-service mysqld start
-signal-event post-upgrade
-reboot


Anything wrong with the above?

Thanks,

« Last Edit: January 13, 2014, 12:15:14 PM by kruhm »

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Backup in CD SME Rescue Mode
« Reply #3 on: January 13, 2014, 12:28:27 AM »
kruhm

At a quick look, you essentially just recreated this existing Howto
http://wiki.contribs.org/UpgradeDisk
(which also answers the lvm name issue)
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline kruhm

  • *
  • 680
  • +0/-0
Re: Backup in CD SME Rescue Mode
« Reply #4 on: January 13, 2014, 02:06:34 AM »
Hi,

Thanks for your reply. I appreciate your recent efforts becoming more involved in the community.

I saw that but I wasn't sure what applied and what didn't apply. In short, there's so much info in the wiki and forums it's impossible to where to start.

This is a v8 to v8. The only section I saw that applies is the following section which is an incomplete instruction set:
http://wiki.contribs.org/UpgradeDisk#Recovering_a_system_where_pre-backup_could_not_be_run

The other sections are tagged for different versions. As it's technical info, the instruction set must be fully complete (not just close). I wasn't willing to take a chance and wanted to be certain that the transition went smoothly.

The following section cannot be used for various reasons including the old system wasn't running and it doesn't account for lvm's:
http://wiki.contribs.org/UpgradeDisk#Moving_from_SME_6.x_to_SME_7.x

The following section cannot be used as it is also an incomplete instruction set:
http://wiki.contribs.org/UpgradeDisk#Moving_from_SME_7.x_to_SME_7.x

The following section is certainly close but it isn't tagged as such:
http://wiki.contribs.org/UpgradeDisk#Moving_from_SME_7.x_to_SME_8.x

The following would have been nice during the incident:
Code: [Select]
db configuration setprop backup Program CopyFromDisk status enabled
signal-event pre-restore
signal-event restore-tape /mnt/tmp (note: this step may take a long time depending on how much data is being restored)
signal-event post-upgrade
signal-event reboot

I just don't get into these situations enough to know what to do.

Thanks,

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Backup in CD SME Rescue Mode
« Reply #5 on: January 13, 2014, 02:52:16 AM »
kruhm

I've been here since at least 2008, according to my profile.

Quote
The following section is certainly close but it isn't tagged as such:
http://wiki.contribs.org/UpgradeDisk#Moving_from_SME_7.x_to_SME_8.x

AFAIK that section of the howto is still applicable for sme8 to sme8 upgrades/transfers.
The underlying concepts are the same whether going from v7 to v8, or v8 to v8, ie when using the sme8 specific procedures mentioned.
It's just that the Howto has never been updated accordingly.


Quote
there's so much info in the wiki and forums it's impossible to where to start.

Yes I agree there is a lot there, so the best suggestion I can make in that regard is to do quick read of ALL the Howtos & Contrib wiki articles, so you are familiar with what is available. I did say a quick read.

Your original question was about doing backups from an unbootable server, so we would need to be mind readers to know you wanted to actually do something different to that, which was effectively covered in an existing howto.

Quote
As it's technical info, the instruction set must be fully complete (not just close). I wasn't willing to take a chance and wanted to be certain that the transition went smoothly.

So as you feel the documentation is incomplete or lacking or not specific enough, then please update the wiki article to include sme8 to sme8 transfers.
It could be as simple as adding a line that says "Also works for sme8 to sme8 transfers", or you could add your more detailed steps, keeping in mind that the howto topic is UpgradeDisk (restore from a mounted disk).

Maybe your actual steps could be a different howto, re how to recover from a unbootable server ???


Quote
The following would have been nice during the incident:
db configuration setprop backup Program CopyFromDisk status enabled
signal-event pre-restore
signal-event restore-tape /mnt/tmp (note: this step may take a long time depending on how much data is being restored)
signal-event post-upgrade
signal-event reboot


AFAICT that Restore procedure is exactly what is in the Howto, but as said earlier, you asked for Backup procedures.
You told us you used Restore procedures after the event.
Sometimes we have to read past the headings which may be specific, as much/most of sme server "stuff" does apply from version to version with no or only minor changes, such is the ongoing underlying design concepts of sme server that do not change greatly between versions.
« Last Edit: January 13, 2014, 02:54:52 AM by janet »
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline kruhm

  • *
  • 680
  • +0/-0
Re: Backup in CD SME Rescue Mode
« Reply #6 on: January 13, 2014, 12:14:13 PM »
Hi,

In any event... thanks! Your help is appreciated.

We are going around in circles which isn't helping anyone.

I did a quick read and my second long post is what I came up with. If you were in the situation, you would have taken different actions. Not surprising.

Quote
Your original question was about doing backups from an unbootable server, so we would need to be mind readers to know you wanted to actually do something different to that, which was effectively covered in an existing howto.
Agree to disagree on this one.

The documentation is another discussion altogether.

Thanks again. Have a great day.