Installing Ubuntu to a USB Hard Disk


Something that I had dabbled with, but never successfully managed until today, was installing Ubuntu to my 250GB external USB hard disk. Obviously, it could easily be done by booting into the installer from a burned CD; but, I wanted to install it without having to shut my system down.

The advantage of having Ubuntu installed to an external hard disk is that it can be booted on any computer that supports booting from USB, and isn’t restricted by the slow read speed that Live CDs suffer from.

There are a few sources which detail how one might accomplish this, but I thought I’d provide my own up-to-date one which covers all of the bases. The ones that I read to accomplish this were all missing some important note.

Pre-requisites

Preparation

Before we begin the installation of the system, we must ensure that a few things are configured properly, and gather a little bit of information.

Adding yourself to the vboxusers group

vboxusers group configuration

During the installation of VirtualBox, it should create a system group called vboxusers. This group provides necessary privileges for things like USB devices. In order to have those privileges, you must add yourself to the vboxusers group. This can be done via System -> Administration -> Users and Groups -> Manage Groups. Find “vboxusers” in the list of groups, and open the Properties. Enable your user in the Group Members list.

Once you have added yourself, you must log out and then back in for the privileges to take effect.

Prepare your hard disk

Of course, before you go to make substantial changes to your external disk, you should make sure that any data on it is backed up off-disk. As well, make sure that there is sufficient unpartitioned space on the device for the installation. I recommend keeping any unrelated partitions towards the end of the disk, for performance reasons.

Ensuring your USB device is available

Before your VirtualBox guest can “capture” the USB device associated with your external hard disk, you must make sure the host system is not using it. To do this, unmount any partitions existing on the drive, then right-click one of the partitions in the device list in Nautilus and click “Safely Remove Drive”.

To ensure this has worked, run VBoxManage list usbhost in a terminal. Find your device in the list, and ensure that its “Current State” is “Available”. If it is still busy, you might try disabling automatic mounting in Nautilus, and then power-cycle the device.

Creating the VirtualBox Machine

Our VirtualBox machine will be very simple. It need not have a VDI disk file associated with it, because we will be booting our machine from the Ubuntu Install CD.

General configuration

I won’t detail the entire process of creating a VirtualBox guest, because there are better guides for that which will stay up-to-date as time progresses. However, I suggest giving the guest at least 1GB of memory (if free on the host), and a fair amount of video memory. As well, disable the “Boot Hard Disk” option during configuration.

Install CD

In the settings for the guest machine, add an IDE Controller to provide a CD-ROM device, selecting your Ubuntu Install CD as the device. Set it as the IDE Primary Master.

USB device

Under the USB settings for the guest machine, add a filter for the USB device associated with your external disk. This is done simply by clicking the “Add Filter From Device” button and selecting your drive.

Doing this will automatically capture the drive’s device when your guest machine starts, so that it is available when the Ubuntu Installer loads.

Performing The Installation

Start your virtual machine, booting into the Ubuntu Install CD. I won’t bother detailing the install process for Ubuntu, as it is likely to change drastically from version to version.

If your drive is not showing up during the install process, then your host has probably captured the device before your guest could. See the section above called “Ensuring your USB device is available”.

, , , ,

  1. No comments yet.
(will not be published)
*