~ubuntu-branches/debian/jessie/bootcd/jessie

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
Bootcd Backup FAQ

Contents
1. General Backup Questions
2. Create an online backup
3. Create an offline backup
4. Restore a backup
5. How to use ...
6. Known Bugs

1. General Backup Questions

1.1
Q: Can I use bootcd to backup and restore redhat or suse?
A: You can create a bootcd which contains a backup (<bootcd-with-backup>) of 
   almost any linux system (<target-system>). 
   
   You can either do this backup online, or offline. 
   Online is good, if you do not want to stop the <target-system>. but be aware 
   of the fact, that the backup of a running database may be corrupt. 
   If you want to be sure, that everything is stopped, you may prefer to create
   an offline backup.

1.2
Q: Why should I create a <bootcd-with-backup>, mentioned in the above question,
   How can I use it.
A: The <bootcd-with-backup> can be used to recover the <target-system>, even if
   it is not bootable anymore.

   The <bootcd-with-backup> can be used to restore the <target-system>
   if the harddisk has been changed to another, maybe larger, harddisk.

   The <bootcd-with-backup> can also be mounted from the <target-system>
   to restore only specific files.

   The <bootcd-with-backup> can be used to reinstall the <target-system>, with
   a changed filesystem layout.

1.3
Q: What is the difference between the debian packages bootcd and bootcd-backup
A: The bootcd package includes the command bootcdwrite which creates a life-cd 
   with your actual debian system. This life-cd can be restored with 
   bootcd2disk. If you created a life-cd with bootcdwrite you do not need 
   bootcd-backup.
   
   But if your debian system uses an initrd (most usual), you also have to 
   install the debian package bootcd-mkinitramfs to use the package bootcd. 
   Bootcd-mkinitramfs will change your initrd. If you do not want this you can
   use bootcd-backup instead which will not change anything on your debian 
   system.

   Bootcdbackup uses an extra debian bootcd which has the actual backup of 
   your system in a directory /backup. Also the harddisk configuration of
   your system is described in /backup/bootcd2disk.conf. You can also have
   non debian backups in /backup. But you will not have a life-cd running
   your backups.

2. Create an online backup

2.1
Q: How can I create a <bootcd-with-backup> with an online backup ?

A: Here is an example to create a bootcd which contains a backup 
   (<bootcd-with-backup>) of a linux system (<target-system>).

   You need space to hold an image of the backup on the <target-system>.
   We assume you found space in </var/space> and you do not want the large 
   partition </data> to be backed up, because it would not fit on one DVD.

   There is now a wizard that can help. Get it with:
     wget ftp://bootcd.alioth.debian.org/pub/bootcd/bootcdbackupwizard.tar.gz
   You can also select earlier versions. For example with:
     wget ftp://bootcd.alioth.debian.org/pub/bootcd/bootcdbackupwizard_3.08.tar.gz

   The tar includes the debian packages a README and a script to extract the
   debian packages. After extracting you can run bootcdbackupwizard.
     ./bootcdbackupwizard -d </var/space> -e </data>
     
   The bootcdbackupwizard does the following:

   1. The wizard gets the debian debootstrap package.
      wget http://ftp.de.debian.org/debian/pool/main/d/debootstrap/debootstrap_<version>.deb

   2  The wizard starts a script to create the bootcd-with-backup image.
      ./bootcddebootstrap -d </var/space> $PWD/debootstrap_<version>.deb

   3. Now some Information from the running target-system have to be selected. And
      the  file bootcd2disk.conf has to be created with this information. This can
      be done with the script bootcdmk2diskconf.
      
    . The wizard uses the script from the new created bootcddebootstrap.
      ./bootcdmk2diskconf -b >/var/space/backup/bootcd2disk.conf

   4. Now the wizard does an online Backup. If you are running databases, it
      would have been better if you had stopped them before running the wizard.
      The wizard mounts the disks used by the target-system into the chroot 
      environment. The wizard knows about this disks from bootcd2disk.conf
   
      chroot /var/space "bootcd2disk -c /backup -onlymount"

   5. Then the wizard starts the backup
      
      chroot /var/space "tar -c -C/mnt --exclude </data> -zf /backup/backup.tgz ."

   6. If you need to modify the options in bootcdwrite.conf, do this now.
      To be able to do interactive changes you had to use the option -i when
      starting bootcdbackupwizard.

      vi /var/space/backup/etc/bootcdwrite.conf

   7. Unmount the previously mounted filesystems of the target-system:
     
      chroot /var/space "bootcd2disk -c /backup -onlyunmount"

   8. Create the image:
      
      chroot /var/space bootcdwrite

   9. Now use your favorite tool to burn the CD/DVD.


3. Create an offline backup

3.1
Q: How can I create a <bootcd-with-backup> with an offline backup ?

A: For the example below, we assume, you have another system with debian 
   installed (<debian-system>). You can use this to create a <mini-bootcd>. 
   Then you can boot the <target-system> with the <mini-bootcd>. 
   You can copy the data from the <target-system> to the <debian-system>. 
   And then you can use the <debian-system> to create the needed 
   <bootcd-with-backup>.

   To do this you need enough space on the <debian-system>. For the example
   below, we assume there is space in the directory </space> on the 
   <debian-system>. Also maybe not all data from the <target-system> will fit 
   on one DVD. So we assume we have found the directory </data> on the 
   <target-system> which can be backuped separately and should not go to
   the <bootcd-with-backup>.

   Do the following steps:

   1. Create backup directory on your <debian-system>:

       <debian-system># mkdir /backup

   2. Run bootcdmk2disconf from <debian-system> on the <target-system> and 
      copy the result back to the <debian-system>

      <target-system># scp <debian-system>:/usr/share/bootcd/bootcdmk2diskconf /tmp
      <target-system># /tmp/bootcdmk2diskconf -b >/tmp/bootcd2disk.conf
      <target-system># scp /tmp/bootcd2disk.conf <debian-system>:/backup/bootcd2disk.conf

   3. Create a <mini-bootcd> from the <debian-system> with bootcdwrite.
      <debian-system># bootcdwrite

   4. Burn the <mini-bootcd> to a DVD.
      
   5. Boot the <target-system> from the <mini-bootcd> and mount the system you 
      want to backup to /mnt.
      
      bootcd2disk -c /backup -onlymount

   6. Backup the system you want to backup:

      tar -c -C/mnt -zf - . | \
        ssh -c blowfish root@<debian-system> "cat >/backup/backup.tgz"

   7. Create the <bootcd-with-backup> from the <debian-system>

      <debian-system># bootcdwrite

   8. Now use your favorite tool to burn the CD/DVD.


4. Restore a backup

4.1
Q: How do I reinstall from a <bootcd-with-backup>

A: To install a new system with the <bootcd-with-backup>, boot the 
   new system from the <bootcd-with-backup> and run

   1. bootcd2disk -c /backup

   Before you run this command you can set specific configuration options
   in /backup/bootcd2disk.conf

   The RESTORECMD defined in bootcd2disk.conf defines how the backup is
   restored. Because we restore a backup no files will be modified.
   If you restore your backup to another hardware, this may require changes
   in the files included in the backup (/etc/fstab). 

5. How to use ...
5.1
Q: How to use bootcddebootstrap
A: # become root
   export http_proxy=... # only if needed
   apt-get install --reinstall --download-only debootstrap
   /usr/share/doc/bootcd-backup/examples/bootcddebootstrap -i /var/cache/apt/archives/debootstrap_*.deb

6. Known Bugs

6.1
Q: Does bootcdbackup support selinux
A: Yes, but no full support.
   If selinux is enabled, bootcdbackupwizard uses star instead of cpio, 
   to save selinux attributes. But after restore with bootcd2disk the 
   system only works with manual interaction. The system first comes up 
   in single user mode. Than the partition with the file /etc/selinux/config 
   has to be mounted rw. For example "mount -o remount,rw /" and the line 
   SELINUX=enforcing in /etc/selinux/config has to be changed to 
   SELINUX=permissive. After reboot everything should work.

   This problem may only result from some missing options to star. Maybe
   someone finds out the correct options in future.