]> git.sur5r.net Git - bacula/rescue/blob - rescue/linux/usb/README.usb
c3a64034791847ecb9559035ae242ea934ced2f2
[bacula/rescue] / rescue / linux / usb / README.usb
1
2 Copyright (C) Kern E. Sibbald, 2009
3
4 This directory is used to build a USB key containing a Kubuntu 8.04 LiveCD
5 with persistent OS files and persistent /home files.
6
7 You will need to run as root for most things ...
8
9 Packages needed:
10 apt-get install syslinux mbr
11
12
13 1. Start by editing the "config" file. Be sure to get your USB_DEV
14    definition correct.  Note: you can see what devices you have
15    connected by running:
16
17       lsscsi
18
19    For example, I get:
20
21    $ lsscsi
22     [1:0:0:0]    cd/dvd  _NEC     DVD+RW ND-1100A  108B  /dev/scd0
23     [1:0:1:0]    cd/dvd  PHILIPS  DVD+-RW DVD8631  9D03  /dev/scd1
24     [9:0:0:0]    disk    Kingston DataTraveler 2.0 PMAP  /dev/sda
25
26    and in my case, the USB device is the Kingston DataTraveler on
27    device /dev/sda.
28
29    Alternatively you can do:
30
31        fdisk -l
32
33 2.  The scripts you need to partition the key and 
34    to write the boot image to it are all in this (usb) directory. 
35
36 3. If you ever want to put the key back to its prior state, *before*
37    running the partition_usb_key, you might consider doing a:
38
39      sfdisk -d /dev/key-device >save_me  
40
41    where key-device is the key device name (e.g. sda).  The
42    output file can be fed back into sfdisk to recreate the original
43    with:
44
45      sfdisk /dev/key-device <save_me
46
47 4. The next step is to get a copy of kubuntu8.tar.gz, which is the
48    USB boot image. Currently, it can be downloaded from:
49
50     www.bacula.org/downloads/kubuntu8.tar.gz
51
52   or from:
53
54     www.sibbald.com/download/kubuntu8.tar.gz
55
56 5. Edit the file "config" and fill in the values that correspond
57    to your setup.
58
59 6. After editing the config file, run:
60
61    ./partition_usb_key
62
63    Note, this script will destroy *all* data on the key, and assumes
64    that you have a 3GB or bigger key.  It may work for a 2GB key,
65    but you might want to reduce the size of the second partition.
66
67
68    The partition_usb_key script creates three partitions:
69
70     1. kubuntu8  -- USB boot partition containing the OS
71     2. casper-rw -- A writable ext3 partition for saving OS changes
72     3. home-rw   -- A writable ext3 partition for saving /home
73
74 6. Mount your USB key and detar the kubuntu8.tar.gz image 
75    into the first partition.  Do this with:
76
77    ./write_usb_boot_partition
78
79    This can take a good amount of time (5 mins) since it must format
80    the new partitions then copy the boot image.
81
82 7. You should now have a USB stick that can be booted providing the
83    machine permits booting from the USB port -- this can be adjusted
84    by modifying the BIOS boot sequence.  On Dell machines, you can 
85    enter the BIOS setup by pressing F2 just after power on.  
86
87    Alternatively, most machines let you boot from an alternate device.
88    For example if you press F11 while a Sony Viao is powering up, it 
89    will boot from the USB port. 
90
91    On Dell machines during power on, if you press F12, you will be
92    able to select any boot device (one time only) other than the one
93    that is the default (normally the CDROM or HDD).
94
95 8.  When the key is booted, assuming you choose the first option 
96    (LiveCD), you will be running as user "ubuntu" the password is
97    "bacula", and you will be in /home/ubuntu.  
98
99 9. Before booting, you might want to remove the USB key, using the
100    remove safely mode, then plug it back in so that you can access
101    the home-rw partition. Here you can put anything you want from
102    your system. However, you must use care to ensure that the files
103    are written with UID=1000 and GID=1000, which is ubuntu:ubuntu when
104    your boot the USB key.
105
106 10. Finally, if you are running with a KDE desktop on Kubuntu 8.04,
107    you can copy it to the key with:
108
109    ./copy_kubuntu_desktop_to_usb
110
111    If you are not using Kubuntu, you can modify the script to 
112    adapt it to your situation or simply create a new script.
113
114 ===
115
116 If you want to add additional OS tools to your USB stick, there are two
117 ways:
118
119 1. Remaster the iso boot image (a bit complicated) see README.technotes
120 2. Simply use sudo apt-get install ... when booted into your USB stick. 
121    The changes will be written to the casper-rw partition (the
122    read/write OS partition).
123
124 If you want to add something to your USB home directory simply mount
125 the home-rw partition and write to it in the appropriate place as noted
126 in item #9 above.
127
128 One slightly annoying thing about the USB key is that the casper-rw and the
129 home-rw partitions must be ext3 (with journaling turned on), and journaling
130 is not really the best way to run with USB keys that have a finite write 
131 lifetime. Switching the partitions to ext2 seems to prevent them from being
132 written correctly, which means a lot of things such as starting X do not
133 work.