installation of Ubuntu on a USB stick, without overlay filesystem

Asked by Daniel C. Axelrod

I'd like to know if there are any guides for configuring a "regular" installation of Ubuntu to work well on a USB stick, rather than the ISO live environment plus persistence that usb-creator sets up.

Some background:
I've been using Ubuntu via a USB stick "live" installation created with usb-creator.

I'm very happy with it, except for the extra space used as a result of the overlay filesystem. Whenever I update anything that existed as part of the original installation, the stick now has two copies of it; one from the original readonly iso, and one in casper-rw. I know I can remaster the ISO periodically, but this is somewhat of a pain.

Every guide I've seen for Ubuntu on a USB stick has assumed the Live-USB method of ISO-plus-persistence, for example,
https://help.ubuntu.com/community/Installation/FromUSBStick
https://help.ubuntu.com/community/USB%20Installation%20Media

What I'd like to accomplish:
I'd love to use the regular Ubuntu installer to create a regular installation on my USB stick, and then configure it appropriately.

I can think of the following things I'll need to worry about, but what have I missed?
-move /tmp to a ramdisk
-mount root filesystem with options that minimize writes

Any suggestions or pointers would be greatly appreciated.

Thank you so much to the entire Ubuntu community for being helpful and inspiring, and creating amazing software.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Vu Do Quynh (vu-do-quynh) said :
#1

Hi,

What you want to do, in to install USB to an external USB disk (flash drive or partitioned hard disk). You can follow instructions on this page:

http://www.zdnet.com/blog/hardware/how-to-install-ubuntu-804-on-a-usb-flash-drive/1873

If you are on a desktop, it is better to open the case and disconnect the internal hard drives (maximum security)
If you are on a laptop, you could also open the belly and disconnect the internal hard drive.

otherwise be careful to (1) select the right device to install and (2) before proceeding with actual installation (step 7 : go to advanced and select the right device to install grub => should be the external device of course, unless you want to boot your computer always with the external device plugged in)

Hope that helps.

Revision history for this message
Daniel C. Axelrod (daxelrod) said :
#2

Thank you.

Unfortunately, those instructions only go as far as pointing the installer at a USB stick, they don't make any recommendations for how to configure the system after it's been installed.

I know that Ubuntu will *work* when installed on a USB stick, but there are plenty of aspects of the default configuration that will wear out the hardware very quickly, including frequent logging, swap, etc.

I'm trying to figure out what all of those factors are.

Revision history for this message
Vu Do Quynh (vu-do-quynh) said :
#3

Hi again,

You may wish at the partitioning step to use ext2 instead of ext3/ext4, if you install to an USB key. This is because ext2 does not do journaling of the system so writing is reduced to the USB devices.

If you do not need swap, you may get rid of it. However you need to have at least 1 GB RAM. Swap is useful when you do not have enough RAM, then the system will need a buffer to hold temporary files, and it is usually "bad" when the system starts to use swap a lot. If you have plenty of RAM in excess, you may not need a swap file.

If you do wish to hibernate your system, then you'll need a swap file at least equal to the amount of your RAM.

Once installed on your USB device, you can configure the system, install new packages, proceed with updates/upgrades, etc.

You need at least one 4 GB USB, preferably 8 GB USB disk, or better 16 GB USB disk if you are going to install lots of stuff.

Hope that helps.

Can you help with this problem?

Provide an answer of your own, or ask Daniel C. Axelrod for more information if necessary.

To post a message you must log in.