Slashdot Mirror


Optimizing Linux Use On a USB Flash Drive?

Buckbeak writes "I like to carry my Linux systems around with me, on USB flash drives. Typically, SanDisk Cruzers or Kingston HyperX. I encrypt the root partition and boot off the USB stick. Sometimes, the performance leaves something to be desired. I want to be able to do an 'apt-get upgrade' or 'yum update' while surfing but the experience is sometimes painful. What can I do to maximize the performance of Linux while running off of a slow medium? I've turned on 'noatime' in the mount options and I don't use a swap partition. Is there any way to minimize drive I/O or batch it up more? Is there any easy way to run in memory and write everything out when I shut down? I've tried both EXT2 and EXT3 and it doesn't seem to make much difference. Any other suggestions?"

137 comments

  1. Get a swap partition by bluefoxlucid · · Score: 2

    Get a swap partition so that you can free up some memory for disk cache, for one. Enable laptop mode too.

    1. Re:Get a swap partition by Anonymous Coward · · Score: 0, Troll

      If you get a swap partition, make sure it is on a conventional hard drive, *NOT* the flash drive. All the writes involved in dedicating part of a flash drive to swap is a great way to burn that part of the memory out in a hurry.

    2. Re:Get a swap partition by Creepy+Crawler · · Score: 2, Interesting

      Well, laptop mode's an obvious. However, I would not enable swap at all, or at least put it on the FS somewhere. If you do that, you wont be able to hibernate properly. Nor will hibernation work properly if you encrypt swap (partition).

      You're looking at standby or poweroff events due to encrypted partitions and systems. That's the pain you pay for. There is another way... TCPA, and IBM has writen the requisite linux tools to utilize it properly. Just everybody's too scared to use it properly.

      --
    3. Re:Get a swap partition by Anonymous Coward · · Score: 0

      Are you insane? Swapping to USB stick is the last thing you want to do: you'll wear down the NAND chips and the system will be slower than you can imagine!

      Disk I/O will be disastrous, live with it. Enable write caching, and use a filesystem like cramfs to compress the files on disk. More stress on the CPU, but less disk I/O.

    4. Re:Get a swap partition by bluefoxlucid · · Score: 3

      FUD. Learn wear leveling.

    5. Re:Get a swap partition by Paradigm_Complex · · Score: 1

      Just to clarify for anyone who misunderstood this, I believe bluefoxlucid was referring to a swap partition *on a local hard drive* and not on the USB flash drive. For example, if you're booting on what typically is a Linux machine there is a very good chance that there is already a local swap partitioned off. Just be wary about what you may leave behind if you're not careful.

      --
      "A witty saying proves nothing." - Voltaire
    6. Re:Get a swap partition by bluefoxlucid · · Score: 1

      Hey guess what? Every access to FAT writes to the same area of the file system (the FAT), and this is what destroys old-style floppy disks. Do you see Windows chewing up USB drives like crazy? No? Do you think you swap that much? Readyboost is more intensive than swap partitions (unless your system has decided to grind to a halt due to swap thrashing, and it's time to press the big red button).

    7. Re:Get a swap partition by bluefoxlucid · · Score: 1

      No, put it on flash. It'll be faster than a local hard drive and won't leave crap behind; though in practice, the seek speed probably won't make a difference unless you're about 2 seconds away from resetting the system for not responding anymore.

    8. Re:Get a swap partition by Anonymous Coward · · Score: 2, Funny

      Does anyone actually use Readyboost??

    9. Re:Get a swap partition by Anonymous Coward · · Score: 3, Informative

      No, put it on flash. It'll be faster

      No, it will most certainly be much slower. The memory page size is 4K, whereas the typical flash block size is much bigger. Flash can only be erased in blocks, so to write one small 4K page to flash memory, the controller has to read a whole block, erase the flash block and write back the modified block. That's why most flash storage devices suck so badly at storing many small files, even though the continuous write speed isn't too bad.

      The performance penalty could be hidden by the OS: Instead of swapping out when you need the memory and have to wait for the write operation to complete, it could swap out preemptively and in larger chunks, mark the pages as swapped out but valid, and keep using the memory (invalidating the swap on writes). Then, if something else needs the memory, it only needs to swap out the pages which have been invalidated in the meantime. The drawback is that USB is processor-intensive, so you'd have to find a balance in order to avoid unnecessarily bogging down the CPU (thereby wasting battery life) with useless swap writes and not waiting too long for small swap writes. Needless to say, this is not how swap works today.

    10. Re:Get a swap partition by scotsghost · · Score: 1, Interesting

      Or on a mostly-Windows machine, you can always use a local-drive-based swapfile (there's likely no swap partition). Mount NTFS drive, create a "myswapfile" somewhere innocuous, mount it as a loopback swap partition (-o loop). Delete it on unmount (as part of your shutdown process) -- if you're truly paranoid you can even take the time to scrub the sectors your swap was using.

      Don't swap to the flashdrive -- you'll just hog USB bandwidth that you need for reading & writing real files off your root partition.

    11. Re:Get a swap partition by vrmlguy · · Score: 2, Informative

      Every access to FAT writes to the same area of the file system (the FAT), and this is what destroys old-style floppy disks.

      That's why people use a flash file system http://en.wikipedia.org/wiki/File_system#Flash_file_systems. http://en.wikipedia.org/wiki/YAFFS is a good choice; it seems to be used in Android.

      --
      Nothing for 6-digit uids?
    12. Re:Get a swap partition by Anonymous Coward · · Score: 1, Funny

      The best thing to do is make a ram disk and use that as swap space. Swap space should be fast because it is paging things out of main memory. Ram is much faster than flash, ide, or scsi.

    13. Re:Get a swap partition by bluefoxlucid · · Score: 2, Informative

      Flash file systems are for raw NAND, not NAND behind a microcontroller handling wear leveling. FAT would kill the chip on the XO board, but the same chip in a USB drive would be fine.

    14. Re:Get a swap partition by Mozk · · Score: 1

      AFAIK, most USB flash drives implement wear levelling in the hardware, so aren't flash file systems somewhat superfluous? Couldn't the two methods even conflict with each other? I haven't heard much about these file systems, so if you can inform me, go ahead.

      --
      No existe.
    15. Re:Get a swap partition by TheNetAvenger · · Score: 2, Informative

      Yes and it works quiet well in real world performance testing.

      Even a 1gb or 2gb stick can improve overall responsiveness enough that makes a tight XP installation feel slow. This is especially true with gaming and applications that push the limits of your RAM shoving the HD cache down.

      There are a few crap Flash drives, that just don't perform well, avoid them and it works like promised.

    16. Re:Get a swap partition by setagllib · · Score: 1

      Those chips are about as intelligent as a rubber band. There's currently just no way to implement sane wear filesystem-independent wear levelling in a tiny chip like that. In fact, ignoring the hints of the filesystem in general is a terrible approach, since the filesystem knows best how it can safely move its data around, and a flash-optimized file system is well worth using.

      --
      Sam ty sig.
    17. Re:Get a swap partition by Toonol · · Score: 1

      Not every access... every WRITE.

    18. Re:Get a swap partition by waldo2020 · · Score: 2, Informative

      no matter, you STILL don't want to be swapping to flash! better to load up on RAM and forget swap.

    19. Re:Get a swap partition by bluefoxlucid · · Score: 2

      The file system you use to store your files is way more intensive than your swap partition; OR your mouse isn't moving anymore, you can't close windows, and you have to unplug it and plug it back in.

    20. Re:Get a swap partition by bluefoxlucid · · Score: 1

      Reads update access time on Windows and DOS, which gets written to the FAT.

    21. Re:Get a swap partition by vrmlguy · · Score: 1

      http://fixunix.com/kernel/373556-ubifs-vs-logfs-rfc-patch-ubifs-new-flash-file-system.html has a great discussion about using a flash file system on a block device that's really a flash device with built-in wear-leveling. While neither participant seems to decisively change the other's opinion, several good arguments are made.

      --
      Nothing for 6-digit uids?
    22. Re:Get a swap partition by TheDreadedGMan · · Score: 1

      XP?? how did you get ReadyBoost working on XP?

    23. Re:Get a swap partition by Anonymous Coward · · Score: 1, Informative

      Reads can update access time on Windows and always update on DOS, which gets written to the FAT.

      Fixed that for you.

      Windows XP: Start > Run > cmd
      enter this command:
      fsutil behavior query disablelastaccess

    24. Re:Get a swap partition by Walpurgiss · · Score: 2, Informative

      Nowhere does op claim to have used ReadyBoost on XP, he compared Vista w/ ReadyBoost to a 'tight XP installation'

      Meaning Vista+ReadyBoost is apparently 'faster' as far as responsiveness goes than a clean and properly tweaked windows XP installation.

      I still think pics or it didn't happen, but never was ReadyBoost on XP mentioned.

    25. Re:Get a swap partition by Mr+Z · · Score: 3, Informative

      Apparently wear leveling is no panacea. Some devices wear-level only within a zone, and so a lot of activity in a hot zone can still burn that zone out. I guess such an algorithm only really works well when writes are distributed across zones evenly.

      See page 5 in this document for a description of zone-based wear leveling.

    26. Re:Get a swap partition by Pikoro · · Score: 1

      Wholly christ on a rope!

      Who the hell cares?!?

      You can pick up a 4Gb USB stick for like $10 these days. Screw the wearing out of the drive. Just buy a new one when you notice bad sectors.

      --
      "Freedom in the USA is not the ability to do what you want. It is the ability to stop others from doing what THEY want"
    27. Re:Get a swap partition by SanityInAnarchy · · Score: 1

      Why not?

      If you have enough RAM, you probably won't be swapping anyway, whether or not the partition exists. So a swap partition is no harm, in that case, unless you're tweaking swappiness.

      If you don't have enough RAM, I'll take whatever imagined risks you've suggested over the very real risk of the OOM-killer trying to reclaim memory, or of the system actually locking up or crashing.

      In this case, my assumption is that this person is booting a USB flash drive on whatever computer they have to use at the moment -- therefore, adding more RAM isn't an option. They either have enough or they don't, but they certainly don't have any say about it.

      --
      Don't thank God, thank a doctor!
    28. Re:Get a swap partition by SanityInAnarchy · · Score: 3, Interesting

      Method doesn't work when improperly implemented. News at 11.

      You're basically saying that wear-leveling is no panacea, because not all devices have a good wear-leveling algorithm. Wouldn't the solution, then, to be to demand devices which have a good algorithm, and to reward manufacturers who solve this problem with dollars and word of mouth?

      Of course, the sad part is, the devices would probably be simpler, and cheaper to manufacture, if they didn't pretend to be block devices. Only problem is, then OSes (probably filesystems) would have to implement wear-leveling on their own, and Linux is the only one I know of which currently does that.

      Still, it would be nice if we could fix that problem in software, rather than letting manufacturers get it wrong.

      --
      Don't thank God, thank a doctor!
    29. Re:Get a swap partition by Mr+Z · · Score: 5, Insightful

      Method doesn't work when improperly implemented. News at 11.

      My point is that this seems to be more prevalent than people realize.

      You're basically saying that wear-leveling is no panacea, because not all devices have a good wear-leveling algorithm. Wouldn't the solution, then, to be to demand devices which have a good algorithm, and to reward manufacturers who solve this problem with dollars and word of mouth?

      The problem with short product lifecycles is that you might not realize you bought a turd until after it eats your data, and there's no time for word-of-mouth to spread. And with so many no-name USB sticks out there, how can you really tell which ones are the turds and which ones aren't? There really isn't a good feedback mechanism here. You have some hope paying high dollar for a name brand, but I wouldn't put too much stock in it.

      Also, there are conflicting product goals: Dynamic wear leveling, as described in the PDF I linked above, gives faster write performance. Static wear leveling gives longer silicon lifetime. Which algorithm will generate better word of mouth? It's not clear, although I suspect faster write performance will generate better word-of-mouth while the product is still on store shelves.

      Of course, the sad part is, the devices would probably be simpler, and cheaper to manufacture, if they didn't pretend to be block devices. Only problem is, then OSes (probably filesystems) would have to implement wear-leveling on their own, and Linux is the only one I know of which currently does that.

      You would have to expose a number of low-level details, such as erase block size and other aspects of physical organization to the OS. And, you'd have to teach many OSes about how to talk to you, such as "block erase takes 5ms; device is unresponsive during erasure". Until there's a standardized way of doing this across platforms, faking yourself as a block device is an easy way to get broad compatibility with anything that understands the USB storage device (or SD card, or whatever format you're working with) profile.

      Still, it would be nice if we could fix that problem in software, rather than letting manufacturers get it wrong.

      You can still implement software wear leveling over the abstracted interface. Unless the device actively tries to work against you, it should help.

    30. Re:Get a swap partition by Mr+Z · · Score: 1

      Oh, and I should add... if a device implements dynamic wear leveling, it needs to know something about the filesystem superimposed on it. If it's expecting FAT (because that's what it's programmed with at the factory), and it gets something else, that could explain the "random zeros" bugs people have posted about elsewhere on here.

      I guess Sturgeon's Law applys to thumb drives too. (90% of everything is crud.)

    31. Re:Get a swap partition by floodo1 · · Score: 0

      Really? Most of what I read is that in some situations ReadyBoost has an impact, but in day to day use most users report thats its not noticeable. As I've never tried it myself (don't run Vista) I'm interested to know if it's worthwhile

      --
      I KUT J00 M4NG!!!
    32. Re:Get a swap partition by Mr.+Jaggers · · Score: 1

      Not to mention that wear-leveling flash controller ICs are still kind of black ju-ju, and you're unlikely to be able to get every commodity flash controller manufacturer to disclose certain details about the wear-leveling algorithms used in their ICs, even with an NDA, unless you're planning on using them in your commodity flash storage device. Oh, and buying thousands of them as well.

      For example, that micron white-paper is pretty vague when it comes to details of an actual dynamic wear-leveling algorithm... their example is 25% "dynamic" data and 75% "static" data. How does the flash controller determine this? It's likely hard enough to determine, with any accuracy, what exactly is going to be static or dynamic unless you're implementing a whole system around the NAND IC, and you can constrain it that way.

      As far as choosing a USB flash stick because you happen to know that its flash controller performs in a superior fashion when it contains a swap partition/file... how would you even determine that? Performance is no measure here; remember, we're talking about wear-leveling, not throughput. The two aren't necessarily orthogonal, but are orthogonal enough for this discussion.

      You'd need to do what the OP is doing, meter & record your swap usage statistics (!!), and determine the impact on the underlying NAND. If you're *very* lucky there might be some CFI way of getting block-wear information out of the controller, but you'd probably have to hack up the usb-storage kernel module to do any of this monitoring during run-time (which means putting hacked custom kernels on your daily-use USB-hosted operating system, which you modify yourself for each new flash stick you test out).

      I think this is probably not feasible for the OP, who will probably have to just pick one, and when it dies, claim "Wow, that one lasted a long time, it RULEZ!!" or "Shit, I think I barely used it and it died anyway, Yoyodyne Flash Sticks are the SUXXORZ!!!".

      I'm with you on eliminating the block-device layer, or at least having a mode to do so. We can choose, currently, to format our USB sticks FAT32 if we wish. We could alternately use ext2 on them (I do, currently... mostly so permissions bits stay put, and to foil DHS for an hour or two if they fuck with my shit). Why, analogously, should we not be permitted to bypass the flash controller completely? Format the flash JFFS2 (or something better... I'm not a software wear-leveling weenie) and interact with it via the MTD subsystem? I've read articles about eschewing the block-layer completely and using an object-filesystem on flash, instead (in this case, perhaps "filesystem" is a misnomer; think "object-datasystem" or something). I'm sure they could figure out what impact that would have on their warranty service and adjust pricing accordingly.

      Letting manufacturers "get it wrong" is doubly bad, in that it's hardly transparent to us that they were ever responsible to begin with. As I pontificated above, it's not trivial to rigorously identify a crappy flash controller. A *bad* flash controller, sure. A functional controller with a poor implementation, however, not so easy.

      At any rate, his swap would be bottlenecked by the USB connection, which would be shared with transfers of his own data as well. I would say he should carry two sticks, and use a whole second stick for swap. That would maximize the utility of whatever wear-leveling algorithm the flash controller happens to use on that stick. It would require him to manually activate swap (since he may not know for sure what usb device address the swap stick will address), but that would reduce bus contention. Swap over USB sounds horrible anyway, and soothing the savage OOM-killer is the only reason I see why you'd ever do that.

      --

      When I grow up, I want to have Christopher Walken hair.
    33. Re:Get a swap partition by Mr.+Jaggers · · Score: 1

      Seriously? You're claiming that USB 2.0 bus bandwidth exceeds SATA 150? Or even ATA66? I would be surprised if USB2 even beats ATA33 during sustained write operation (think DMA).

      Or perhaps you're claiming that raw disk I/O on commodity hard drives is slower than I/O to commodity NAND through a wear-leveling FTL IC??

      No, both are slower.

      USB 3.0 may be faster, but before then we'll have SATA/600 to much faster (possibly flash-based solid-tate!) disks, anyway.

      --

      When I grow up, I want to have Christopher Walken hair.
    34. Re:Get a swap partition by bluefoxlucid · · Score: 1

      For scattered reads of 4k in random order, backward and forward seeking, not possible to batch up, in a 32M or 256M contiguous area? Yes, zero seek time is faster.

    35. Re:Get a swap partition by bluefoxlucid · · Score: 1

      The use case for swap isn't much writing, but reading. Swap gets written basically once in a while; when memory is read from swap, it's loaded into swap cache. This is invalidated if clean for more swap usually. When stuff's written to swap cache, and the page is used enough, it becomes permanent in memory until it's pushed out again; otherwise, it hangs out in swap cache until it's forced out, and gets written out. It's complicated but basically there's a lot of avoidance writing, because writing is obscenely slow on everything compared to reading (the read/write head on a hard drive has to stick around long enough to flip a bit, for example).

    36. Re:Get a swap partition by Anonymous Coward · · Score: 0

      Windows XP: Start > Run > cmd enter this command: fsutil behavior query disablelastaccess

      What is this, Ubuntu? Provide instructions to do that using a GUI or else it's impossible. Nobody can be expected to use this "typing things in to make things happen" model, that went out of style in 1978 when the Mac was invented. Go and have a proper look and find the correct GUI tool to use. It's probably in Control Panel / Classic View / File Systems / Advanced / Turn Off Last Access Thingy. Everybody knows it's much easier to just click on a few buttons than to type in weird things like you did.

    37. Re:Get a swap partition by Anonymous Coward · · Score: 0

      FUD. Learn wear leveling.

      Really?

      I have several dozen usb drives, different capacities, speeds, makers, etc.

      I usually have one in my workstation at work, to run some utilities that I NEED for the job (but that our worthless IT guy is too stooopid & lazy to actually install) and they run a hell of a lot better on a USB stick than if I install on our network share & run from there.

      One of the programs is a SSH, another is a type of chat, etc. These are almost constantly logging stuff, and due to one of the mandatory audit programs, I have to keep writing my logs to disk because my computer crashes randomly (ya, our IT guy is really good. grrrrr).

      I had a no-name 256meg stick that I burned out in about 3 months of use. I had a Sandisk 512meg that I burned out in about a year, and another Sandisk 512meg (looks identical) that I ran side-by side with the first that has been going well for 2 & 1/2 years.

      I know they employ 'wear-leveling' but the details are proprietary: try and find the exact method they use, or even the internal storage format & you're pretty much out of luck. Hell, even trying to find read/write specs you won't get very far.

      Different brands use different techniques, and it's more than likely that different models of the same brand work differently as well.

      A good rule of thumb, is that if you buy a really cheap drive it's gonna go tits up pretty fast, especially under heavy writes.

      Personally, I recommend using one stick for your OS and swap, and a seperate for your data partition (assuming no local storage). This way if you burn out your OS stick your data is still relatively safe, and as long as you save your session setting to the data drive, all you'd have to do is drop a new image of linux on the OS/swap stick.

    38. Re:Get a swap partition by TheDreadedGMan · · Score: 1

      Ahh I see... well Vista does seem to be a bit smarter with precaching then XP.. I've not tried ReadyBoost yet but sounds fun

    39. Re:Get a swap partition by mathew7 · · Score: 1

      Please stop comparing THEORETICAL speeds. A car needs 400+HP to reach 300km/h, but a bike can do it with 150HP. But in which one would you be brave to try?
      A HDD speed is given by platter rotation and density. The only consumer HDD's I can think of reaching SATA150 speeds are the WD raptors, but even those I remember going to 120MB/s. You can get 300MB/s from a SATA300 HDD only by reading/writing exclusively to it's cache, but this data would be cached in RAM already by the OS.
      The fact is that only this year the USB sticks (and cards) started sutaining more than 10MB/s.
      So the point is that flash vs. HDD comparison is very dependent on usage. On random reads, flash clearly wins, but on writes it can hold a small lead only on random data, preferably in the 4-16kb range. On sequential transfers HDDs are still leaders and it has nothing to do with the interface.
      Also, USB has a high CPU usage because of the multi-device architecture and the protocol to the USB host controller.

    40. Re:Get a swap partition by TheNetAvenger · · Score: 1

      As I've never tried it myself (don't run Vista) I'm interested to know if it's worthwhile

      It not always makes a big difference, but there are some good guidelines of knowing if it will help or why to use it.

      1) Is your HD slow as crap? a 4200 or 5600rpm HD will see some gains, no matter what you are doing.

      2) Is your system RAM at a level that your games/applications can consume it? For example even if you have 2GB of RAM, but your game consumes 90% of this to run, there is going to be a shortage of OS level HD RAM cache available, and ReadyBoost will help. Vista on 1GB will see more help than Vista on 2GB, but even then if a game is taking the RAM, it offers some caching help.

      3) Gaming in general tends to get a nudge from ReadyBoost, as games often pull textures from various files, and the faster random seeks the Flash Driver offers will help.

      4) Load times. Again, loading applications often pulls data from several places as well as having the OS pull or use API level files, so there is no way to full sequence lay the content on the HD, as the shared parts of the OS itself are not going to be moved for each application that uses them. On applications you use a lot, the Flash Drive used with SuperFetch will be smart enough to have data loaded that it expects you to use based on your patterns, time of day, previous applications you loaded, etc.

      You also get a level on concurrency for read operations, so while your HD is yanking File A, the Flash Drive can be offering bits that are scattered around your HD at the same time, getting a double dip in performance improvement.

      5) Flash Sticks are cheap, and if you have a newer(fast) one laying around, even if it is 2GB, throw it in, and get some boost from it when you aren't using it for other stuff. You can always turn off ReadyBoost on the device at anytime and shove your data on it before you go somewhere.

      These are just some basics, but the last one is probbably the most important, as most of us have USB sticks laying around and can move our data off them and get a performance boost (even if it is fairly small) and not have to invest in one permanently just for ReadyBoost.

      ReadyBoost would have made a bigger impact on performance and the market if faster USB sticks would have come about sooner. Also Vista Superfetch technologies, often work so well, ReadyBoost is just assisting. Superfetch is the grand daddy of smart look ahead caching technology as it takes into account so many factors and the more you use your system the faster things load and smoother games.

      So if you are running Vista, give it a try. (Note there are some really crap USB sticks, so if Vista says it is too slow, it just won't let it be used, and this pissed off a lot of people like SanDIsk that made a lot of the crap Flash sticks.)

      PS It can also be used for other type of Flash media like SD, if they are in a fast USB based Media reader.

  2. USB has high cpu use and encrypted does not help/ by Joe+The+Dragon · · Score: 1, Informative

    USB has high cpu use and encrypted does not help a firewire based flash drive will be a lot faster. USB 3.0 may help but it too may still the limit of usb 2.0 high cpu use as well.

  3. Hrm. by Creepy+Crawler · · Score: 4, Insightful

    Well, the sucky thing about USB is it requires an inordinate amount of CPU. Normally this isnt a worry, but if you're using a encrypted loopback.. well ouch.

    One thing you could instead use is the SD card slot and a USB loader. If you choose a 8GB class 6 SD card, you could have plenty of room for whatever, and 6MB/s minimum speed. You're still going to take the CPU hit for encryption, but that is your choice. The big thing is to stay off the USB.

    --
    1. Re:Hrm. by Fred_A · · Score: 1

      The internal SD card reader is typically connected to the USB bus so it probably won't change performance all that much.

      --

      May contain traces of nut.
      Made from the freshest electrons.
    2. Re:Hrm. by Creepy+Crawler · · Score: 3, Informative

      True, but some laptop and desktop designs have went away from USB connectedness.

      For example, on my Thinkpad the SD reader is its own bus. The Bluetooth is a USB 1.1 (grr) device, so I need to rmmod the bt modules and remove usb old modules to be power efficient.

      It really is a crapshoot on what the computer maker put on the USB bus. I just lucked out.

      --
    3. Re:Hrm. by cuby · · Score: 1

      Usually SD readers use a USB interface inside... So, it will also have a high CPU usage. The 6MB/s are a real deal, I have a class 6 card that does it, but... in large files you can see periodic freezes during transfer, I think, because of the buffer system used by the SD.

      --
      Math is beautiful... e^(pi*i)+1=0
    4. Re:Hrm. by Anonymous Coward · · Score: 0

      on desktops they always connect to the internal usb header

    5. Re:Hrm. by wikinerd · · Score: 1

      I don't like USB for the same reasons. IEEE1394 (FireWire) is a much better bus in some respects like CPU usage. There exist FireWire flash drives that one can use, and work great under GNU/Linux.

    6. Re:Hrm. by Anonymous Coward · · Score: 0

      Wow! 6MB per second!
      Get a proper card and get 20-30MB per second.

      You know, the cards that only cost a few dollars more, and are used by photographers who aren't constantly plugged into laptops.

    7. Re:Hrm. by Anonymous Coward · · Score: 0

      Why encrypt root? All the stuff there is open source anyway!

      My recommendation is just to encrypt /home. You
      could also make the case for encrypting some of /var

    8. Re:Hrm. by Enry · · Score: 1

      /etc/passwd and /etc/shadow are two great reasons to encrypt /

    9. Re:Hrm. by mathew7 · · Score: 1

      Is it a T61?
      Anyway, the idea is that a card reader is very (very very) cheap to manufacture for USB. So even if it is a card-express or pcmcia card reader, it's actualy an USB card reader chip, and a USB host controller on PCI (pcmcia) or PCIe (cardexpress). And as I remember, card-express can use either PCIe or USB. So in the latter case the USB host controller is the one in your laptop chipset.
      So I really doubt you have your SD card reader on it's own bus. Maybe on it's own USB bus. But I'm 99% sure it is USB. Any other connection is 80-90% more expensive because the design (R&D) costs are spread on a much smaller number of chips.

    10. Re:Hrm. by fast+turtle · · Score: 1

      Thanks for the Link though they're a bit pricey

      --
      Mod me up/Mod me down: I wont frown as I've no crown
  4. buy a netbook by Anonymous Coward · · Score: 0

    You'll get a huge performance increase and maintain a similar level of portability.

  5. Anonymous Coward by Anonymous Coward · · Score: 0

    Are you using squashfs?

    Having everything compressed seriously reliefs the drive I/O. Another nenfit is that more stuff fits on your stick :D

    1. Re:Anonymous Coward by X0563511 · · Score: 1

      A read only filesystem for general use. That sounds like fun.

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    2. Re:Anonymous Coward by audi100quattro · · Score: 1

      There is also e2compr, which enables compression on an ext2 filesystem. I haven't used it much, because squashfs with unionfs does the job better I think, but it's an alternative.

      http://sourceforge.net/project/showfiles.php?group_id=83758&package_id=86254

  6. Lightweight software && ssh -x by Paradigm_Complex · · Score: 5, Interesting

    One thing I've found really, really helps is to use smaller programs et al. While the difference in how long it takes to start up gnome-terminal vs rxvt or nautilus vs pcmanfm is minimal on a normal/modern desktop or laptop, the difference is substantial on a cheap USB flash drive. There's plenty of lists for lightweight applications, window managers etc for linux around online. In fact, I'll often just stick with terminal applications (moc, for instance).

    Another option, if you're booting on a box which has a good internet connection, is to ssh -X things over a network. Not only does this save a large amount of space, but I've found it's often faster to have a program like Firefox start on my snazzy box at home and ssh -X over than waiting for it to load off of my crappy usb drive.

    --
    "A witty saying proves nothing." - Voltaire
  7. USB1 vs USB2 by Mendy · · Score: 4, Interesting

    It might be that the poor performance occurs when you're on a computer that only has USB1 support. On Dells this was added later than you might expect.

    You might find you got better performance if you were to use a CD to hold most of the static software and the USB for just your home directory.

    1. Re:USB1 vs USB2 by snilloc · · Score: 1

      There was a period of time on Dells where the front-access USB was USB-1, but the USB access on the rear of the machine was USB-2.

  8. slax by Anonymous Coward · · Score: 0

    switch to slax. it's faster.

    1. Re:slax by Anonymous Coward · · Score: 0

      How does slax gain the speed? Does slax specialize the filesystem?

    2. Re:slax by ancientt · · Score: 1

      As I use it, it runs from RAM.

      --
      B) Eliminate all the stupid users. This is frowned upon by society.
  9. optimizing Linux on USB: multiple angles of attack by liraz · · Score: 5, Insightful

    I know a little bit about this because I am one of the developers for TurnKey Linux, a new opensource project which builds small installable live CDs (we're up to 9) optimized for various mostly server-related tasks. I've been investigating supporting live USB mode.

    Your generic run-of-the-mill USB drive has about fourth-half the read/write performance of your hard drive nowadays (10-15MB/s). Since there are no moving parts (spinning platters), usually the seek times are very good.

    There are several things you can do to optimize the performance of an operating system running live from a USB drive:

    1) buy a faster USB drive: a good USB drive (e.g., Lexar JumpDrive) can have 2-3 times the performance of a generic.

    2) Use a Linux distribution with a smaller footprint such as DSL (50MB) or Puppy Linux (standard edition is 68MB): the smaller the footprint, the less your drive has to read, the faster your system will load.

    3) Try loading the operating system system into a ramdisk: many live USB distributions have the ability to load themselves into RAM. With some you have to add a cheatcode in the bootloader. Others do it by default if there is enough memory (usually not a problem with small distributions and modern computers).

    4) Try turning on readahead: many distributions which are designed to run from a live CD or live USB have a feature that reads ahead various files important to the boot sequence sequentially. Whether or not this helps depends on the characteristics of the storage medium you are using, but you should investigate it.

  10. Did you read the faq? by agristin · · Score: 5, Informative

    make sure you are on USB 2.0- interface can kill you.

    Also did you check the faq-

    No seriously:

    http://www.linux-usb.org/FAQ.html#i5

    especially the section on:

    Q: What is max_sectors and how should I use it?

    A:For USB Mass Storage devices (that is, devices which use the usb-storage driver) max_sectors controls the maximum amount of data that will be transferred to or from the device in a single command. As the name implies this transfer length is measured in sectors, where a sector is 512 bytes (that's a logical sector size, not necessarily the same as the size of a physical sector on the device). Thus for example, max_sectors = 240 means that a single command will not transfer more than 120 KB of data.

  11. Buy a faster USB flash drive by nightfire-unique · · Score: 3, Interesting

    Most USB flash drives are very slow, and rely on heavy cacheing to make them usable. That doesn't help when you need to write large amounts of data (ie. in an apt-get update/install).

    Some flash drives that advertise themselves as 10-15MiB/sec write capable peak out at only 1 or 2, and even less with small-block random I/O (since the erase-write cycle operates on relatively large blocks).

    Several vendors make specialized flash drives that are somewhat more expensive (ie. 20-50% over average), but perform much better.

    One is here: OCZ Turbo USB 2.0

    --
    A government is a body of people notably ungoverned - AC
    1. Re:Buy a faster USB flash drive by D_Gr8_BoB · · Score: 2, Informative

      You could also skip flash entirely and buy a very small hard drive. I've got a 60-gig USB drive from Apricorn that I carry around in my pocket, with an AES-encrypted root filesystem. Performance isn't spectacular, but it's certainly usable.

  12. Use Puppy by Anonymous Coward · · Score: 1, Informative

    Puppy Linux is tiny and is set up to boot off of USB. After it's booted, if the system has enough RAM, the entire system is loaded into RAM. Makes for a damn snappy system.

    http://www.puppylinux.org/

    1. Re:Use Puppy by eniacfoa · · Score: 1

      i havent heard of a ram disk since my amiga!!! I want to try this now!

  13. Put i/o-intensive filesystems on a ramdisk? by nerdyH · · Score: 1

    I/O to RAM is really fast compared to I/O to any block device (most USB keys appear to the host PC as block devices, because they have a little ARM7 or other low-power 16-bit MCU on them that emulates the IDE interface). So, maybe you could get a speedup by mounting any I/O intensive parts of your filesystem on a ramdisk. It might also save wear and tear on the flash (though MLC NAND is never going to be all that reliable). Here's an fstab excerpt showing one technique:
    /dev/ram0 /tmp tmpfs defaults,nodev,nosuid 0 3
    /dev/ram1 /var/run tmpfs defaults,nodev,nosuid 0 3
    /dev/ram2 /var/log tmpfs defaults,nodev,nosuid 0 3
    This makes three ramdisks with dynamic capacity, and mounts /tmp, /var/run, and /var/log on them. The next step would be to write something to serialize and unserialize the ramdisks at startup and shutdown, and optionally snapshot them from time to time to safeguard against power failure. This example uses the parts of a filesystem that'd be I/O intensive on a server, but I don't see why you couldn't do the same thing with your home directory or whatever else. You could profile your USB distro by instrumenting your kernel, or just list your recently touched files from time to time to get a sense of where the I/O is happening.

    1. Re:Put i/o-intensive filesystems on a ramdisk? by Paradigm_Complex · · Score: 1

      On Debian-based distros like Ubuntu, /dev/shm is a ramdisk which will automatically resize, compared to /dev/ramX which gets a bit weird about changing size.

      --
      "A witty saying proves nothing." - Voltaire
    2. Re:Put i/o-intensive filesystems on a ramdisk? by Solra+Bizna · · Score: 2, Informative

      /dev/ram0 /tmp tmpfs defaults,nodev,nosuid 0 3
      /dev/ram1 /var/run tmpfs defaults,nodev,nosuid 0 3
      /dev/ram2 /var/log tmpfs defaults,nodev,nosuid 0 3

      Just to let you know, tmpfs ignores the device path, you can put whatever you want in it (and you aren't actually using /dev/ram* with that).

      -:sigma.SB

      --
      WARN
      THERE IS ANOTHER SYSTEM
  14. Wearing of flash cells should be adressed by rpp3po · · Score: 1

    Distros like Damn Small Linux know a mode where all frequent writes go to a RAM disk. Current flash hardware (especially disks - lesser cheap usb sticks) is already a lot smarter at "wear levelling", but a standard distro genereates a whole lot of small writing activity. It would be nice if there was a out-of-the-box way to make a server distro like Ubuntu Server USB ready. My file server could shut down its 5 disks completly until I access the files over the network. This could save quite some energy (and disk lifetime).

  15. Run it in a MFS... by Anonymous Coward · · Score: 0

    I don't know if Linux requires anything less than MS Vista in terms of system resource requirements (memory, etc) these days, but with OpenBSD I also run it off of USB - optionally loads to various MFS filesystems, (/, /var, /tmp, /usr, /home, etc...) syncs the MFS to Flash on shutdown and a bunch of other goodies, hopefully to be ported to Linux as well. But I'm sure it's possible, with Linux, somehow, just might be a hell of a lot of work to try and lean it out.

  16. ram disk by Anonymous Coward · · Score: 0

    What about making sure all log and tmp files are redirected to a ram disk?

  17. Try out different filesystems by mbyte · · Score: 5, Insightful

    Try out different filesystems, NILFS seems to be optimized for FLASH usage.

    Brtfs could also be worth a try.

    use the "noop" IO/Scheduler with nilfs:
    echo noop > /sys/block/sdX/queue/scheduler

    Postmark benchs on an usb-stick (shameless copied from here:
    ext3 (mount -o noatime,noadirtime, normale Partition, scheduler cfq): 49 Transactions/s
    nilfs2 (Partition aligned 128k, scheduler noop, protection_period 10s): 588 Transactions/s

    1. Re:Try out different filesystems by Anonymous Coward · · Score: 1, Interesting

      Wow - it seems like you're the only person that has actually posted the correct information. ext is the wrong filesystem to use on flash & noop is a much better scheduler for flash.

      Do you have any numbers on just noop vs cfq when the same file system is used on a USB stick?

    2. Re:Try out different filesystems by Anonymous Coward · · Score: 3, Funny

      I'm holding out for the MILFS filesystem.

    3. Re:Try out different filesystems by Anonymous Coward · · Score: 0

      more on this - you have JFFS 2 and other ones you can find on wiki.

      Also, you can use distributions with specific flash drive lines, ie knoppix, puppydog linux, slax, etc.

    4. Re:Try out different filesystems by jonaskoelker · · Score: 1

      Try out different filesystems, NILFS

      If you want to run a layer of compression and then one of encryption before hitting the NILFS backend, would you then need to use two instances of CONSFS?

    5. Re:Try out different filesystems by Anonymous Coward · · Score: 0

      Try out different filesystems, NILFS seems to be optimized for FLASH usage.

      Brtfs could also be worth a try.

      use the "noop" IO/Scheduler with nilfs:

      echo noop > /sys/block/sdX/queue/scheduler

      Postmark benchs on an usb-stick (shameless copied from here:

      ext3 (mount -o noatime,noadirtime, normale Partition, scheduler cfq): 49 Transactions/s

      nilfs2 (Partition aligned 128k, scheduler noop, protection_period 10s): 588 Transactions/s

      if those test results are consistent, ditto that. but without strong linux distro support (i.e. ubuntu) one would have to be an experienced poweruser (esp. with driver/fs configuration, scripts, file permissions, etc.) to implement it (either than or know one such poweruser. Although I haven't used linux for too long (only ~3 years) I think it's safe to assume that configuration of that level would require more than experience in following how-to's, wikis, man pages, and other documentation-- it would require some serious experience, at least to do properly.

  18. Re:USB has high cpu use and encrypted does not hel by Anonymous Coward · · Score: 0, Offtopic

    you need to work on your grammar.

  19. what I do by ILuvRamen · · Score: 4, Insightful

    I have an old 10GB laptop drive inside of a very low profile USB enclosure and it runs like 35x faster than my USB drive or something absurd like that. It's a little more sensitive to bumps but it's not exactly expensive for 10GB drives. You can get a 6 pack of used one on ebay for about $3-7 each. Best of all, in a good enclosure, it still fits in your pocket.

    --
    Google's Super Secret Search Algorithm: SELECT @search_results FROM internet WHERE @search_results = 'good'
  20. busybox by nategoose · · Score: 4, Insightful

    You might want to try replacing many programs as you can with busybox. It's versions of utilities are less complete than the standard gnu utilities, but they are all rolled into one binary, so most likely most of that binary will get cached in ram pretty early and stay there.
    Also, for any packages you build you should try to use the -Os option for gcc, and perhaps even strip the binaries to remove unused symbols and debug info.
    Building the system as though this was an embedded system with a small disk should be a win in most cases since fewer things have to go over the wire to load a file and more of the binaries can fit into cache.

  21. Copy2ram by Anonymous Coward · · Score: 0

    PCLinuxOS, DSL, Knoppix (and probably many others) can run entirely from RAM and only use the USB drive to save the user's settings.

  22. The PD7 drives from A-DATA are very fast by Anonymous Coward · · Score: 0

    For my company I have made two streamer server products based on 1U HP Proliant servers using the internal USB connector running Debian GNU/Linux. First I used the cheapest 1 GB stick from Kingston but then found out that read and write speeds was not specified and very low. I then settled for a 2GB a-data PD7 drive. Believe me it's fast! They were spec'ed to 20MB/s write and 25MB/s read speed. Using cpipe I measured sustained write speed of 21MB/s and read speed of 26MB/s. They are just so good to the price.

    Read a review of the 8GB PD7 drive here:
    http://www.overclockersclub.com/reviews/adata_pd7_8gb_flash_drive/6.htm

  23. He's running encrypted disk on the flash. by Ungrounded+Lightning · · Score: 1

    Delete it on unmount (as part of your shutdown process) -- if you're truly paranoid you can even take the time to scrub the sectors your swap was using.

    He's running his flash drive using full-disk encryption. So he's concerned about leaving his data lying around. If that's the case he should not be swapping in the clear, then hoping it gets properly scrubbed later. The swapping should also be encrypted.

    It should be possible to do the same loopback-though-encryption hack to the swap file on the Windows disk as you use to encrypt the whole disk. (Make the swap file, mount an encrypted loop on it, declare that to be swap for Linux.)

    I haven't done this myself yet so I won't try to give a detailed how-to. But it shouldn't be too hard to figure it out from how the encrypted-disk is done, and set up a script to do all the mounts and file creations in one shot to add the swap file.

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    1. Re:He's running encrypted disk on the flash. by MikeBabcock · · Score: 3, Insightful

      Using encrypted swap is really easy on a modern Linux distribution. A random key is assigned to the swap partition on boot-up, so that after power-off, the data's almost as good as gone.

      --
      - Michael T. Babcock (Yes, I blog)
    2. Re:He's running encrypted disk on the flash. by scotsghost · · Score: 1

      excellent point. i hadn't thought that all the way through, but in hindsight it's pretty obvious. thanks.

  24. Mod parent as "funny"? by Ungrounded+Lightning · · Score: 2

    The best thing to do is make a ram disk and use that as swap space.

    So the OS can use part of the memory as swap, rather than memory, and when the part it is using as memory is full it can copy it to the part it is using as disk? (Except it won't, because if I recall correctly the RAM disk, along with disk buffers, are all dynamically assigned in memory, so when you need to swap there's nowhere to swap to.)

    Were you trying to be funny? Or just unintentionally managed it?

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    1. Re:Mod parent as "funny"? by tverbeek · · Score: 1

      Obviously that won't do any good. You need to create a RAM disk using virtual memory mapped to space on the USB drive.

      --
      http://alternatives.rzero.com/
    2. Re:Mod parent as "funny"? by Ungrounded+Lightning · · Score: 1

      As has been pointed out elsewhere: Writing to the USB drive gradually burns it out. So you don't want to do a lot of swapping to it. (Also: It's REALLY slow for a swap device.)

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    3. Re:Mod parent as "funny"? by Yert · · Score: 1

      Dude. Not only once, but TWICE.... woooooooooosh.

      --
      Truck driver, plumber, Linux systems engineer.
    4. Re:Mod parent as "funny"? by Ungrounded+Lightning · · Score: 2, Insightful

      Yert: It is not clear that the original post was a joke.

      "Whoooosh" is fun for playing elitist games. But I'm more interested in helping people avoid being "whoooosh"ed into a lot of lost time, effort, and perhaps compromised data because they missed something that another poster thought was obvious and funny.

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    5. Re:Mod parent as "funny"? by Anonymous Coward · · Score: 0

      Of course the original post was a joke. Otherwise you are assuming the AC that posted it is an idiot that is commenting on something he knows nothing about. Considering how it was written, it is highly unlikely that is the case.

  25. Journalling by CCFreak2K · · Score: 1

    I'm surprised no one mentioned this (or maybe someone has and it's just under my threshold), but not using a journalling filesystem can help tremendously. Having a whole system on a flash-based USB mass storage media formatted and mounted as ext3 is a great way to make sure the only bottleneck you'll ever have is disk I/O.

    --
    "Beware of he who would deny you access to information, for in his heart he dreams himself your master."
  26. Run from ramdisk by Anonymous Coward · · Score: 0

    Create an initrd image with your entire filesystem (use BusyBox etc) and never do the pivot root back to disk.

  27. Use tmpfs for apps data dirs by Anonymous Coward · · Score: 1, Informative

    I run exclusively off a flash drive. I'm nomadic and it's easier to haul around than a laptop.

    Many apps like to call fsync() needlessly, causing many writes to occur to the flash drive. Buffering all these writes in RAM until you halt the system works around this.

    One of the largest performance gains I've gotten is by using tmpfs to store all of firefox's data.

    Strategy is as follows:
    On boot, mount ~/.firefox as tmpfs. Extract backup tarball into this dir.
    On halt, generate tarball of ~/.firefox

    Some scripts are at http://coder.home.cosmic-cow.net/src/usbstick/

    I use this strategy with firefox, pidgin, and a few other apps. The performance gain is amazing.

  28. Browser Caching? by Anonymous Coward · · Score: 0

    If it's web browsing performance you're worried about, turn of the browser disk cache, it's probably competing with your apt-get for disk IO bandwidth, and a fair bit of it will be writes too..

  29. Don't forget... by Anonymous Coward · · Score: 0

    To turn off file system journaling (whatever file sys you use) Other comments were good. I didn't see my favorite, though.

    TEXT MODE only! Runlevel 3 is awesome! runlevel 5 is for wusses.

  30. Dave Jones suggestions for the eee900 might help by Mr+Z · · Score: 5, Informative

    Dave Jones recently posted elsewhere his notes for improving things on the eee900. Several of the steps focus on getting proper performance out of the flash, and so would also apply to booting from a USB thumb drive or other flash media. Here's what he had to say:

    Making the eee 900 series suck less.

    Recently I've read about or spoken with a few people using Fedora on eeepc's who have been making some fairly big blunders without realising it. I've played with a few of these now, in their various incarnations.

    The current one I've been carrying around is the 900 model with a whopping 20GB of flash. It's quite deceptive, because there are actually two SSDs in there (one 4GB, and one 16GB)

    These ssds are also pretty damn awful performance-wise compared to the newer generation of SSDs, but short of opening it up and retrofitting something, there's not much that can be done. The tips below should at least make it more bearable.

    • First off, don't use the default partitioning scheme.

      By default, anaconda will choose to use lvm, and make a contiguous volume out of the two SSDs. This idea is fail, because the two disks aren't the same, and run at different speeds.

      # hdparm -t /dev/sda

      /dev/sda:
      Timing buffered disk reads: 108 MB in 3.04 seconds = 35.57 MB/sec

      # hdparm -t /dev/sdb

      /dev/sdb:
      Timing buffered disk reads: 86 MB in 3.05 seconds = 28.20 MB/sec

      So, don't do that. Just create regular partitions, and make sure you put / on the faster of the two disks (the 4GB one), and leave the 16GB one for /home

    • Next, the default filesystem will be ext3. You really don't want this.

      Given the journal is in a fixed location on disk, scribbling to it every time a file gets written is a great way to wear out the flash. Go with ext2. (Given that you've only got a few GB of flash anyway, a fsck doesn't take that long should you need to). Additionally, not having to write to the journal means that you're doing less IO, which is obviously a win when it's on such slow media.

    • This should go without saying - no swap.

      Not only for the flash wear problem in the previous bullet, but also, because it's slow as all hell. If you find you run out of ram and get stuff oom-killed in this setup, well, you probably need to add more ram, or consider a real laptop.

    • After installing, change the fstab so that everything gets mounted with noatime.

      Writes to the disk are just painful, so minimising them is the path to success here. It's doubtful that you'll be running anything on an eee that would actually care about atimes anyway.

    With these points taken into consideration, the eee isn't a half-bad machine. I still wouldn't want to be building kernels and such on it, but it's perfectly usable for email and such whilst travelling.

  31. Get swap software by Ostracus · · Score: 1

    "Those chips are about as intelligent as a rubber band. There's currently just no way to implement sane wear filesystem-independent wear levelling in a tiny chip like that."

    Which is why HDDs do all their "wear leveling" in software.

    --
    Shai Schticks:"You don't make peace with friends, you make peace with enemies"
  32. The HD is mightier than the pen. by Ostracus · · Score: 1

    "What can I do to maximize the performance of Linux while running off of a slow medium?"

    Stop trying to fight physics and use a different technology

    --
    Shai Schticks:"You don't make peace with friends, you make peace with enemies"
  33. Overlay the real fs with RAM: aufs or unionfs by Anonymous Coward · · Score: 0

    >A read only filesystem for general use. That sounds like fun.

    My travel notebook has a CF card for storage, and normally runs with aufs overlaying a tmpfs (RAM) filesystem in front of the flashcard.

    So reads come from the 40MByte/sec CF card, and writes just go to RAM. Nothing is saved permanently unless I want it to be saved.

    This makes for safer browsing, and gives the ability to try out new s/w packages in a throw-away environment.

    In grub I have the choice at boot of running entirely from CF, which is slower but makes all changes permanent.

    But even with the tmpfs overly, I can still access the real underlying CF media for permanent writes when needed.

    And a simple bash script can be run to "commit" all of the tmpfs/aufs changes back to the real CF.

    I wouldn't want it any other way for my travel machine!

    Cheers

  34. How about using a live filesystem? by Anonymous Coward · · Score: 0

    I would suggest using a distro that supports a "live filesystem" that normally runs off of the CD Drive, these copy a lot of stuff into RAM and the ones I have played with are actually quite responsive (once booted). You can leave your home directory mounted on the USB drive so any data files you create/modify will be with you after you shut the system down.

    Since the system is running in RAM it leaves NO garbage on the host computer.

    RSD

  35. funrolloops by Anonymous Coward · · Score: 0

    w/ a smaller distro couldn't you just some way load it ALL into memory?

    that would seem like the most potential.

    other then that I suppose -f or prelinking...

    1. Re:funrolloops by RiotingPacifist · · Score: 1

      It's the transfer speed that sucks on USB, so prelinking probably wont help much ,ofc there is no harm in trying, but preloading would be more useful.

      --
      IranAir Flight 655 never forget!
  36. Re:Dave Jones suggestions for the eee900 might hel by Anonymous Coward · · Score: 0

    "Given the journal is in a fixed location on disk, scribbling to it every time a file gets written is a great way to wear out the flash."

    Unless the flash drives they are using are extremely lame (and I mean extremely), they use technology called wear leveling. This means that even if the journal is in a fixed location according to Linux, it's not in a fixed location according to the hard drive. Writes are spread to different bits of hardware for the same "physical" sector. As I understand it, every flash drive except for cheap, crappy USB drives use wear leveling (and even they might)

    "After installing, change the fstab so that everything gets mounted with noatime."

    This is not really that necessary anymore. Fedora 8 and on have relatime set by default which is only negligibly slower than noatime and there is no possibility of having any problems. You still can do it I suppose, but it's no where near the difference between atime and noatime

  37. Re:Dave Jones suggestions for the eee900 might hel by Mr+Z · · Score: 1

    Unless the flash drives they are using are extremely lame (and I mean extremely), they use technology called wear leveling. This means that even if the journal is in a fixed location according to Linux, it's not in a fixed location according to the hard drive. Writes are spread to different bits of hardware for the same "physical" sector. As I understand it, every flash drive except for cheap, crappy USB drives use wear leveling (and even they might)

    Apparently, the wear leveling isn't that great on some. Dave said he's seen an eee with dead flash precisely where the swap used to be. Apparently some of the lower-end flash devices wear-level in zones, meaning that if you have a particularly hot "zone", you could still burn that zone out. I imagine $10 USB sticks from Office Despot are going to have those lower-tech algorithms, or algorithms tweaked specifically for FAT filesystems.

    This is not really that necessary anymore. Fedora 8 and on have relatime set by default which is only negligibly slower than noatime and there is no possibility of having any problems. You still can do it I suppose, but it's no where near the difference between atime and noatime

    According to Val Henson (who invented relatime, apparently):

    noatime v. relatime - Go for noatime on the flash! It might not be a lot of difference, but you want as few writes as possible.

    So there you have it.

  38. Use faster flash-drives by blanchae · · Score: 3, Informative

    There's quite a discrepancy over the speeds on flash drives. Cheap flash drives run USB 1.1 and the transfer rates are around 1 MB/sec. USB 2.0 drives range from slow 10 MB/sec to close to 40 MB/sec. The fastest drives will cost easily over $100. The size of the drive will slow the transfer rate also. 4 GB drives are faster than 8 GB and so on. Corsair GT drives have close to 35 MB/sec read speeds, write speeds are always dramatically slower. I've installed a bootable PBX in a Flash on a 4 GB Corsair USB flash drive with very acceptable performance for teaching purposes. I can see other LAMP bootable installations popping up. Each student can have their own server to configure and boot-up then take shut it down and take it home.

  39. Re:optimizing Linux on USB: multiple angles of att by Anonymous Coward · · Score: 1, Informative

    puppy linux can load to ram and then no longer needs the loading medium

  40. Re:optimizing Linux on USB: multiple angles of att by RiotingPacifist · · Score: 1

    Cant he keep /bin & /usr/bin on the HDD and just have the kernel load into ram anyway?

    --
    IranAir Flight 655 never forget!
  41. Needless encryption by Anonymous Coward · · Score: 1, Interesting

    Do you really need to encrypt everything? Why don't you create a separate partition for your /home (and /var /etc and /tmp if you really want to); encrypt that/those but not the rest. I can't see why there'd be anything confidential about what's in all other directories, especially since almost all the rest is probably open source anyway.

  42. I/O Priority by Rural · · Score: 1

    If the ordinary experience is acceptable, try running background jobs or I/O intensive non-interactive jobs using the ionice command, such as
    ionice -c 3 apt-get update
    (Make it suid or run as root.)

  43. Re:optimizing Linux on USB: multiple angles of att by Anonymous Coward · · Score: 1, Informative

    2) Use a Linux distribution with a smaller footprint such as DSL (50MB) or Puppy Linux (standard edition is 68MB): the smaller the footprint, the less your drive has to read, the faster your system will load.

    Puppy does exactly what the Original Poster asks for. It loads everything into RAM and when you shut down/reboot it asks if you want to save the changes to disk - this includes newly installed packages, updates, your documents, settings etc. You have the option for this "save file" to be encrypted (and password protected) or not.

  44. Re:optimizing Linux on USB: multiple angles of att by qaz20 · · Score: 2, Informative

    Puppy has also done a lot of optimizing for running on a USB stick, and it can handle encrypted partitions. Check it out: puppylinux.org

  45. No swap and use a ram disk by blackjackshellac · · Score: 0, Redundant

    Do not swap onto your USB drive, that is a very bad idea and will lead to horrific performance, and a failed USB key. Second, setup a ram disk on boot and put /var there so that all logging goes to ram disk. Most USB keys will fail otherwise because they are not designed for repetitive write cycles.

    --
    Salut,

    Jacques

  46. Re:Dave Jones suggestions for the eee900 might hel by goarilla · · Score: 1

    how about disabling or decreasing syslogd log priority to log only critical or emergency messages
    and/or to have /tmp /var/tmp /var/log bind mounted on a dynamic tmpfs or static ramfs
    so you don't have logs and variable files hitting the flash ever

  47. Re:USB has high cpu use and encrypted does not hel by Ginger+Unicorn · · Score: 1

    A sentence is supposed to begin with a capital letter.

    --
    (1.21 gigawatts) / (88 miles per hour) = 30 757 874 newtons
  48. Re:Dave Jones suggestions for the eee900 might hel by Mr+Z · · Score: 1

    I'm not sure much gets logged on a properly functioning system with few services enabled. I just looked at my /var/log/messages on my Ubuntu system. It's pretty mind-numbingly boring:

    Nov 30 07:53:25 metal syslogd 1.5.0#1ubuntu1: restart.
    Nov 30 08:08:06 metal -- MARK --
    Nov 30 08:28:06 metal -- MARK --
    Nov 30 08:48:06 metal -- MARK --
    Nov 30 09:08:06 metal -- MARK --
    ... several more pages of the same ...
    Dec 4 07:08:06 metal -- MARK --
    Dec 4 07:28:06 metal -- MARK --
    Dec 4 07:48:06 metal -- MARK --
    Dec 4 08:04:36 metal syslogd 1.5.0#1ubuntu1: restart.
    Dec 4 08:28:07 metal -- MARK --
    Dec 4 08:48:07 metal -- MARK --

    That's one new write appending to the log every 20 minutes. I think by that point it's officially in the noise, even if it ends up being two writes (the second for updating the size and mtime in the inode).

    As for /tmp, where does Fedora mount /tmp by default? I thought all the cool kids were using tmpfs these days. Of course, Ubuntu doesn't seem to for /tmp itself, but it does for some other transient filesystems:

    $ mount | grep tmp
    varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
    varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
    udev on /dev type tmpfs (rw,mode=0755)
    devshm on /dev/shm type tmpfs (rw)

  49. Re:Dave Jones suggestions for the eee900 might hel by Anonymous Coward · · Score: 0

    forgot the best one: squashfs and unionfs. new computers are faster at using compressed filesystems than reading/writing to flash/usb.

  50. Anonymous Coward by Anonymous Coward · · Score: 0

    Ever looked at squashfs?
    As your Basesystem is compressed, it seriously reliefs the I/O load.

    I am using an selfbuilt gentoo system on an 4GB USB stick. The stick itself is somewhat slow but squashfs really helps to have a nice running system. Changes to my System are written into an ext3 system. If that systems becomes to big i just again compress it with squashfs and put it as a layer onto my original squashfs with the help of aufs (which also serves to put the rw layer upon all the squashfs)

    This procedure has also the nice point of being snapshotlike ... destroyed your system? just delete der rw overlay and everything is fine again :D

  51. use unionfs by Anonymous Coward · · Score: 0

    What you need to do is set up a ramdisk, copy over your files to it, mark it read-only and do a union of the ramdisk with the usb, so writes get recorded to flash but everything is read out of ram (unless it changed)

  52. Optimizing writes with unionfs by DancesWithWolves · · Score: 1

    If you want a thin, snappy solution, try Puppy Linux. It loads itself into memory and runs from there.

    However I have been using a full Ubuntu install on a 4GB USB drive with some modifications to optimize writes. I used unionfs to transparently overlay a ramdisk on top of some directories that are likely to be written to (/var, /etc, /home, /usr, etc). Unionfs provides a merged view of the overlaid directory and the ramdisk, while disallowing writes to the overlaid directory. What this means is that when I read a file it comes from the flash, but when I write to the file it goes to the ramdisk and not to the flash. Future reads of that file will come from the ramdisk version. So "apt-get install" writes everything to ramdisk and is super fast. If I decide later that I want to keep the updates, I can run a script that syncs the changes from the ramdisk to the flash. Of course this also means that if I don't like the updates I can just reboot and everything will be as it was before the install.

    I did this based on a few web links that talked about similar things, but I haven't documented it publicly. If anyone is interested in knowing more, contact me at cc02568c at y-a-h-o-o dot com.

  53. BETTER FILESYSTEMS for SSD's, anyone? by Anonymous Coward · · Score: 0

    http://hardware.slashdot.org/comments.pl?sid=1049611&cid=25978057

    See "Tubal-Cain"'s posting there. You decide.

    APK

  54. Do you really need to by Anonymous Coward · · Score: 0

    What's so important on your USB drive that you can't just shell into a server? Do you really need more than PuTTY? or maybe Xming? It seems to me like using someone elses PC to boot into your personal USB drive is against etiquette, or am I wrong by saying that?

  55. This is stupid by Master+of+Transhuman · · Score: 1

    So in other words, this guy is concerned that somebody steals his USB drive, decrypts the passwords in /etc/passwd and /etc/shadow and then does what? Find the key for his encrypted files? Which he conveniently stored on the USB drive and used a weak password so somebody COULD crack it?

    Is this guy a member of Al Qaeda or being otherwise actively hunted by the CIA, FBI, DIA, MI6, Interpol, and the Mossad? Or is he a child molester with kiddie porn on his USB drive? The Treasurer of AIG?

    What level of paranoia are we talking about here?

    Here's the bottom line - if you have that kind of critical sensitive data on a USB drive, you're an idiot, not just a paranoid.

    How many cases in this year alone have we seen of people losing critical sensitive data on USB drives?

    If you can't afford to lose it or have somebody see it, don't put it there. It's that simple.

    --
    Richard Steven Hack - This sig is TOO GODDAMN SHORT TO DO ANYTHING USEFUL WITH! MORONS!
  56. Re:Dave Jones suggestions for the eee900 might hel by Anonymous Coward · · Score: 0

    He has some good points, but one of them doesn't really apply to USB flash drives.
    (I don't know much about the SSD's, so this may or may not be relevant to them as well)

    Next, the default filesystem will be ext3. You really don't want this. [...] Given the journal is in a fixed location on disk, scribbling to it every time a file gets written is a great way to wear out the flash.

    This is not really correct. On a USB stick, whatever file system you use is still running on top of the USB sticks internal storage mechanism. This (should) have a built-in wear leveling mechanism, which should prevent the burn out.

    HOWEVER he continues to say: "Additionally, not having to write to the journal means that you're doing less IO, which is obviously a win when it's on such slow media."

    Which is a VERY valid point, not only are you doing less I/O, but you're not having to wait for the usb stick to wear-level the entire journal every time you update it.

    My advice- Use the USB drive to boot and store data between sessions. Use a ramdisk for all the actual OS stuff, i.e. don't do anything that needs to do any kind of random I/O from the flash itself (swap, cache, etc).
    If you're short on memory, I'd advise using 2 sticks, a secondary one for all your data so if you do burn out the stick your data is still safe on the other one.

    Basically, the only time you want to write to the USB stick is when you're getting ready to shut down, and are just doing a straight write-only dump to the stick.

  57. Google please! by Anonymous Coward · · Score: 0

    Once you try to search, you find Slax - the distro that answers all your questions.

    As of swap file - you need 2GB of RAM to run up to 10 apps at once including office, browser and mail without even turning on your swap.

  58. Let me hijack this thread for two questions by RichiH · · Score: 1

    1) Fastest USB thumb drive which is rugged and has 4 GiB or more of storage?
    2) Fastest SDHC card with 4 GiB or more of storage?

    Thanks!

  59. Use a compressed read-only filesystem by ploppy · · Score: 1

    Use a compressed read-only filesystem like Squashfs. For genuinely read-only directories (like /usr) these can be used directly, for directories that need to be writable, the read-only Squashfs can be used with aufs/unionfs to make it writeable. A number of people have mentioned systems like Puppy, and that is exactly what these systems do.

    Using a compressed read-only filesystem not only solves the wear-levelling problem, but it makes accesses faster because less data has to be read. It also means more data can be fitted into the flash.

    Search for Squashfs, aufs/unions and flash, you'll find lots of pages explaining what to do.

  60. Re:Dave Jones suggestions for the eee900 might hel by Anonymous Coward · · Score: 0

    In general, i don't think it is a good idea for distros to mount /tmp to tmpfs for the reason that some programs might want to write large amounts of data to /tmp, e.g. you have 512MB RAM, that makes the default tmpfs size 256MB, then you want to edit a 30 minute MP3 with Audacity, Audacity will decompress the MP3 to /tmp so it can work on it but it needs ~280MB space to do this, it will fill up /tmp then throw an error leaving the user with a problem. This is a real example because it happened to me, it's not a big deal for a user that understands the problem, but it is for a user that doesn't, and is a good argument for not making it default since the more knowledgeable users can enable it themselves anyway.

  61. usb 3.0, and jfs by Anonymous Coward · · Score: 0

    usb 3.0 is more or less out now, so wait for 3.0 flash drives to come out-- they're over 10 times faster than 2.0 (5.0 Gb/s, or 625 MB/s) ; that'll speed things up quite a bit.

    also, I'd recommend jfs filesystem for the actual OS, as jfs is the best easily available (and stable) fs for small files, and linux (especially the core system) is mostly small files.

    35 MB/s is 280 Mb/s, which is relatively close to the 480 Mb/s USB 2.0 limit. the advertised 480 is "theoretical"-- the average speed of usb hard drives is 20-25 MB/s. the main reason why theoretical and reality don't match up is that "overhead" is included in the speed rating- which IMO is deceptive advertising, since that kind of information is useless to consumers.
    Similarly, Base-100 ethernet usually doesn't get better than 50/mbps- half the line is overhead.

    here's my source: http://www.lyberty.com/tech/terms/usb.html