Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 114

Thread: HOWTO: Resize the WUBI virtual disk

  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

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

    Re: HOWTO: Resize the WUBI virtual disk

    The first post shows how to 'resize' the virtual disk while running Wubi. This has the advantage that it can be run from within the Wubi install, plus it creates a new root.disk so you automatically have a backup. And since there is a script, it is simpler and has some built in safeguards and error checks.

    There is an alternative method I've found out about (thanks to Trooper_Max). This is a true resize and may be the only option if you simply don't have the room to duplicate the root.disk. While I have tested this a number of times - please make a backup of the root.disk first to be safe.

    Note that FAT32 partitions have a maximum file size limit of 4GB, so this likely won't be of much use.

    In place Resize of root.disk

    1. You have to boot from a live CD/USB. This won't work while running Wubi.

    2. Backup the root.disk

    3. Mount the NTFS partition that your root.disk is on (this example assumes it's /dev/sda1 and the mountpoint is /media/win - adjust accordingly in the following instructions):
    Code:
    sudo mkdir -p /media/win
    sudo mount /dev/sda1 /media/win
    3.i. Check the size of the root.disk (not required)
    Code:
    du -h --apparent-size /media/win/ubuntu/disks/root.disk
    4. Run fsck on the root.disk
    Code:
    fsck -f /media/win/ubuntu/disks/root.disk
    5. Resize - specify the desired final size (this example resizes to 10 GB)
    Code:
    resize2fs /media/win/ubuntu/disks/root.disk 10G
    6. Reboot back into Wubi Ubuntu
    Last edited by bcbc; August 26th, 2011 at 06:32 PM. Reason: Emphasize mountpoint

  3. #3
    Join Date
    Mar 2010
    Location
    /home
    Beans
    9,386
    Distro
    Xubuntu

    Re: HOWTO: Resize the WUBI virtual disk

    Excellent stuff bcbc and thanks for sharing this information with us.

  4. #4
    Join Date
    Feb 2011
    Beans
    9

    Re: HOWTO: Resize the WUBI virtual disk

    I got this when I used the script:

    Code:
    seltor@ubuntu:~$ sudo bash wubi-resize_1.3b.sh 20
    [sudo] password for seltor: 
    wubi-resize_1.3b.sh: A new virtual disk of 20 GB will be created. Continue?
    y
    wubi-resize_1.3b.sh: Creating new virtual disk (new.disk)...
    wubi-resize_1.3b.sh: Formatting new virtual disk as ext4.
    wubi-resize_1.3b.sh: Copying files - this will take some time.
    wubi-resize_1.3b.sh: Please be patient...
    wubi-resize_1.3b.sh: Copying files failed or was canceled
    wubi-resize_1.3b.sh: Please wait - cleaning up...
    wubi-resize_1.3b.sh: Operation aborted

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

    Re: HOWTO: Resize the WUBI virtual disk

    Quote Originally Posted by Sidner View Post
    I got this when I used the script:

    Code:
    seltor@ubuntu:~$ sudo bash wubi-resize_1.3b.sh 20
    [sudo] password for seltor: 
    wubi-resize_1.3b.sh: A new virtual disk of 20 GB will be created. Continue?
    y
    wubi-resize_1.3b.sh: Creating new virtual disk (new.disk)...
    wubi-resize_1.3b.sh: Formatting new virtual disk as ext4.
    wubi-resize_1.3b.sh: Copying files - this will take some time.
    wubi-resize_1.3b.sh: Please be patient...
    wubi-resize_1.3b.sh: Copying files failed or was canceled
    wubi-resize_1.3b.sh: Please wait - cleaning up...
    wubi-resize_1.3b.sh: Operation aborted
    The copy command is supposed to output the reason for the failure. The only time it didn't for me was when I canceled it manually (CTRL+c).
    You could try the --verbose option, and see if rsync (the command used to copy) provides more detail about the error.

  6. #6
    Join Date
    Jul 2006
    Location
    Currently in Riyadh
    Beans
    Hidden!
    Distro
    Ubuntu 11.04 Natty Narwhal

    Smile Re: HOWTO: Resize the WUBI virtual disk

    Thanks dude. Technique 1 worked beautifully for me the other day. Thanks for the easy to understand commands. Cheers

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

    Re: HOWTO: Resize the WUBI virtual disk

    Quote Originally Posted by ryanh06 View Post
    Thanks dude. Technique 1 worked beautifully for me the other day. Thanks for the easy to understand commands. Cheers
    Great, you're welcome! Thanks for the feedback.

  8. #8
    Join Date
    Dec 2008
    Beans
    2

    Re: HOWTO: Resize the WUBI virtual disk

    post [#2] worked great (i think), something is a bit wrong with the display but im not sure its because of this...

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

    Re: HOWTO: Resize the WUBI virtual disk

    Quote Originally Posted by guyknt View Post
    post [#2] worked great (i think), something is a bit wrong with the display but im not sure its because of this...
    hmm... it seems unlikely. The root.disk is like a partition. If it failed I'd expect it to result in file system corruption, not display changes. What sort of changes are you seeing?

  10. #10
    Join Date
    Dec 2006
    Location
    Barcelona
    Beans
    1
    Distro
    Ubuntu

    Re: HOWTO: Resize the WUBI virtual disk

    Quote Originally Posted by bcbc View Post
    EDIT
    Code:
    cd /host/ubuntu/disks
    dd if=/dev/zero of=new.disk bs=1MB count=10000
    3.
    This is faster :


    Code:
    dd if=/dev/zero of=new.disk bs=1MB seek=1000 count=1

Page 1 of 12 12311 ... LastLast

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
  •