0

I have an Ubuntu 10.04 LTS installation on a failing hard drive (I already have my data backed up so that is not an issue.) I want to move the current Ubuntu install intact to a new hard drive. The new hard drive will also need to boot 1 version of Windows for legacy software and 1 other linux distro (that will change from time to time for test purposes.

My current Ubuntu partition scheme: /dev/sda1 ext2 boot /dev/sda2 Linux swap /dev/sda3 Linux extended /dev/sda5 ext4 LVM2 pv

What would be a a good (i.e. simple, straight forward) approach to accomplishing this? I am not considering a virtual machine setup because most of my hardware is pretty old.

I've multi-booted many o.s's But never had to move a Linux install to a multi-boot or worked with LVM much.

2 Answers 2

0

It is a well-known fact that "Windows does not play nice with other partitions". Still it is possible.

Though I have never done it, I believe the strategy below is sound. And you can easily backtrack from it, should anything untoward occur.

1) determine the size of your current disk, minus boot partition.

2) Go to your new disk, and format it as follows: make a NTFS partition for Windows, one extN for Linux. It is not important that you break the Linux space into 2+ partitions nor whether you use ext2/ext3/ext4, we are going to overwrite that with dd shortly. Just make sure that the Linux partition is at least as large as your current disk, minus the boot partition.

This step must be performed from a live Linux distro, I suggest you use Ubuntu for reasons that will be made clear later.

3) Install Windows on the new disk, in the only partition it recognizes, i.e. the NTFS one.

4) Make sure it has not trespassed onto the Linux partition. You can easily do so from the Live Ubuntu stick, using gparted.

5) Now dd your old disk onto the new disk, in the Linux partition. You use the live distro again, to do this.

You do not need to unhinge your old disk, just use an external HD as a "transfer agent".

When dd'ing onto the new disk, you need to skip the Windows partition. If the Windows partition is X MiB, then the following command will do

 dd if=/dev/sdT of=/dev/sdV bs=1M skip=X

Now you see why I told you it was useless to subdivide the Linux partition on the new disk: the reason is that in this step we overwrite it.

6) There are a few more things to check. First, do you have an /etc/fstab that uses GUIDs? If so, it's ok because of course GUIDs are preserved by dd'ing. Otherwise, you will have to edit the /etc/fstab to identify the partitions to be mounted. You can do this from the live, by means of a chroot jail in the / folder of the newly created Linux filesystem on the disk, but my suggestion is to do it, if you have not done it already, on your old system, before abandoning it. You will find your work already done on your new system.

Second, check that you have the drivers for your hardware, especially ethernet, wireless and monitor. You may download them from the live, then again transfer them inside the chroot jail and install them from within chroot.

7) This is where I tell you why I suggest you use Ubuntu. Your new system cannot possibly boot Ubuntu because we have left its MBR behind, and the new one was installed by Windows when Linux was not yet on the system. But Ubuntu has a very nice utility called Boot Repair, which you can download onto the live, and use it to fix the MBR and grub.

That's all folks.

5
  • Your answer looks close to what I was thinking. Regarding step 5. I am considering gddrescue instead of dd. Regarding step 6. My fstab for /boot and /swap or using GUID/UUID's. My lv's are id'd by logical volume names: /dev/mapper/machine_name-lvroot /root etc. Would that need to change?
    – aspi
    Nov 7, 2013 at 0:01
  • No, no need to change, Everything's fine, including gddrescue. You are good to go. Nov 7, 2013 at 4:55
  • Just now able to get back to this. boot-repair didn't work it's broken (at least the version for my Ubuntu 10.04 LTS) I want to chainload grub2 from NTLDR Leaving grub on it's own /boot partition and with Linux setting in a LV. All the original Linux partitions are now dd'd into my extended partition. So I need to reinstall grub2 manually? But for this setup I can't figure out how. The partition scheme is: /dos - contains: NTLDR, boot.ini, /ext - contains: windows OS, 3 NTFS data partitions, as well as /boot (grub2) and the LVM2 VG (Linux OS). Any help would be greatly appreciated!
    – aspi
    Dec 13, 2013 at 17:32
  • After a considerable amount of research, I finally found the time to solve my problem. I wanted to give you credit for your help and excellent advice. So I'm accepting your answer. I do have a detailed write-up that might be helpful for someone else facing an edge case such as mine. Would it be a good idea to post that here?
    – aspi
    Dec 18, 2013 at 12:18
  • @aspi By all means. There will be other people with a similar problem, they will surely find it useful. Dec 18, 2013 at 12:20
0

Backup: Do you have a verified backup of $HOME yet? (Rhetorical question, of course you do).

Windows will stomp all over your Linux install, so Windows must go on first.

Then, reinstall 10.04 LTS (or think seriously about upgrading to 12.04 with the Xfce GUI) and

restore your $HOME data.

Wish I had a simple, straight forward way to do that without reinstall, but Windows won't permit it.

1
  • The question was about moving an existing install - not a reinstall.
    – aspi
    Nov 6, 2013 at 0:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .