[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: portable Debian

On Sat, Feb 13, 2010 at 08:44:59AM EST, Germana Oliveira wrote:

> Well, no, what i really want is a portable Debian, so i can, for
> example, build a web app and show it everywhere without need a web
> server.... and just have my own configuration and run it every where

Is this what you are talking about?


I did something similar and started documenting it in the attached

Title: The quick and Dirty LiveUSB

The quick and Dirty LiveUSB

Table of Contents

1. Hardware
2. Cloning the system
3. Configuring grub-pc
4. Configuring the clone
5. On my laptop
6. Other machines
6.1. Booting the clone
6.2. Running the clone
7. Synchronisation
8. Conclusion
9. Appendix

Chris Jones <cjns1989@gmail.com>


After cloning my debian lenny system to another partition on my hard drive in order to safely upgrade to debian testing, I realized that I could use the same technique to create a bootable copy of my current system that I could carry around on a USB stick, and hopefully boot any PC I might run into, as long as it had one free USB port, thus saving myself the headaches and backaches of taking my laptop with me, and yet have both all my data and my highly specific desktop everywhere I go.

Well, here’s how it went.

1. Hardware

The entire procedure was tested on a Dell Inspiron 7500 laptop, whose BIOS is not capable of booting off of a USB device. The USB stick is an 8GB Sandisk Cruzer Micro, acquired from my local Radio Shack at the reasonable cost of about USD 20.00. Since the laptop only supports USB 1.1, running linux off of the USB stick turned out to be very slow, with a very noticeable lag when starting applications.

2. Cloning the system

There are other tools, but since there were parts of my debian lenny file system I did not wish to copy to the USB stick, I found that rsync was fitted well this particular task. Since I had never used rsync, it was also well worth the extra effort to gain some familiarity with rsync, since once the clone is finalized, it will be imperative to keep the two systems in sunc', something that rsync does efficiently, and that other tools do not appear to do out of the box.

One useful aspect of rsync is that it supports dry runs via the -n | --dry-run flags, which lets you verify ahead of time that your carefully carved rsync command is doing what you expect.

It seems to be indispensable to run rsync as the superuser, since my personal user does not have read access to all the files that need to be copied to the target system.

Some directories were not copied to the target system, either because their content is specific to the source system, such as /proc, /tmp, /sys, or because their usefulness on the target system was questionable, such as my collection of debsrc’s for instance, and would both use up space on the USB stick, and greatly increase the time it takes to clone the system.


It appears that the main difficulty with rsync is to understand exactly how to specify the directories that need to be excluded from the cloning.

Here are the commands that I issued:

# mount -t ext2 /dev/sda1 /media/memstick

# rsync -av / /media/memstick
# rsync -av /usr /media/memstick
# rsync -av /home/myuser/ /media/memstick/home
# rsync -av /var /

3. Configuring grub-pc

the idea was to verify that at least on the same hardware as the cloned system everything worked

the bug, and how I was advised to work around it for now (debug=uhci,ohci,usbms + insmod uhci & usbms and the orange light came on)

adding 2 stanzas to /etc/grub.d/40_custom + update-grub

4. Configuring the clone

obviously /etc/fstab must be adjusted to mount the file system on the USB stick

network aspects - the laptop has a pcmcia nic - what happens with a regular PCI nic, how about WiFi.. what of funny

ISP issues: I have cable, what about DSL.. ISDN.. good old POT modems..

udev - avoid creating new devices for ethx or cdrom’s etc. on each new machine

Xorg - I love native resolutions .. I hate black screens


5. On my laptop

everything worked first time around, albeit slowly

what I tested: ….

6. Other machines

6.1. Booting the clone

need to make the USB bootable

need to burn a grub rescue CD for those systems whose BIOS cannot boot off of a USB device

6.2. Running the clone

Be prepared! it may not be convenient to travel back to the main system to fix stuff.. and it may likewise not be easy to fix them locally. Bring along a copy of a decent rescue CD just in case

need as generic a config as possible need to separate private data from programs

is it a good idea to have one partition for the the system and another for /home?

security & privacy issues - at least be aware of the fact that USB sticks are small and it’s easy to lose them, or forget them on some public PC somewheres..

Slowness of the system

7. Synchronisation

All done with mirrors .. rsync I mean.

This needs to be optimized and easy as peach .. since it is imperative to do it immediately upon booting into the main system and before leaving on an errand - no exceptions

8. Conclusion

easy does it

there are really three families of files: executables, configuration files, private data

a better strategy might be to install a system with all the useful software as the laptop on the USB stick and copy over the customization - mainly config files but not only (scripts, e.g.). See Rob Owens’s instructions.

9. Appendix

rsync scripts - cloning / syncing /etc/fstab udev rules?

Reply to: