Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm told to install ubuntu on my laptop for work in order to learn shell scripting. I've read the best way is to install ubuntu on a USB stick and partition my HDD. I'm curious how an OS is bootable from a USB stick? Is it literally just a small interface that can be put anywhere?

This reminds me of a time I downloaded a game onto my USB stick, when I brought it to my friends house he told me it will run slow if I don't install it and only run it from the usb, is this different from running ubuntu from a usb? Will ubuntu be slow?

share|improve this question

migrated from programmers.stackexchange.com May 31 at 13:01

This question came from our site for professional programmers interested in conceptual questions about software development.

2  
because bios can read the usb and it can contain a boot sector that will then act as a normal bootable disk drive –  ratchet freak May 30 at 19:52
    
With regards to speed, it will depend on the USB drive and the port it's plugged in to. I have Mint (based on Ubuntu) on a USB 3.0 stick, plugged into a USB 3.0 port on my computer and I hardly notice a difference between it and my HD-based install. With USB 2.0 port and a lower quality drive, it might feel laggy. –  Mike E May 30 at 19:58
    
Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask –  gnat May 30 at 21:39

3 Answers 3

Operating systems can be booted from any media, and, in the case of PXE booting, from no media at all. When they run, they run nearly all of their important features from RAM. In this case, with a bootable linux distro, you can give it a little hdd space to do it's thing as well.

Obviously it's not going to have the same performance as a regular install, but this sort of setup is very good for learning, since you can restore it to its original state at any time.

share|improve this answer
    
In theory, firmware can be written that boots off anything that can provide a series of bytes. –  Steven Burnap May 30 at 20:23

Bits are just bits. The same bits can be an OS if they're loaded from the drive as if they're loaded from a CD or USB or a network. All that matters is that the BIOS knows how to read those bits.

Games are a bit different because kernel memory cannot be swapped anyway and games involve a lot more I/O.

share|improve this answer
    
Games today nearly always run on top of an OS. –  Steven Burnap May 30 at 20:38

I'm told to install ubuntu on my laptop for work in order to learn shell scripting.

You can also probably make do if you install Cygwin, but you will have an emulated Linux environment and not a real one. For just learning about shell scripting it may not matter, though.

I've read the best way is to install ubuntu on a USB stick and partition my HDD. I'm curious how an OS is bootable from a USB stick?

BIOSes simply ask a boot device for sector 0, put it in memory somewhere, and then run what's there. As long as they know how to ask the boot device for that sector (early BIOSes only worked with floppies and have gradually learned about other devices such as CD-ROMs and USB drives over the years), it's all the same. As long as sector 0 of the USB drive has a valid bootloader and partition table most BIOSes can boot from it (you may need to bring up a boot menu with F12 or something like that during boot).

UEFI is a bit smarter and actually loads a file from a partition on a device, but as long as UEFI knows know to do that with a device, it doesn't care about the kind or type of device.

Is it literally just a small interface that can be put anywhere?

Linux is very versatile, it can run read-only from a CD-ROM, directly from a portable drive, from a hard drive, from flash, and other weird possibilites. You can guarantee that if someone has needed Linux to boot in a strange way that it's possible and has been done. The original Xbox-hacked Linux installer actually ran Linux from a large file mounted as a loop device.

he told me it will run slow if I don't install it and only run it from the usb, is this different from running ubuntu from a usb?

He's right. USB drives are slower than internal hard drives (CD-ROMs are even slower). However, if all you are doing is running the shell in Terminal or learning about Linux, it'll do.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.