]> git.sur5r.net Git - bacula/rescue/blob - rescue/linux/usb/README.usb
Add new usb rescue key code
[bacula/rescue] / rescue / linux / usb / README.usb
1
2 Copyright (C) 2009-2010 Bacula Systems SA
3
4 This directory is used to build a USB key containing a Xubuntu 9.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 parted wget
11
12 Please make sure they are installed on your system before
13 continuing.
14
15 1. Start by editing the "config" file (DO NOT EDIT config2).  Be
16    sure to get your USB_DEV definition correct.  Note: you can
17    see what devices you have connected by running:
18
19       lsscsi
20
21    For example, I get:
22
23    $ lsscsi
24     [1:0:0:0]    cd/dvd  _NEC     DVD+RW ND-1100A  108B  /dev/scd0
25     [1:0:1:0]    cd/dvd  PHILIPS  DVD+-RW DVD8631  9D03  /dev/scd1
26     [9:0:0:0]    disk    Kingston DataTraveler 2.0 PMAP  /dev/sda
27
28    and in my case, the USB device is the Kingston DataTraveler on
29    device /dev/sda.
30
31    Alternatively you can do:
32
33        fdisk -l
34
35 2. The scripts you need to partition the key and 
36    to write the boot image to it are all in this (usb) directory. 
37
38 3. If you ever want to put the key back to its prior state, *before*
39    running the partition_usb_key, you might consider doing a:
40
41      sfdisk -d /dev/key-device >save_me  
42
43    where key-device is the key device name (e.g. sda).  The
44    output file can be fed back into sfdisk to recreate the original
45    with:
46
47      sfdisk /dev/key-device <save_me
48
49 4. The next step is to get a copy of rescue.gz and rw.tar.gz,
50    which are the USB boot image and the read-write partition.
51
52    To do so execute  
53
54    ./get_files.sh script
55
56    from within this directory.
57
58
59    It will download the required files to the "files" subdirectory  
60    of this directory.  You need only do this command once.  Once
61    you are finished building any and all USB keys, you can conserve
62    disk space by deleting:
63
64      files/rw.tar.gz
65      files/rescue.gz
66
67 5. If you have not already done so, edit the file "config" 
68   (never edit config2) and fill in the values that correspond 
69   to your setup.
70
71 6. After editing the config file, run:
72
73    ./partition_usb_key
74
75    Note, this script will destroy *all* data on the key, and assumes
76    that you have a 4GB or bigger key.  
77
78
79    The partition_usb_key script creates three partitions:
80
81     1. xubuntu9  -- USB boot partition containing the OS
82     2. casper-rw -- A writable ext3 partition for saving OS changes
83     3. bacula-rescue -- The actual place of our rescue scripts
84                         and saved data
85
86
87 6. Mount your USB key and copy the files to the key.
88    Do this with:
89
90    ./copy_bacula-rescue_to_key
91
92    This can take a good amount of time (5 mins) since it must format
93    the new partitions then copy the boot image.
94
95 7. You should now have a USB stick that can be booted providing the
96    machine permits booting from the USB port -- this can be adjusted
97    by modifying the BIOS boot sequence.  On Dell machines, you can 
98    enter the BIOS setup by pressing F2 just after power on.  
99
100    Alternatively, most machines let you boot from an alternate device.
101    For example if you press F11 while a Sony Viao is powering up, it 
102    will boot from the USB port. 
103
104    On Dell machines during power on, if you press F12, you will be
105    able to select any boot device (one time only) other than the one
106    that is the default (normally the CDROM or HDD).
107
108    for older machines you can boot on a cd that will point to your usb key
109
110    you can find such a cd at
111  
112    http://bacula.org/downloads/cd-boot-liveusb2.iso
113
114    burn the iso to cd, then boot on the cd and on the graphical
115    menu select usb (be sure to have no other usb devices than the key
116    attached at boot time)
117
118    wait for a while sometimes it doesn't pick up fast
119    but with a bit of patience it works
120
121
122
123 ===
124
125 If you want to add additional OS tools to your USB stick, there
126 are two ways:
127
128 1. Remaster the iso boot image (a bit complicated) see README.technotes
129 2. Simply use sudo apt-get install ... when booted into your USB stick. 
130    The changes will be written to the casper-rw partition (the
131    read/write OS partition).
132
133
134 One slightly annoying thing about the USB key is that the casper-rw
135 and the home-rw partitions must be ext3 (with journaling turned on),
136 and journaling is not really the best way to run with USB keys that
137 have a finite write lifetime.  Switching the partitions to ext2 seems
138 to prevent them from being written correctly, which means a lot of
139 things such as starting X do not work.