For those interested, I've included the steps required to manually migrate. These instructions used to be in post #1, but made it less readable, so I've moved them here. Also, I don't recommend manual migration, unless you are doing it for educational purposes
Manual migration
These are only suitable for Wubi installs from release 9.10 and later (Grub2 only). The instructions should be run from the booted Wubi install (not a liveCD).
Please don't use the manual migration unless you fully understand what you are doing. The automated migration has many additional safeguards and will protect you from errors.
This example assumes the new install will be on /dev/sda5 and that there will be a swap on /dev/sda6. If there is no swap, just ignore lines containing /dev/sda6. If there is a swap partition it must be of type 'swap'. Change the device names as appropriate.
Most of these commands are best cut-and-pasted to avoid typos. If you need to change the device names, I recommend doing it in a text editor before pasting to terminal. Otherwise, if you paste a linefeed by accident the command will run before you have a chance to change it.
1. Do this all as root
1.a. Ensure you do not have grub-legacy. If the output of the following shows version 0.97 then please do not continue. These instructions only work with grub versions 1.96 and greater. You can use the attached script wubi-move-2.2.sh instead.
Code:
grub-install --version
2. Format new partition if not done so already - make sure it's empty, large enough and unmounted
WARNING -- the next command will wipe all existing data on /dev/sda5
Code:
mkfs.ext4 /dev/sda5
3. Mount new partition and copy files.
Code:
mkdir /tmp/wubimove
mount /dev/sda5 /tmp/wubimove
rsync -av --exclude=/host --exclude=/mnt/* --exclude=/home/*/.gvfs --exclude=/home/*/.cache/gvfs --exclude=/media/*/* --exclude=/tmp/* --exclude=/proc/* --exclude=/sys/* --exclude=/var/lib/lightdm/.gvfs / /tmp/wubimove
chmod -x /tmp/wubimove/etc/grub.d/10_lupin
4. Setup swap partition and enable hibernation (swap must be at least as big as RAM to hibernate)
Code:
mkswap /dev/sda6
echo "RESUME=UUID=$(blkid -o value -s UUID /dev/sda6)" > /tmp/wubimove/etc/initramfs-tools/conf.d/resume
5. Edit fstab (blank out wubi mounts with sed and add new partitions)
Code:
sed -i 's:/.*[\.]disk .*::' /tmp/wubimove/etc/fstab
echo "UUID=$(blkid -o value -s UUID /dev/sda5) / ext4 errors=remount-ro 0 1" >> /tmp/wubimove/etc/fstab
echo "UUID=$(blkid -o value -s UUID /dev/sda6) none swap sw 0 0" >> /tmp/wubimove/etc/fstab
6. Remove lupin support and update grub (all in chroot). Note that this step installs the grub bootloader to /dev/sda and will replace your windows bootloader (the line 'grub-install /dev/sda') -- see note below
Code:
mkdir /tmp/wubimove/host
for i in dev proc sys dev/pts host; do mount --bind /$i /tmp/wubimove/$i; done
chroot /tmp/wubimove
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
apt-get -y remove lupin-support
update-grub
grub-install /dev/sda
echo SET grub-pc/install_devices /dev/sda | debconf-communicate
rm /sbin/initctl
dpkg-divert --local --rename --remove /sbin/initctl
exit
for i in host dev/pts dev proc sys; do umount /tmp/wubimove/$i; done
rmdir /tmp/wubimove/host
umount /dev/sda5
7. Update wubi grub menu to pick up new install and exit sudo
You're done. When you reboot, you should see a grub menu instead of the windows boot menu. Select the first entry. If you didn't run 'grub-install' you can boot from the wubi menu, select your new install from the bottom after the Windows entry.
NOTE on installing the grub bootloader: you can try out the new installation by booting it from the wubi grub menu first - if you want to make sure everything is working before replacing the windows bootloader. To do this, bypass the line 'grub-install /dev/sda' and the following line (in step 6.). You can then install the grub2 bootloader manually later after booting into the new install.
I also recommend updating the grub menu after booting into the target partition Other comments:
1. Mounted partitions under /host and /media are excluded from the rsync copy automatically. Partitions mounted under other mountpoints are not and will be copied unless manually unmounted first (when running manual migration).
2. Only the current kernel's initrd.img is updated on the migrated install; if you require others you can update them with "sudo update-initramfs -u -k <kernel version>".
Bookmarks