Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Strategy for moving existing gentoo installations to Hyper-V
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message

Joined: 11 Jul 2013
Posts: 2

PostPosted: Thu Jul 11, 2013 3:25 pm    Post subject: Strategy for moving existing gentoo installations to Hyper-V Reply with quote


First off, I'd have to say that my knowledge about Gentoo in particular or even Linux in general is rather limited. That being out of the way, let me briefly describe my scenario and what I'd like to achieve.

At a customer site, we have a total of four gentoo machines running on physical hardware. They haven't been touched in a long time since they are critical for the customer - and the admins, lacking solid know-how on the Linux part, feared they might destabilize the systems by fiddling with them. I share these notions to some extent, but think it's irresponsible to just sit and wait, because at some point some piece of hardware is going to fail.

My plan is to move these machines into a Hyper-V environment as a first step. This would allow me to create snapshots so I could easily revert to a previous state if anything goes wrong, and move off the worn out hardware the systems currently run on. As a next step, I would try to emerge the OS to a modern level. The legacy systems run some custom pieces of software - I'm not sure about how they operate; that's why I'd like to keep & improve the current installation rather than setting up a new system from scratch.

  • The systems currently run on a 2.6.16 gentoo kernel; I'd like to move to the latest kernel if possible.
  • The root and data partitions are reiserFS, I'm not sure how the future of this FS looks like when the main dev is in jail, so maybe it would be sensible to move to ext3/4 instead, while I'm at it.
  • I'd like to move from arch i686 to amd64, if possible.
  • The HDDs seem to be mirrored in a software RAID1 configuration, not sure if that will cause any problems when moving to Hyper-V.
  • The systems are running 24/7, the only time where I could shut them down / unmount the root partition temporarily is Sunday.
  • The uptime is very high (nearing 2 years in one case), so I'm a little edgy about shutting down / rebooting. An online backup / conversion to VHD would be brilliant, but I'm not sure if that's possible at all.

Do you have any pointers for me as to what the best approach for this scenario would be? Would you suggest something else? I frankly have little clue as to how to get the machine into Hyper-V in the fist place (I was thinking of creating a new VM, copying the old system's boot sector with dd, saving/restoring the partition table with sfstab, and copying the contents of / onto the .vhd. Would that work?).

I'm glad for all kinds of suggestions coming my way; if you need more detailed specs, I'm happy to provide them here.

Thanks in advance,

Back to top
View user's profile Send private message

Joined: 30 Aug 2004
Posts: 911
Location: Switzerland

PostPosted: Thu Jul 11, 2013 4:43 pm    Post subject: Reply with quote


First of all, i686 is not like i686 on other distros... It could all be compiled for that specific CPU!
Watch out if there is an -march= entry in /etc/make.conf... and if so, the CPU extensions ('cat /proc/cpuinfo' to see them) should match (or to be precise, the newone should at least have those of the old box!) on both machines, or it will not run!

You're not that far away from what I would do actually... :P
-create a new VM and boot it from a linux livecd or something like that and start the network and set a root password
-create the partitions and format them (the layout as well as boot sector and filesystem do not matter at all!)
-create a directory say /mnt/gentoo and mount the partitions there (boot under /mnt/gentoo/boot and so on)
-mount /boot on the source machine
-rsync -urlvopgtD --exclude=/proc/* --exclude=/sys/* --exclude=/dev/* /* root@destination.machines.ip:/mnt/gentoo/
-back on the destination-box you should apply your new partition layout in /mnt/gentoo/etc/fstab
-also remove the mdadm entries in /mnt/gentoo/boot/grub/grub.conf and set real_root=/dev/sda3 (or whatever that will be for you)
-chroot /mnt/gentoo (or if it's a 64bit livecd then linux32 chroot /mnt/gentoo)
-grub-install /dev/sda
-if necessary adjust the kernel for the hyperv drivers and recompile
-adjust /etc/conf.d/net to a different ip or unplug the virtual network card
-delete /etc/udev/rules.d/70-persistent-net.rules
-umount /mnt/gentoo (and all sub partitions like /mnt/gentoo/boot)
-reboot without live media

You can drive an i686 install without problems on 64bit hardware, but a conversion of the system itself is more than just a little pita and should be avoided!

HTH, cheers
Power to the people!
Back to top
View user's profile Send private message

Joined: 11 Jul 2013
Posts: 2

PostPosted: Thu Jul 11, 2013 7:38 pm    Post subject: Reply with quote

Hi nativemad,

thanks for the hints! Good to know that I wasn't that far off with my plan. With your instructions, I think I should be able to pull it off. I don't think the original admin would have bothered to tailor the kernels to the specific CPUs (the hardware of those boxes isn't identical, so that would have been quite a bit of extra work) - but you never know, I'll check that first thing tomorrow. And I think I'll stick to x86 for now :)

Again, Danke! I'll be back with info on how it turned out (or more questions :) )
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum