Help - Search - Members - Calendar
Full Version: Installing Debian To A Usb Flash Drive With A Swap Partition
OESF Portables Forum > General Forums > General Discussion
I'm considering doing the following thing:

I'd like to get a new USB flash drive that's fast.

Install a fully encrypted debian to it with only boot unencrypted, so that I can then use it to boot a computer with it and work on it, saving all the documents to it too.

I'd like to also have a swap partition on the drive, since I don't want to swap to an unencrypted swap partition on the host computer. Now obviously swapping will decrease the life of the flash drive.

What's the best way to minimize damage to it.

Some time ago there was talk about formatting a CF card, with leaving a part of it, i.e. 200 MB for a big one un mkfsed, as this would reduce the wear on the card. Would this be advisable here?

Also, will having a separate swap partition limit the wear just to these parts of the flash?

Probably not, since I want to install debian: create a 100 MB /boot (ext3) as primary partition, and make the rest of the hard drive one huge partition which has "Use as:" set to "physical volume for encryption".

Any thoughts on how to best go about this?

Also, since ext3 uses heavy journaling it's usually advised to set up flash drives as ext2, on the other hand, when the whole huge partition will be encrypted, maybe preventing data loss via using ext3 would be desirable?

Can anyone comment on this?


I'm afraid I don't know enough about current wear-leveling technology in flash drivers, but I can at least point you at another way to minimize how often swap is used:
echo 10 > /proc/sys/vm/swappiness

That will drastically reduce the tendency of the kernel to use swap when it doesn't *really need to.*
You might google for swappiness for info on how to tune it further.
Good luck!

Would this be interesting to you?
Yeah, this is one of the guides I've been considering. From what I've read so far, it seems definitely that swap on flash won't do...
So, I tried doing something like this, though the easier way I think. Installed debian from a netinst CD to a USB stick. Made an unencrypted boot partition and an encrypted partition, using LVM. Installed the system to it.

Then ran:
install-grub --recheck /dev/sda
ran fine...
then in grub ran:
root (hd0,0)
setup (hd0)
ran fine...
Then ran update-grub.
Checked the /boot/grub/menu.lst on the stick, is fine.

But upon boot with the USB inserted, the system halts with a Boot Error.

The USB is bootable though, since I checked prior to install by putting a DebianLive image on it, and it would get me to the Grub menu. But here I don't get to the Grub menu.

The system is there, I can mount the lv's by hand etc.

So how can I make the USB bootable properly and get to the Grub menu upon boot?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.