1 AUTHOR: Nathan Hall <nrh2@aber.ac.uk>
2 AUTHOR: Original hint by Eric Miller <emiller@techskills.com>
6 LICENSE: GNU Free Documentation License Version 1.2
8 SYNOPSIS: This will create an functioning duplicate of a finished LFS system.
10 DESCRIPTION: This is useful for:
12 - Creating a backup of an LFS system on the same physical machine. That
13 way if something goes wrong in BLFS, users can boot into the Backup system
14 and repair thier original LFS. (or reverse the process to "restore" thier
15 system to its original state.)
17 - Doing a quick install on another system, e.g. "clone". If you have
18 two identical systems with the same hardware, remove a hard drive from one,
19 mount in the LFS box, and follow the instructions here.
23 You will need really only three things to complete this _very_ simple project:
25 - a finished LFS system
26 - access to your original host system
27 - some hard drive space, unpartitioned, at least as large as your LFS system
31 Once you have finished building an LFS system, it might be a good idea to create
32 a backup of the new system, before continuing with BLFS and other projects. In
33 doing so, you can confidently experiment with your new system and not "buy the
34 farm" if things go terribly wrong. A good time to do this is right at the end
35 of the LFS book, and before moving on to BLFS. This hint will explain how to
36 create a dual-boot LFS system, using a finished LFS system as a model, without
37 doing another install.
39 If you followed the LFS book, your host system (the one you built LFS from),
40 will still be available in lilo. You may, however, have gotten rid of that
41 puppy just as soon as you logged into LFS without errors. There are creative
42 ways to get around the fact that you may not have access to your original host
43 system (the one you built LFS from). You can use the LFS boot CD, or a boot
44 floppy with the necessary tools (post to lfs-support for the url to the CD,
45 see other hints for making boot floppies).
47 Finally, unpartitioned drive space canbe on _any_ installed fixed drive. You
48 can even install a drive from another (identical) system, make this backup,
49 re-install the drive in the original system, and you have two LFS systems for
50 the price of one! (to do this, you would ignore the editing of fstab, and you
51 would need to use a boot-disk to run lilo and make the system bootable)
53 So, if you have those three things, let's do it! For this hint, we will use a
54 sample system that looks like:
58 /dev/hda3 LFS (original) #we will call this the source
59 /dev/hda4 the destination of our "backup" #we will call this the target
61 Note: If you are doing this at the end of the LFS book, or after any other big
62 jobs, you may want to get rid of /static, /usr/src, and any other big files like
63 lfs-sources.tar. You may also want to run the --strip script at the end of the
64 book (4.0). This is not necessary, and if you are uncomfortable deleting files
65 or running the script, then don't! It will only make your backup (considerably)
66 smaller and the process much faster.
68 ********************************************************************************
71 - Boot your system into the original host linux (or Boot CD or floppy).
73 - fdisk /dev/hda (or whatever drive you using as the target)
75 - Create a primary partition that is at least slightly bigger than the data of
76 the source LFS. When in doubt, 1GB should be PLENTY for post LFS system.
78 - mke2fs /dev/hda4 (change to your situation, use /dev/hd## of target)
80 - mkdir /mnt/backup (also mkdir /mnt/lfs, if its not there already!)
82 - mount /dev/hda3 /mnt/lfs (change to your situation, use /dev/hd## of source)
84 - mount /dev/hda4 /mnt/bckp (change to your situation, use /dev/hd## of target)
86 - cd /mnt/lfs (do not forget this, seriously!!!!)
88 - cp -Rav * /mnt/backup
92 - When cp is complete, do:
94 vim /mnt/backup/etc/fstab
96 and edit the fstab to include an entry for the new partition. Refer to the
97 LFS book, ch6, editing FSTAB, for detailed info if you need it.
99 - Save the new fstab, reboot the system (shutdown -r now).
101 - At the lilo prompt, choose your original (source) LFS system.
103 - Login as usual, and do:
105 cp /etc/lilo.conf /anydir/anywhere
108 Edit lilo to INCLUDE the new (target) system. The LFS book gives a good
109 example of what lilo.conf should look like, do <man lilo.conf> to see a VERY
110 good example of a dual boot lilo.conf entry.
112 - Save the new lilo.conf
114 - run lilo (its in your path, just type lilo and <enter>). Watch for errors!
116 lilo produces errors, do not proceed!! Check your syntax based on the errors,
117 and edit lilo.conf as needed. When in doubt, replace the copy of lilo.conf
118 to its original location (/etc) and start over.
120 - When lilo exits without error (e.g. wrote *LFS, wrote backup), reboot and
121 choose the new backup system in lilo!
123 - login, make sure everything is cool.
125 - reboot, choose your original LFS system, proceed to make a mess of it without
128 ********************************************************************************
130 To "restore" your system back to the point of the backup, just reverse the
131 process! By reverse, I don't mean the steps. Simply make a backup of the backup,
132 on the partition where the messed up LFS is. Don't forget to either:
135 to wipe out all the stuff on the bad partition, otherwise you will "restore" the
136 good stuff next to bad stuff.
139 * Erik Miller for the original hint
140 * Chris Lingard and others for their help in the original hint
144 * Hint ownership changed from Erik Miller to Nathan Hall.
145 * Changed the format of the hint to coincide with the new
146 format of the LFS hints.