1

I want to create a bootable USB with Ubuntu Server on my flash drive. I have created such media using Rufus, but instead of being bootable Ubuntu instance, I got installation media. How can I create bootable USB?

1

A method I like is to use Virtualbox to setup Ubuntu Server (and other OS's I need).
This is what you need:

  • one usb thumb with around 32GB
  • Linux with installed Virtualbox

Choose VDI as storage and size the disk around 2GB less then the total size of your thumb or just straight use a less size - like 30GB for the storage (virtual disk). Just install everything and customize Ubuntu server as you like it. After that just do the following (shutdown the virtual Ubuntu server fist)

open a terminal and go where the VDI file of you server resists
Enter:
VBoxManage clonehd nameofyour.vdi sdx.raw --format RAW

In case you get an Error like:
VBoxManage: error: Cannot register the hard disk 'nameofyour.vdi' {UUID} because a hard disk 'nameofyour.vdi' with UUID {UUID} already exists

just copy and paste the "{UUID}" and replace "nameofyour.vdi" with this uuid like in this example:
VBoxManage clonehd 3cde9fac-41f3-4260-835e-100991fdb581 sdx.raw --format RAW

Now you should have a RAW Image. Proof it with "file sdx.raw" for example. You should see something like this:

/data/sdb.raw: DOS/MBR boot sector; GRand Unified Bootloader, stage1 version 0x3, stage2 address 0x2000, stage2 segment 0x200, GRUB version 0.94

Now you can write this Image to your USB Thumb with "dd" like in this example:

insert you USB thumg and proof with "dmesg" for the correct device name.
This could also be done with the command "lsscsi"
if you determinate the right destination device use "dd" to write the
image like in this example (as root user):
dd if=/data/sdx.raw of=/dev/sdc bs=4096

after that you are done. In additional you can proof is the USB Thumb is booting also inside Virtualbox if you like. Just create a VMDK File from you inserted USB Thumb (you need to know the /dev/sd-name). For example:

VBoxManage internalcommands createrawvmdk -filename ubuserver.vmdk -rawdisk /dev/sdc

Make sure your user (where you run Virtualbox) is a member of the group "disk" (sudo adduser $USER disk) Now add the virtual disk created as the VMDK file to your virtual-machine and remove the current vdi file. (VirtualBox Gui -> Click on the VM -> Settings -> Storage --> Storage Tree After tat you should be able to boot this USB Thumb in Virtualbox.

| improve this answer | |
0

What you've done is setup an install medium rather than a bootable distro.

While this may not be the best way of doing it, it works and is what I tend to do if I need to set up a bootable USB.

You will need

  • A second USB stick

Method

  • If you are dead set that you want it installed on the USB you're currently using, setup your install medium on the new one and format the desired one for installation. If not, and you can just install on the other USB, skip this step.

  • Boot from your install USB with your desired bootable one plugged in.

  • Go through the usual install steps until you get to partitioning the device. I'm assuming this is a graphical installation btw. Please correct if not.

  • At this point you're going to want to ensure that you're only including the desired bootable USB in the partition table. It'll likely be under /dev/sdb or /dev/sdc. It should be obvious which one to choose based on size and space available. Setup your partitions.

  • Before moving on, ensure that the desired boot location matches the device that you've set up the partition table on: dev/sdb or /dev/sdc. Otherwise you run the risk of messing up your PC's boot record with the added effect that your USB will only boot on that PC. In the graphical installer, this is usually a dropdown menu at the bottom of the partitioning screen.

  • Then just continue the install as usual.

If you need any further info, give me a shout.

Hope I've been of some assistance.

Edit - Courtesy of Fiximan

In case of only one USB flash drive: the iso can also (temporarily) be added into GRUB menu and then be booted into. See here

| improve this answer | |
  • All sorted now? If so, would you mind accepting the answer so that others will know at a glance that the question has been solved? – I_GNU_it_all_along Aug 18 '16 at 11:53
  • In case of only one USB flash drive: the iso can also (temporarily) be added into GRUB menu and then be booted into. See here – Fiximan Aug 18 '16 at 15:01
  • Thanks bud, I didn't know. Added in as an edit. – I_GNU_it_all_along Aug 18 '16 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.