Ubuntu install on windows box

This post explains the steps to install Ubuntu under Windows with the Wubi installer. It then continues to outline the steps to move the Ubuntu install with LVPM to its own partition and make it the primary OS. Next it explains how to replace the Ubuntu install with another Ubuntu install. Finally it explains how to make the original Windows OS run virtually within/under the Ubuntu OS with VMWare and VirtualBox.

Installing Ubuntu in Windows with Wubi

- Cleanup, compress, remove unnecessary cruft, and empty the trash from existing windows install
- Backup existing windows install with something like Acronis
- Download Wubi Ubuntu installer and install Ubuntu in a file within the existing windows partition

Note: Now Ubuntu will be listed in the boot list and you can boot into either OS.

Moving Ubuntu to its own partition

- Reboot into the Ubuntu live CD and repartition the drive.

- Enter the BIOS menu and set the boot order to CD/DVD drive before HDD, i.e., Restart the computer and repeatedly press F12 until the boot order menu appears, select IDE CD/DVD drive
- Shrink the Windows partition to just what you need, you can increase it later if needed
- Create a linux-swap partition at the end of the drive
- Create an extended partition for the remainder of the drive
- Create an ext3 partition within the extended partition for Ubuntu 10 GB is more than enough - Vista without Office or Outlook takes ~14-18 GB where Ubuntu needs only ~6 GB with Office and Outlook functionality and more
- Record all the partition names, you'll need them to fix the boot loaders i.e.,

- /dev/sda1 - windows ntfs
- /dev/sda3 - extended
- /dev/sda5 - ext3
- /dev/sda2 - linux-swap


Move Ubuntu into the ext3 partition

Running Wubi Ubuntu on the Windows ntfs partition


- Download/install LVPM
- Run it from Applications : System Tools : LVPM
- Select Transfer
- Select target partition (ext3 or /dev/sda5)
- Select Continue and click OK - will copy Ubuntu to new partition and install GRUB boot loader in MBR
- Reboot - will likely get Error 17: Cannot mount selected partition
- Type 'e' to edit the grub boot loader
- Select the root ()/ubuntu/disks line and type 'e' to edit
- Change the line to root (hd0,4) hd0 is first hard disk, 4 is the 5th partition, just subtract one from whatever partition Ubuntu is in
- Hit enter to complete the edit, then type 'b' to boot
- Now edit the grub /boot/grub/menu.lst to permanently change the boot menu
- Open a terminal window and type sudo gedit /boot/grub/menu.lst
- Change the lines root ()/ubuntu/disks to read root (hd0,4)
- Reboot and test

Removing Ubuntu from Windows

- Now you can uninstall Ubuntu from windows, run the executable uninstaller under the Ubuntu directory
- If you need to edit the Windows boot menu to remove the Ubuntu OS - Vista has an editor and doesn't use boot.ini file anymore.

Copying another install of Ubuntu

Packaging up the Ubuntu install you want to copy

Backup your System with tar

- Boot into the Ubuntu live CD on the system you want to copy
- Mount and cd to the partition you want to copy
- sudo tar -cvvzf /destDir/destFile.tar /srcDir/
i.e.,
Backing up while not running the OS in the partition:

sudo tar -cvvzf /media/SimpleDrive/dellSudioUbuntu8.0.4.tar.gz .
or 
sudo tar -cvpzf /media/SimpleDrive/DellStudio1735/dellUbuntu8.04_rt_old.tar.gz .

Can backup live but command needs some excludes:

sudo tar cvpzf /media/SimpleDrive/DellStudio1735/dellUbuntu8.04_rt.tar.gz \
--exclude=/proc \
--exclude=/lost+found \
--exclude=/dev \
--exclude=/mnt \
--exclude=/media \
--exclude=/sys \
--exclude=/tmp \
--exclude=/var/cache/apt .

Record the output to inspect for issues:

sudo tar cvpzf \
/media/SimpleDrive/dell.1735.Ubuntu.8.04.tar.gz . \
> /media/SimpleDrive/dell.1735.Ubuntu.8.04.tar.log


cd /media/ubuntu8.10

sudo tar cvpzf \
/media/FreeAgent\ Drive/backups/DellStudio1737/Ubuntu9.10/dellStudio1737Ubuntu9.10.tar.gz . \
> /media/FreeAgent\ Drive/backups/DellStudio1737/Ubuntu9.10/dellStudio1737Ubuntu9.10.tar.log

Copying from one partition to another to backup:

#/dev/sdb7 Ubuntu 10.04_64
cd /media/winXpVM
cp -rvp . /media/winXPbackup2
#/dev/dsa7 winXpVM
cd /media/Ubuntu10.04_64
sudo cp -rvp . /media/ubuntu10.04_back

- NOTE: untarring created dir /media/disk-1 under /media/disk-1, should probably have tared differently
packages and compresses the contents of the srcDir to the destFile in destDir
i.e., sudo tar -cvvzf /media/disk-1/basicUbuntuInstall.tar.gz /media/disk-1/


Un-packaging the copied Ubuntu install on new partition

- On the target system boot into the Ubuntu live CD on the system
- Create a new partition for the copied Ubuntu install, i.e., a new ext3 partition in extended partition
- cd to the root of the target partition, i.e., /media/disk-1
- Un-package the Ubuntu install into the target system in the new partition with tar -xvvzf /srcDir/srcFile.tar.gz
- Due to issue tarring, had to move the contents to root of mount /media/disk-1

Fix the grub boot menu to point to copied install

- Edit grup menu.lst to add new Ubuntu entry for new partition, copy another and change the parameters
- Execute ls /dev/disk/by-uuid -alh to get a list of UUIDs
- Edit and correct the /etc/fstab from the copied system to be like the basic install, but mount the new install partition

- Reinstall grub so it points to new install
- sudo grub
- find /boot/grub/stage1
- Select new install drive and partition
- root (hd?,?) replace ? with drive and partition from new install
- setup (hd0)
- quit

Fix video config if different

The video card wasn't recognized.
- Run sudo dpkg-reconfigure -phigh xserver-xorg
- Reboot
- Good to go!

Backup

cd /media
sudo mkdir ubuntu
sudo mount -t auto -v /dev/sda6 /media/ubuntu
cd ubuntu/

cd /media
sudo mkdir mybook
sudo mount -t auto -v /dev/sdb1 /media/mybook

mkdir /media/mybook/backups/Laptop/Latitude

cd /media/ubuntu
sudo tar cvpzf /media/mybook/backups/Laptop/Latitude/LatitudeUbuntu12.04.tar.gz . > /media/mybook/backups/Laptop/Latitude/LatitudeUbuntu12.04.tar.log


sudo fdisk -l
sudo mkdir /media/ubuntu
cd /media/
sudo mount -t auto -v /dev/sdb3 /media/ubuntu/
cd /media/ubuntu/

sudo tar cvpzf /media/troy/FreeAgent\ Drive/backups/asus/ubuntuPreSummerVacationMaine.tar.gz . > /media/troy/FreeAgent\ Drive/backups/asus/ubuntuPreSummerVacationMaine.log

Comments

Droopy said…
I will be needing this in the near future! Good article troy.
Regards,
Kevin

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout