Results 1 to 10 of 114

Thread: HOWTO: Resize the WUBI virtual disk

Threaded View

  1. #1
    Join Date
    Nov 2009
    Location
    North Vancouver
    Beans
    Hidden!
    Distro
    Edubuntu 14.04 Trusty Tahr

    HOWTO: Resize the WUBI virtual disk

    The information in this thread has been moved to https://help.ubuntu.com/community/Re...licateWubiDisk

    A thread for discussion of the wiki page only can be found here http://ubuntuforums.org/showthread.php?t=2012404

    Thread closed.

    This HOWTO has been moved to community-maintained Wikis:
    ResizeandDuplicateWubiDisk
    ResizeWubiDisk

    For the reason why, see here.
    ================================================== ===========

    This HOWTO describes how to resize a Wubi virtual disk. There are two distinct techniques.

    The first, described here, is not strictly a resize, but rather a duplication to a larger virtual disk. E.g. if you have a 7GB root.disk, and you want to make it 10GB you need 10GB of free space (plus leave enough for Windows). This is safer than attempting to expand the current root.disk.
    This technique must be run from within the booted Wubi install.

    The second technique is a true resize, which must be performed from a live CD. This is much faster and can make better use of the available space. See post #2 for details.

    Automated resize
    Download the attached file wubi-resize_1.5b.sh and save it to your Downloads directory.
    The rest of the resize is run from the Terminal:

    For usage instructions:
    Code:
    bash wubi-resize_1.5b.sh --help
    To create a new 10GB virtual disk:
    Code:
    sudo bash wubi-resize_1.5b.sh 10
    After the script is completed it will instruct you to reboot into windows, rename the file \ubuntu\disks\root.disk to \ubuntu\disks\OLDroot.disk and then ename the file \ubuntu\disks\new.disk to \ubuntu\disks\root.disk
    Do not delete the OLDroot.disk until you have confirmed the new root.disk is working (or keep OLDroot.disk as a backup).

    Note: the script will merge separate virtual disks into a single virtual disk and automatically adjust /etc/fstab accordingly. If this is not desired, use the manual method. The script limits the size of the new virtual disk to 32GB. Please refer to the usage instructions for options if you require a larger size (although I would recommend migrating to a normal install if this is the case).

    How long does it take?:
    To create a 5GB disk from a freshly installed Ubuntu on my machine, "dd" takes 4 minutes, "mkfs" takes 9 seconds, and "rsync" takes 6 minutes. On an older install with lots of files or a fragmented partition, the rsync will take a lot longer.

    New with version 1.5b is the --resume option. You can use this if the initial resize failed to complete normally due to an rsync copy error e.g. file corruption. After fixing the corruption rerun with this option.
    It can also be used to keep an up to date copy of the root.disk (it synchronizes the new.disk with the current install).

    Known issues:
    1. None.

    NOTE: the root.disk is a single file stored on the /host partition. There is a higher risk storing data within this file and I strongly recommend maintaining regular backups. Also avoid hard shutdowns that can lead to filesystem corruption.

    CREDIT... I used the LVPM guide by Gena Kovaks and the scripts by Agostino Russo from the Wubi guide (and lupin package) as reference material.

    The code is now hosted on GitHub. You can keep track of new development or contribute. See https://github.com/bcbc/Wubi-resize


    Manual resize
    For those interested, I've included the commands to perform the resize manually.
    WARNING... the commands "dd" and "mkfs" are very dangerous if used incorrectly (they can destroy all the data on your computer). It is recommended to use the automated resize (the attached script) as there are additional checks and safeguards against errors.

    Please ensure you have enough space for the new virtual disk before proceeding. E.g. for a 10GB disk you'll need 10GB free as well as enough space for Windows to operate. Do not use this if your /host is a FAT32 partition.

    1. Unmount any partitions that are not mounted under /host or /media. (e.g. sudo umount /windows )

    2. Run all commands as root; check free space on /host
    Code:
    sudo -i
    df -h /host
    3. Create a new virtual disk of e.g. 10GB (10,000 MB)
    change count= parameter as appropriate.
    Code:
    cd /host/ubuntu/disks
    dd if=/dev/zero of=new.disk bs=1MB count=10000
    4. Format the disk with the ext4 file system
    Code:
    mkfs.ext4 -F new.disk
    5. Mount and copy files to new virtual disk
    Code:
    mkdir -p /media/newdisk
    mount -o loop new.disk /media/newdisk
    rsync -av --exclude '/sys/*' --exclude '/proc/*' --exclude '/host/*' --exclude '/mnt/*' --exclude '/media/*/*' --exclude '/tmp/*' --exclude '/home/*/.gvfs' --exclude '/home/*/.cache/gvfs --exclude '/root/.gvfs' --exclude '/var/lib/lightdm/.gvfs' / /media/newdisk
    umount /media/newdisk
    exit
    6. You're done!
    Reboot into windows, rename the file \ubuntu\disks\root.disk to \ubuntu\disks\OLDroot.disk
    Rename the file \ubuntu\disks\new.disk to \ubuntu\disks\root.disk
    Reboot back into Ubuntu -- only delete the OLDroot.disk if you are sure it worked.

    NOTE: if you have previously created separate virtual disks e.g. for /home, this process will merge /home back into the new virtual disk. That means you need to remove the separate entry for /home from your /media/newdisk/etc/fstab (before the umount command) (or change the rsync command to --exclude '/home/*' altogether).

    If you are ready to resize you might also consider migrating the Wubi install to a normal dual-boot (to partition).
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Elfy; June 29th, 2012 at 09:08 AM. Reason: New version 1.5b required for Precise Pangolin 12.04

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •