The partition(s) must be created already - there are plenty of guides on how to do this.
Manual migration (see below for automated migration)
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.
1. Do this all as root
sudo -igrub-install --versionWARNING -- the next command will wipe all existing data on /dev/sda5
mkfs.ext4 /dev/sda5mkdir /tmp/wubimove
mount /dev/sda5 /tmp/wubimove
rsync -av --exclude=/host --exclude=/mnt/* --exclude=/home/*/.gvfs --exclude=/media/*/* --exclude=/tmp/* --exclude=/proc/* --exclude=/sys/* / /tmp/wubimove
chmod -x /tmp/wubimove/etc/grub.d/10_lupinmkswap /dev/sda6
echo "RESUME=UUID=$(blkid -o value -s UUID /dev/sda6)" > /tmp/wubimove/etc/initramfs-tools/conf.d/resumesed -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/fstabmkdir /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
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/sda5update-grub
exitNOTE 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' (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
sudo update-grubI have attached a parameter driven script that does the above with additional validation e.g. checks the target partition is big enough and empty etc.
Usage instructions:
bash wubi-move.sh --helpsudo bash wubi-move.sh /dev/sda5sudo bash wubi-move.sh /dev/sda5 /dev/sda6sudo bash wubi-move.sh --no-bootloader /dev/sda5 /dev/sda6Warning - while I have tested this numerous times and every attempt has been made to ensure there are no bugs, use it at your own risk.
Please note - it takes some time to copy all the data from wubi to the target partition. e.g. on my computer it takes about 5-10 minutes for a small install (5GB).
Known issues:
1. For some reason, running "update-grub" in the chroot doesn't pick up other linux installations on the same drive (same running the script or manual commands listed above). This is unlikely an issue for wubi users. Run sudo update-grub after booting the new install for the first time.










at 8:39 PM Posted by nasweef
0 comments