Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I recently did a fresh install of Ubuntu 12.04. I did it on a 16GB USB flash drive, with 964MB for swap and 13.97GB for ext3.

System specs:

  • 2GB DDR2 RAM (800~ frequency range)
  • 3.14GHz single core processor
  • ATI 3600 graphics card

This is the first time I have gotten Ubuntu installed on a USB flash drive (I had another Ubuntu installed on hard drive). The Ubuntu I had on the hard drive worked marvellously faster than my Windows 7; for example, I could be running Google Chrome with around twenty tabs and have Photoshop running without any lag. But now with the USB version I can barely have Google Chrome open with six tabs and browse my home folder at the same time without lag, and freezing of either Chrome or the home folder.

This is a picture of top being used in the terminal:

So could you please help me? Any suggestions will be helpful.

share|improve this question
    
Swap from USB just sounds painful. Is there a spinner, or at least a partition, in your system that you could use for swap? –  Chris May 10 '12 at 3:18
    
Well the thing is that I want to use this usb as a "mobile" OS so that I can always have the programs I need when and where I need them. For example, if I am at a friend's house who does not have Photoshop and I need to use photoshop then I won't need to go back home to use it. So having swap only on my computer would defeat the purpose –  Dib Gill May 10 '12 at 3:42
1  
I think that I would almost rather not have swap than have it on USB, not to mention that it really hard on flash ram to write and rewrite so often. Have you played around at all with swappiness? You could use a file instead of a partition and set it up on the fly with swapon. –  Chris May 10 '12 at 20:20
add comment

3 Answers

Where USB flash drives fail is in random writes to the disk. They can be hundreds of times slower than the same operation on traditional hard drives. Note that this used to be the case with SSDs too until about 3 or 4 years ago when they gained new controller technologies which make them much faster than tradtional hard drives. These technologies pretty much don't exist on USB flash drives).

Operations that will be particularly slow include:

  • Installing new packages, or doing system updates. Expect these to be tens of times slower than traditional hard drives, maybe even 100s of times slower than new SSDs. Upgrading between Ubuntu versions could take several hours or more.
  • General browser use, given that your browser caches files to disk all the time.
  • Operations which involve copying or moving/altering hundreds of small files.

This article on phoronix compares the performance of various file systems on USB flash drives. Unfortunately, its conclusion is that it doesn't make all that much difference. Theoretically, a log-structured file system should help, but these aren't mainstream enough for me to recommend them for the uninitiated.

One idea is to use a read-only or hybrid file-system instead, which is exactly what you get if you copy the Ubuntu Live CD image (or use UNetBootin to set up a live USB) to your USB flash drive. Look into setting up a Live USB from the Live CD image with persistence (try to find a recent guide to doing so). Of course, you then won't be able to upgrade to a new version of Ubuntu, but that's not necessarily terrible.

Barring any such measures, and keeping a traditional partition type/structure, your main strategy will be to try and minimise writes to the disk at all cost. Ideas for this include:

  • Disable journalling on ext4 or set your partitions to "writeback" mode. The drawback to this is that it increases the chances and severity of data loss or corruption in the case of accidental power loss, crash or simply unplugging the drive while it's being used.
  • Mount with "noatime" mode so that there aren't writes to the disk when reading a file.
  • Disable swap, though on a system with sufficient RAM this actually will have much less of an effect than you expect, and on a system with insufficient RAM will cause stability problems.
  • Try to minimise on-disk caching by various programs, such as your browser. Reducing the size of the disk cache is not necessarily enough: turning it off all together and using a memory cache (if possible) is much better. If you're adventurous and have lots of RAM, you could try using a tmpfs mount (like a disk partition in RAM) for things like this.
share|improve this answer
add comment

My answer/suggestion is to avoid expecting too much from USB speed. I think you misunderstood what swap is for. It won't speed up your system to keep swap on your USB since accessing data from USB runs terribly slow when compared to accessing it from HD. Don't forget that most of system data are being kept in RAM when you start OS from memory stick, so running swap from USB makes USB<->RAM data transmission even slower.

Ubuntu will always work much slower from USB stick than from HDD, creating swap wont force Ubuntu to stop using RAM.

share|improve this answer
add comment

Use puppy linux there is one called Precise Puppy based on ubuntu most of it is in memory & it saves a file, settings etc on the drive everytime you reboot works, Way faster would prefer ubuntu on a flash drive also but puppy works good fits on a 4gb flash drive with plenty of room to spare add chrome or firefox with sync and the programs you need works great. It's pretty easy to remaster a new version once you get it how you like it, kinda like ubuntu uck but way easier less to setup.

Most deb files work on it vlc, chrome, firefox, nero 4, deluge, transmission pretty much plays all media files out of the box.

They make some smaller distros especially for running off a usb flash drive so makes it way easier.

share|improve this answer
    
Can you edit your answer to add some punctuation to improve readability? In its current format, this answer is really hard to read. –  Eric Carvalho Mar 28 '13 at 3:31
add comment

Your Answer

 
discard

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

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