On 07/01/2010 08:59 AM, SpaceCake wrote:
> that's good if I want to mount at a specific location, but for swap I
> need the device name, but this is changes depending on how many other
> usb drives are connected. Looks lik this is a tricky question  :)

No, you don't *NEED* the device name to mount swap, you can use a UUID
or a filesystem label:

# swapon -h

Usage:
 swapon -a [-e] [-v] [-f]             enable all swaps from /etc/fstab
 swapon [-p priority] [-v] [-f] <special>  enable given swap
 swapon -s                            display swap usage summary
 swapon -h                            display help
 swapon -V                            display version

The <special> parameter:
 {-L label | LABEL=label}             LABEL of device to be used
 {-U uuid  | UUID=uuid}               UUID of device to be used
 <device>                             name of device to be used
 <file>                               name of file to be used

Just put

LABEL=cakeswap none swap sw,user 0 0

in your fstab

and use "mkswap -L cakeswap" on your USB stick.

Certainly, you'd want to use "swapoff" *before* you removed the stick,
so that's going to have to be a manual step so I think you're stuck
unsticking your stick.



Reply via email to