Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: USB Thumbdrive as swap?

  1. #1
    Join Date
    Sep 2006
    Location
    Sunny Florida
    Beans
    944
    Distro
    Ubuntu 6.10 Edgy

    USB Thumbdrive as swap?

    Right, I'm putting this in the cafe, since it's not a request for specific help per se, just a wondering of mine.

    I've used Vista a few times, and pretty much the only thing I really liked was Readyboost.

    For those of you who haven't seen or read about it, Readyboost basically allows you to use USB memory sticks as system memory, rather than just storage. It's pretty neat.

    Now, as far as I can work out, it essentially is using the memory sticks as a swap space, in a similar way as linux distros use a swap partition. So basically, is there any way that you can configure ubuntu to use a memory stick as swap?
    Bean Count!=Knowledge (see above)
    Microsoft gives you windows, linux gives you the whole house

  2. #2
    Join Date
    Apr 2006
    Beans
    95
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: USB Thumbdrive as swap?

    I don't see why it wouldn't be possible. The way I'd try and do it would be as follows:

    1. Use GPartEd (Gnome partition editor in the repos) or some other partition editor to format a usb stick to linux-swap FS. Then, with the alternate install CD, with the newly formatted stick plugged in, select your swap partition as the stick. Then make sure you've got the stick plugged in at boot time.

    Also you could probably skip the new install and just select the formatted stick as extra swap.

    Can anyone who knows more about filesystems than me see any reason why this wouldn't work?
    Sudo aptitude install brain common-sense reason FUDfilter patience persistence sheer-luck sense-of-adventure

    Don't sudo rm -rf! Read the manual page: $ man command. Good luck!

  3. #3
    Join Date
    Oct 2005
    Location
    United Kingdom
    Beans
    4,848

    Re: USB Thumbdrive as swap?

    You could make a swap file on the usb disc (as opposed to swap partition) and use that in your fstab.

    HOWEVER please be aware that flash drives have a limited number of writes to each bit... swapping could burn them out reasonably quickly
    Every time you install Jaunty, a kitten........ wait sorry what year is this again?
    Please don't PM support questions, post a thread so that everyone can benefit
    Join us in #ubuntuforums on irc.freenode.net

  4. #4

    Re: USB Thumbdrive as swap?

    Pricey's right, but given the cost of USB drives these days, you might not care. Or if you had a bunch of leftover drives that don't get used, you could burn them up that way.

    Methinks this might do the trick, but I'm just thinking out loud, so I'm probably wrong.

    1. Insert USB stick
    2. sudo umount /dev/sdXY #or whatever your stick is mounted as; I don't think you can shred and reformat a mounted stick
    3. shred -v -n 1 -z /dev/sdXY
    4. sudo mkswap /dev/sdXY
    5. sudo swapon /dev/sdXY

    Maybe? Any help?
    Ubuntu user #7247 :: Linux user #409907
    inconsolation.wordpress.com

  5. #5
    Join Date
    Dec 2006
    Beans
    256

    Re: USB Thumbdrive as swap?

    All of the USB memory sticks I have seen are extremely slow and would be a poor choice for swap space (on the order of 40 times slower than a hard drive). Granted, I have not investigated this in the last year but, if you are considering it, definitely examine the access speed.

  6. #6
    Join Date
    Nov 2004
    Location
    Elvis Country, TN
    Beans
    Hidden!
    Distro
    Ubuntu 6.10 Edgy

    Re: USB Thumbdrive as swap?

    definitely possible to do, but you'll wear that thing out fast as they only support a limited writes. I would not recommend it.

  7. #7
    Join Date
    Jan 2006
    Beans
    4,208
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: USB Thumbdrive as swap?

    The write-cycles limitation has always scared me off putting a swap partition on a flash drive. In fact, I don't even format journaled filesystems on flash drives for the same reason. I quite liked running an installed bootable PCLinuxOS on a flash drive for a while (it was the only way I could seriously run Linux at work).

  8. #8
    Join Date
    Aug 2005
    Beans
    73

    Re: USB Thumbdrive as swap?

    Quote Originally Posted by d3v1ant_0n3 View Post
    Now, as far as I can work out, it essentially is using the memory sticks as a swap space, in a similar way as linux distros use a swap partition.
    No, it is more clever than that. Readyboost is used as a cache where memory pages are written to both the memory stick and to the harddrive. So when the kernel needs to retrieve a page it first attempts to load it from the usb-drive, which is faster for random reads than the harddrive, and if that fails it reads it from the harddrive so your system will not die horribly if someone yanks the drive from the usb slot or if the usb-drive fails.

    Readyboost also encrypts the swap so that important data can't be read by someone else snatching the memory stick, which is really important as swap can contain sensitive stuff like encryption keys.
    Touting "community" as a strength of a distribution is the equivalent of stating that it has poor documentation.

  9. #9
    Join Date
    Sep 2006
    Location
    Sunny Florida
    Beans
    944
    Distro
    Ubuntu 6.10 Edgy

    Re: USB Thumbdrive as swap?

    Thanks for the input guys. It was more a musing of mine rather than something I wanted to try.
    Bean Count!=Knowledge (see above)
    Microsoft gives you windows, linux gives you the whole house

  10. #10
    Join Date
    Oct 2004
    Beans
    Hidden!
    Distro
    Ubuntu Karmic Koala (testing)

    Re: USB Thumbdrive as swap?

    Quote Originally Posted by JLB View Post
    definitely possible to do, but you'll wear that thing out fast as they only support a limited writes. I would not recommend it.
    I want to question the benefit period. Is it noticeable, and are there any benchmarks (non MS funded)?

    I know that in general using hd swap is like 10,000x slower than RAM (I mean come on milliseconds seek times vs a few nano seconds with RAM nowadays)

    Although I've set Ubuntu to have a 2 gig swap on my laptop with 1 gig ram... I've yet to see my swap usage exceed about 19 kilobytes (I made it big for hibernate purposes, and out of habit, 2x was what I always used back in the day...)

    So I don't think the tech would benefit me...

    So you have a flash thingy, limited writes (what if it's yanked out during use), using usb bandwidth?, drawing more power?, if it's encrypted the computational overhead and possible lag?

    Hopefully faster than a hard drive, but no way it's faster than RAM (correct me if I'm wrong)

    Anyway, I'm one of those folks that is happy Ubuntu and apps use up RAM vs trying to stay in swap...

    Also who is this tech targeted toward, high end machines with small amounts of RAM? Or what?
    The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -- Richard Stallman

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •