Re: What is the best way to migrate a server to new hardware?

2010-09-02 Thread Bob Proulx
Aniruddha wrote:
 Bob Proulx wrote:
  I like booting the new machine with a live cdrom and then using rsync
  to clone the old system onto the new system's disk over the network.
  Then install grub and boot the new system.
 
  At other times I will move the new disks onto the old system, mount
  them and do the copy locally, then move them back into the new machine
  and boot it.
 
 Thank you for you help. Which rsync command do you use? And how you
 restore grub? With the live cd? Or manually with a random livecd?
 Which command do you use to copy them them locally? I'm curious how
 other users solve this :)

I should have mentioned it but the only interesting rsync option that
is needed is --numeric-ids.  That uses the owner and group ids
verbatim without the default name mapping to the uids of the currently
running system.  Using --numeric-ids is normal for backup and verbatim
data transfer such as this.

  rsync -av --numberic-ids --exclude /proc --exclude /dev oldhost:/ /target/

Normally I would explicitly copy any individual filesystem such as
/home or /usr/local individually.  The -x, --one-file-system option
may be useful in the multiple partition case copying from a live
filesystem.

/dev is a little problematic.  What you want there is a raw version
but the running system has a cooked version.  I will usually copy that
from a debootstrap'd /dev that is idle.  I will leave this as a little
bit of an exercise for the reader.

Copying from a local disk to a local disk is the same but then since
the local disk is idle there isn't anything in the proc and dev is the
idle dev and so this is simpler.

  rsync -av --numberic-ids /mnt/olddisk/ /mnt/newdisk/

Again, individual filesystems on individual partitions would need to
be created and copied individually.

  rsync -av --numberic-ids /mnt/olddisk/var /mnt/newdisk/
  rsync -av --numberic-ids /mnt/olddisk/home /mnt/newdisk/
  rsync -av --numberic-ids /mnt/olddisk/usr/local /mnt/newdisk/
  ... and so forth ...

There is much other documentation on restoring grub so I won't go into
detail there.  I boot a live cd and then chroot into the system and
run grub-install there to install grub onto the MBR.

I also make good use of a live cd that uses grub itself.  Then I can
interactively tell grub booting from the cdrom to boot the new system.
This way the new system is booted exactly as it will once grub is
installed on the new disks.  Then I run grub-install on the newly
booted system to set up the MBR and reboot to test it.  However most
live cdroms use syslinux instead and so locating a grub booting cdrom
boot system can be challenging.  You may end up resorting to building
your own grub based cdrom system instead.  In my case for this
scenario I don't care about what is actually on the disk.  I just want
to get to an interactive grub session so that I can interactively boot
the new system.

Sorry that the information here is a little fuzzy.

Bob


signature.asc
Description: Digital signature


Re: What is the best way to migrate a server to new hardware?

2010-09-02 Thread Martin Kraus
On Thu, Sep 02, 2010 at 10:13:49AM -0600, Bob Proulx wrote:
 Aniruddha wrote:
  Bob Proulx wrote:
   I like booting the new machine with a live cdrom and then using rsync
   to clone the old system onto the new system's disk over the network.
   Then install grub and boot the new system.
  
   At other times I will move the new disks onto the old system, mount
   them and do the copy locally, then move them back into the new machine
   and boot it.

Isn't using tar the easiest way? boot from finnix iso, create software
raid,lvm or whatever you need, then tar one system with --numeric-owner
parameter and pipe it through ssh to the destination system.
mount --bind /dev to the new system, chroot into it, install grub and restart.

mk


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100902233545.GR30293@/bin/hostname



Re: What is the best way to migrate a server to new hardware?

2010-09-02 Thread Bob Proulx
Martin Kraus wrote:
 Bob Proulx wrote:
I like booting the new machine with a live cdrom and then
using rsync to clone the old system onto the new system's disk
over the network.  Then install grub and boot the new system.
   
At other times I will move the new disks onto the old system,
mount them and do the copy locally, then move them back into
the new machine and boot it.
 
 Isn't using tar the easiest way? boot from finnix iso, create
 software raid,lvm or whatever you need, then tar one system with
 --numeric-owner parameter and pipe it through ssh to the destination
 system.  mount --bind /dev to the new system, chroot into it,
 install grub and restart.

As I said before there isn't one canonically correct way.  Different
people will have their favorite methods.  In this case the concept of
cloning the filesystem is the same.  One just uses tar and ssh and
other uses rsync and ssh.  Neither is wrong and neither is The One
True way.  A third person might like cpio over tar.  A forth person
might like dd.  A fifth person might like 'mondo', which I am a little
surprised that no one mentioned yet.

Bob


signature.asc
Description: Digital signature


Re: What is the best way to migrate a server to new hardware?

2010-09-02 Thread Bob Proulx
Chris wrote:
 On the new box: 
 Install Debian per normal.
 
 Old Box:
 #sudo dpkg --get-selections *  installed_packages.txt
 copy the file, installed_packages.txt to the new box

I have done this before and it is a good method.

 On Newly install Debian:
 #sudo dpkg --set-selections  installed_packages.txt
 #sudo apt-get -u dselect-upgrade
 
 This will read the file installed_packages.txt
 and will install these into the new Debian system.

Yes.

 Once that's up to date, take your tarball of /etc from the old box, 
 dump it to a temp dir in the new, decompress it, copy the .conf files
 that you modified (and any other dirs/files you yourself have created
 to /etc on the new box.

The problem that almost certainly will occur is if the order of
installation of packages that create users is different on the new
machine than on the old machine then some of the installed users will
have different uids on the new machine than on the old machine.  In
which case when you copy data from the old machine you have to take
extra care to ensure that the file ownership ends up being correct on
the new machine.

To make this work seed the /etc/{password,shadow,group,gshadow} with
all of the new groups from the old system first.  Then when installing
the new packages on the new system the uids and gids will be the same
as on the old system.  That done you can very easily copy data from
the old machine to the new and the file ownerships will be correct.

Bob


signature.asc
Description: Digital signature


What is the best way to migrate a server to new hardware?

2010-09-01 Thread Aniruddha
Hi,

I wonder what the best way is to move a (non mission-critical) Debian
server installation to a  new server. Rsync, clonezilla, tar, mondo,
dpkg-selections? With Gentoo I used to tar root, unpack it on the new
server, adjust config files and reinstall grub.I wonder what the
proper way in Debian is. Thanks in advance!


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktimqauc1odl9r9qwf-tdg82gdusl8jporg+w8...@mail.gmail.com



Re: What is the best way to migrate a server to new hardware?

2010-09-01 Thread Bob Proulx
Aniruddha wrote:
 I wonder what the best way is to move a (non mission-critical) Debian
 server installation to a  new server. Rsync, clonezilla, tar, mondo,
 dpkg-selections? With Gentoo I used to tar root, unpack it on the new
 server, adjust config files and reinstall grub.I wonder what the
 proper way in Debian is. Thanks in advance!

There isn't one canonically correct answer.  There are many different
ways to do it and different people will have different favorite
methods.

I like booting the new machine with a live cdrom and then using rsync
to clone the old system onto the new system's disk over the network.
Then install grub and boot the new system.  If I want to set up disk
mirroring then I do that first by using the debian-installer to do the
work first so that it is ready to go and then do the rsync on top of
it.

At other times I will move the new disks onto the old system, mount
them and do the copy locally, then move them back into the new machine
and boot it.

Bob


signature.asc
Description: Digital signature


Re: What is the best way to migrate a server to new hardware?

2010-09-01 Thread Chris
I like the dpkg method myself. Of course this won't help if you have lots of 
custom conf file in etc.

In that case, creating a tarball of etc would remedy that. 

Clonezilla is another option I like if you want an exact duplicate (I have used 
both methods and its a toss up for me what is the better solution)

Of course, your mileage may vary.
Sent from my BlackBerry®

-Original Message-
From: Aniruddha mailingdotl...@gmail.com
Date: Wed, 1 Sep 2010 09:33:42 
To: debian-user@lists.debian.org
Subject: What is the best way to migrate a server to new hardware?

Hi,

I wonder what the best way is to move a (non mission-critical) Debian
server installation to a  new server. Rsync, clonezilla, tar, mondo,
dpkg-selections? With Gentoo I used to tar root, unpack it on the new
server, adjust config files and reinstall grub.I wonder what the
proper way in Debian is. Thanks in advance!


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktimqauc1odl9r9qwf-tdg82gdusl8jporg+w8...@mail.gmail.com




Re: What is the best way to migrate a server to new hardware?

2010-09-01 Thread Aniruddha
On Wed, Sep 1, 2010 at 9:53 AM, Bob Proulx b...@proulx.com wrote:
 I like booting the new machine with a live cdrom and then using rsync
 to clone the old system onto the new system's disk over the network.
 Then install grub and boot the new system.


 At other times I will move the new disks onto the old system, mount
 them and do the copy locally, then move them back into the new machine
 and boot it.

Thank you for you help. Which rsync command do you use? And how you
restore grub? With the live cd? Or manually with a random livecd?
Which command do you use to copy them them locally? I'm curious how
other users solve this :)


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktinsbko13g8ach5urxiozt2emgiu8cgjjbbp+...@mail.gmail.com



Re: What is the best way to migrate a server to new hardware?

2010-09-01 Thread Aniruddha
On Wed, Sep 1, 2010 at 9:57 AM, Chris rac...@makeworld.com wrote:
 I like the dpkg method myself. Of course this won't help if you have lots of 
 custom conf file in etc.

 In that case, creating a tarball of etc would remedy that.

 Clonezilla is another option I like if you want an exact duplicate (I have 
 used both methods and its a toss up for me what is the better solution)

Thanks, I can  use a 'tar ball copy' in Debian without problems?
Here's what I did in Gentoo, will this work in Debian. Is there
another recommended way to tar and move an OS?

# rm /etc/ssh/ssh_host*
# rm -iv /etc/resolv.conf
# tar cvjfp /mnt/usb/stage4.tar.bz2 / -X debian.excl

# cat debian.excl
/etc/ssh/ssh_host_*
/home/*
/mnt/*
/media/*
/lost+found
/proc/*
/sys/*
/tmp/*
/var/tmp/*


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktinetc4zf+-+2+s2mjl5hbvdi7w5ub+el0f2j...@mail.gmail.com



Re: What is the best way to migrate a server to new hardware?

2010-09-01 Thread Chris
On Wed, 1 Sep 2010 18:01:42 +0200
Aniruddha mailingdotl...@gmail.com wrote:

 On Wed, Sep 1, 2010 at 9:57 AM, Chris rac...@makeworld.com wrote:
  I like the dpkg method myself. Of course this won't help if you
  have lots of custom conf file in etc.
 
  In that case, creating a tarball of etc would remedy that.
 
  Clonezilla is another option I like if you want an exact duplicate
  (I have used both methods and its a toss up for me what is the
  better solution)
 
 Thanks, I can  use a 'tar ball copy' in Debian without problems?
 Here's what I did in Gentoo, will this work in Debian. Is there
 another recommended way to tar and move an OS?
 
 # rm /etc/ssh/ssh_host*
 # rm -iv /etc/resolv.conf
 # tar cvjfp /mnt/usb/stage4.tar.bz2 / -X debian.excl
 
 # cat debian.excl
 /etc/ssh/ssh_host_*
 /home/*
 /mnt/*
 /media/*
 /lost+found
 /proc/*
 /sys/*
 /tmp/*
 /var/tmp/*
 
 

Here's one way that I would do this:

On the new box: 
Install Debian per normal.

Old Box:
#sudo dpkg --get-selections *  installed_packages.txt
copy the file, installed_packages.txt to the new box

On Newly install Debian:
#sudo dpkg --set-selections  installed_packages.txt
#sudo apt-get -u dselect-upgrade

This will read the file installed_packages.txt
and will install these into the new Debian system.

Once that's up to date, take your tarball of /etc from the old box, 
dump it to a temp dir in the new, decompress it, copy the .conf files
that you modified (and any other dirs/files you yourself have created
to /etc on the new box.

This method has a little work to be done (and thank you Howtoforge for
the nifty little trick) but works pretty well for my needs.

This same process will work for a workstation also. Then again,
Clonezilla (again, one that I use often when I want to archive my
system and need to restore on the same hardware at any given point)
should work also. 

But as others have pointed out, there are many ways to do this. You
just need to blaze your own path and see what works best for you.

-- 
Best regards,

Chris
1AB5FEF8


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/2010090838.01449...@makeworld.com



RE: What is the best way to migrate a server to new hardware?

2010-09-01 Thread Mike Viau

 On Wed, 1 Sep 2010 11:18:38 -0500 rac...@makeworld.com wrote:
 
  On Wed, Sep 1, 2010 at 9:57 AM, Chris rac...@makeworld.com wrote:
   I like the dpkg method myself. Of course this won't help if you
   have lots of custom conf file in etc.
  
   In that case, creating a tarball of etc would remedy that.
  
   Clonezilla is another option I like if you want an exact duplicate
   (I have used both methods and its a toss up for me what is the
   better solution)
  
  Thanks, I can  use a 'tar ball copy' in Debian without problems?
  Here's what I did in Gentoo, will this work in Debian. Is there
  another recommended way to tar and move an OS?
  
  # rm /etc/ssh/ssh_host*
  # rm -iv /etc/resolv.conf
  # tar cvjfp /mnt/usb/stage4.tar.bz2 / -X debian.excl
  
  # cat debian.excl
  /etc/ssh/ssh_host_*
  /home/*
  /mnt/*
  /media/*
  /lost+found
  /proc/*
  /sys/*
  /tmp/*
  /var/tmp/*
  
  
 
 Here's one way that I would do this:
 
 On the new box: 
 Install Debian per normal.
 
 Old Box:
 #sudo dpkg --get-selections *  installed_packages.txt
 copy the file, installed_packages.txt to the new box
 
 On Newly install Debian:
 #sudo dpkg --set-selections  installed_packages.txt
 #sudo apt-get -u dselect-upgrade
 
 This will read the file installed_packages.txt
 and will install these into the new Debian system.
 

Does this method mark the previously packages that were auto as such on the new 
system, or are they all considered installed manually?

 Once that's up to date, take your tarball of /etc from the old box, 
 dump it to a temp dir in the new, decompress it, copy the .conf files
 that you modified (and any other dirs/files you yourself have created
 to /etc on the new box.
 
 This method has a little work to be done (and thank you Howtoforge for
 the nifty little trick) but works pretty well for my needs.
 
 This same process will work for a workstation also. Then again,
 Clonezilla (again, one that I use often when I want to archive my
 system and need to restore on the same hardware at any given point)
 should work also. 
 
 But as others have pointed out, there are many ways to do this. You
 just need to blaze your own path and see what works best for you.