Skip to content

hakuna-m/Wubi-move

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wubi-move.sh
============

This is a bash script that migrates a Wubi install to a partition. The script is based on the wubi-move-to-partition script from Agostino Russo taken the Wubi Guide (https://wiki.ubuntu.com/WubiGuide).

The first version updated the wubi-move-to-partition script to correct a few problems and deprecated commands, as well as to update it to support Grub2. It only worked on Wubi installs from 9.10 and later.

The current version adds the following features:
1. Supports migration of a normal (non-wubi) Ubuntu install. This can be useful to create a working backup, move your installation between computers, or create a working copy to experiment with.
2. Supports migration of a Wubi install from just the root.disk file (option --root-disk= ). This can be performed from an Ubuntu live CD/USB or another Ubuntu install. The named root.disk must be a fully-contained, working Wubi install, or if there are separate virtual disks for /home and /usr these must be in the same directory as the root.disk. (This option does not support Wubi with grub-legacy i.e. originally installed prior to the 9.10 release).
3. It supports migration of a Wubi or Normal install that uses grub-legacy - however it will replace grub-legacy with Grub2 (only on the migrated install). It does not update the current install's menu.lst so it is recommended to always install the Grub2 bootloader (or modify menu.lst manually).
4. The option --shared-swap can be used if you will be sharing an existing swap partition with another install. It bypasses the 'mkswap' command to avoid modifying the UUID.
5. It supports the ability to migrate to separate /boot, /usr and /home partitions.
6. It suppors the ability to synchronize a migrated install (e.g. for a bootable backup)

Usage: sudo bash wubi-move.sh [OPTION] target_partition [swap_partition]
       e.g. sudo bash wubi-move.sh /dev/sda5 /dev/sda6

Migrate an ubuntu install (wubi or normal) to partition
  -h, --help              print this message and exit
  -v, --version           print the version information and exit
  --notes                 print the Assumptions and Notes, and exit
  --no-bootloader         do not install the grub2 bootloader
  --shared-swap           share swap partition with an existing install
  -y, --assume-yes        assume yes to all prompts
  --root-disk=<root.disk> Specify a root.disk file to migrate
  --boot=</dev/sdXY>      Specify a separate /boot partition
  --home=</dev/sdXY>      Specify a separate /home partition
  --usr=</dev/sdXY>       Specify a separate /usr partition
  -c, --check-only        Check only - validate target partition(s)
  --resume                Resume a previous migration attempt that ended
                          due to copying errors (rsync).
  --synch                 Synchronize a previously migrated install

Assumptions: 
  1. The script will detect automatically whether the current install
     to be migrated is a Wubi or normal install. 
  2. If you are running the script from a live CD/USB then the 
     --root-disk= option is required. The grub2 bootloader must be
     installed when using this option. If there are separate virtual
     disks (e.g. usr.disk, home.disk), they must be in the same 
     directory as the root.disk. (Grub-legacy not supported).
  3. The grub2 bootloader will be installed to /dev/sdX where /dev/sdXY
     is the target partition, unless --no-bootloader is specified.
     You will still be prompted whether to install the grub bootloader 
     unless option -y or --assume-yes is supplied.
  4. If the install being migrated contains grub-legacy it will be 
     replaced with Grub2 (only on the migrated install). You are not 
     required to install the Grub2 bootloader, however, if you choose
     not to then you will have to manually modify the menu.lst to boot
     the migrated install.
     NOTE: the grub2 installation takes control and requires user input
     on releases 9.10 and greater. It will also prompt for the bootloader
     install drive/partition.
  5. The target partition file system will be formatted as ext4 (default) 
     or ext3 if detected on the install being migrated. The script will not
     modify the partition type i.e. set it to 83 (linux)
  6. The script supports migrating from multiple partitions, and also
     to multiple partitions. Separate target partitions are supported
     for /boot, /usr and /home.
  7. If the migration terminates due to a corrupted file, after fixing, 
     rerun the script with the --resume option. This picks up from where
     it left off, potentially saving a lot of time. The target partitions
     must be the same as in the prior run.
  8. The --synch option will resynchronize a migrated install. New or modified
     files will be synchronized with the migrated install. The target partitions
     must be the same as in the previous migration. CAUTION: files that have
     been added only on the target will be deleted.


Notes:
  If you install the grub bootloader, then the grub menu from your migrated
  install will be presented at boot - not the windows menu (for Wubi installs.)
  If you do not install the bootloader, then you will still be able to 
  boot the migrated install from the current install's Grub menu, unless your
  current install uses grub legacy.
  For Wubi users, make sure you install bootloader before uninstalling Wubi. 

  To install the bootloader manually, boot your new installation and run: 
       sudo grub-install /dev/sdX 
  (where X is the drive you boot from e.g. /dev/sda)

Recommended:
  Run "sudo update-grub" on the migrated install after booting the first time

Packages

No packages published

Languages

  • Shell 100.0%