[02b2631] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[8a269ec] | 8 | <sect1 id="ch-tools-cleanup">
|
---|
| 9 | <?dbhtml filename="cleanup.html"?>
|
---|
[02b2631] | 10 |
|
---|
| 11 | <title>Cleaning up and Saving the Temporary System</title>
|
---|
[2c8fdfc] | 12 |
|
---|
[02b2631] | 13 | <sect2>
|
---|
| 14 | <title>Cleaning</title>
|
---|
| 15 |
|
---|
[ebecd08] | 16 | <para>First, remove the currently installed documentation files to prevent them
|
---|
[02b2631] | 17 | from ending up in the final system, and to save about 35 MB:</para>
|
---|
| 18 |
|
---|
| 19 | <screen><userinput>rm -rf /usr/share/{info,man,doc}/*</userinput></screen>
|
---|
| 20 |
|
---|
[3d65730e] | 21 | <para>Second, on a modern Linux system, the libtool .la files are only
|
---|
[ebecd08] | 22 | useful for libltdl. No libraries in LFS are loaded by
|
---|
| 23 | libltdl, and it's known that some .la files can cause BLFS package
|
---|
| 24 | failures. Remove those files now:</para>
|
---|
[02b2631] | 25 |
|
---|
| 26 | <screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
|
---|
| 27 |
|
---|
| 28 | <para>
|
---|
[2c8fdfc] | 29 | The current system size is now about 3 GB, however
|
---|
[02b2631] | 30 | the /tools directory is no longer needed. It uses about
|
---|
| 31 | 1 GB of disk space. Delete it now:
|
---|
| 32 | </para>
|
---|
| 33 |
|
---|
| 34 | <screen><userinput>rm -rf /tools</userinput></screen>
|
---|
| 35 | </sect2>
|
---|
| 36 |
|
---|
| 37 | <sect2>
|
---|
| 38 | <title>Backup</title>
|
---|
| 39 |
|
---|
[beb80e2] | 40 | <para>
|
---|
| 41 | At this point the essential programs and libraries have been created
|
---|
| 42 | and your current LFS system is in a good state. Your system can now be
|
---|
| 43 | backed up for later reuse. In case of fatal failures in the subsequent
|
---|
| 44 | chapters, it often turns out that removing everything and starting over
|
---|
[ebecd08] | 45 | (more carefully) is the best way to recover. Unfortunately, all the
|
---|
[beb80e2] | 46 | temporary files will be removed, too. To avoid spending extra time to
|
---|
[ebecd08] | 47 | redo something which has been done successfully, creating a backup of
|
---|
[beb80e2] | 48 | the current LFS system may prove useful.
|
---|
| 49 | </para>
|
---|
| 50 |
|
---|
[02b2631] | 51 | <note><para>
|
---|
| 52 | All the remaining steps in this section are optional. Nevertheless,
|
---|
| 53 | as soon as you begin installing packages in <xref
|
---|
| 54 | linkend="chapter-building-system"/>, the temporary files will be
|
---|
| 55 | overwritten. So it may be a good idea to do a backup of the current
|
---|
[2c8fdfc] | 56 | system as described below.
|
---|
[02b2631] | 57 | </para></note>
|
---|
[2c8fdfc] | 58 |
|
---|
[02b2631] | 59 | <para>
|
---|
| 60 | The following steps are performed from outside the chroot
|
---|
[ebecd08] | 61 | environment. That means you have to leave the chroot environment
|
---|
[02b2631] | 62 | first before continuing. The reason for that is to
|
---|
| 63 | get access to file system locations outside of the chroot
|
---|
[ebecd08] | 64 | environment to store/read the backup archive, which ought
|
---|
[02b2631] | 65 | not be placed within the
|
---|
[ebecd08] | 66 | <filename class="directory">$LFS</filename> hierarchy.
|
---|
[02b2631] | 67 | </para>
|
---|
| 68 |
|
---|
[beb80e2] | 69 | <para>
|
---|
| 70 | If you have decided to make a backup, leave the chroot environment:
|
---|
| 71 | </para>
|
---|
| 72 |
|
---|
| 73 | <screen role="nodump"><userinput>exit</userinput></screen>
|
---|
| 74 |
|
---|
[02b2631] | 75 | <important>
|
---|
[beb80e2] | 76 | <para>
|
---|
| 77 | All of the following instructions are executed by
|
---|
| 78 | <systemitem class="username">root</systemitem> on your host system.
|
---|
| 79 | Take extra care about the commands you're going to run as mistakes
|
---|
[ebecd08] | 80 | made here can modify your host system. Be aware that the
|
---|
[2c8fdfc] | 81 | environment variable <envar>LFS</envar>
|
---|
| 82 | is set for user <systemitem class="username">lfs</systemitem> by default
|
---|
| 83 | but may <emphasis>not</emphasis> be set for
|
---|
[beb80e2] | 84 | <systemitem class="username">root</systemitem>.
|
---|
| 85 | </para>
|
---|
| 86 | <para>
|
---|
[c6f58f47] | 87 | Whenever commands are to be executed by <systemitem class="username">root</systemitem>,
|
---|
[02b2631] | 88 | make sure you have set <envar>LFS</envar>.
|
---|
[beb80e2] | 89 | </para>
|
---|
| 90 | <para>
|
---|
[02b2631] | 91 | This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>.
|
---|
| 92 | </para>
|
---|
| 93 | </important>
|
---|
| 94 |
|
---|
[beb80e2] | 95 | <para>Before making a backup, unmount the virtual file systems:</para>
|
---|
[02b2631] | 96 |
|
---|
[01ecba7] | 97 | <screen role="nodump"><userinput>mountpoint -q $LFS/dev/shm && umount $LFS/dev/shm
|
---|
[16cd0963] | 98 | umount $LFS/dev/pts
|
---|
[beb80e2] | 99 | umount $LFS/{sys,proc,run,dev}</userinput></screen>
|
---|
[02b2631] | 100 |
|
---|
| 101 | <para>
|
---|
[beb80e2] | 102 | Make sure you have at least 1 GB free disk space (the source tarballs
|
---|
[ebecd08] | 103 | will be included in the backup archive) on the file system containing
|
---|
| 104 | the directory where you create the backup archive.
|
---|
[02b2631] | 105 | </para>
|
---|
| 106 |
|
---|
| 107 | <para>
|
---|
[beb80e2] | 108 | Note that the instructions below specify the home directory of the host
|
---|
| 109 | system's <systemitem class="username">root</systemitem> user, which is
|
---|
[ebecd08] | 110 | typically found on the root file system.
|
---|
[beb80e2] | 111 | Replace <envar>$HOME</envar> by a directory of your choice if you
|
---|
[c6f58f47] | 112 | do not want to have the backup stored in <systemitem
|
---|
[beb80e2] | 113 | class="username">root</systemitem>'s home directory.
|
---|
| 114 | </para>
|
---|
[02b2631] | 115 |
|
---|
| 116 | <para>
|
---|
| 117 | Create the backup archive by running the following command:
|
---|
| 118 | </para>
|
---|
| 119 |
|
---|
| 120 | <note>
|
---|
| 121 | <para>
|
---|
| 122 | Because the backup archive is compressed, it takes a relatively
|
---|
[bcb20b4] | 123 | long time (over 10 minutes) even on a reasonably fast system.
|
---|
[02b2631] | 124 | </para>
|
---|
| 125 | </note>
|
---|
| 126 |
|
---|
[2198b5e] | 127 | <screen role="nodump"><userinput>cd $LFS
|
---|
[02b2631] | 128 | tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen>
|
---|
| 129 |
|
---|
[7fba075] | 130 | <note>
|
---|
| 131 | <para>
|
---|
| 132 | If continuing to chapter 8, don't forget to reenter the chroot
|
---|
| 133 | environment as explained in the <quote>Important</quote> box below.
|
---|
| 134 | </para>
|
---|
| 135 | </note>
|
---|
| 136 |
|
---|
[02b2631] | 137 | </sect2>
|
---|
| 138 |
|
---|
| 139 | <sect2>
|
---|
| 140 | <title>Restore</title>
|
---|
| 141 |
|
---|
| 142 | <para>
|
---|
| 143 | In case some mistakes have been made and you need to start over, you can
|
---|
| 144 | use this backup to restore the system and save some recovery time.
|
---|
[2c8fdfc] | 145 | Since the sources are located under
|
---|
[02b2631] | 146 | <filename class="directory">$LFS</filename>, they are included in the
|
---|
| 147 | backup archive as well, so they do not need to be downloaded again. After
|
---|
[ebecd08] | 148 | checking that <envar>$LFS</envar> is set properly, you can
|
---|
[02b2631] | 149 | restore the backup by executing the following commands:
|
---|
| 150 | </para>
|
---|
| 151 |
|
---|
| 152 | <!-- Make the following look different so users don't blindly run the
|
---|
| 153 | restore when they don't need to. -->
|
---|
| 154 |
|
---|
[9904ecb] | 155 | <warning><para>The following commands are extremely dangerous. If
|
---|
[e286d8db] | 156 | you run <command>rm -rf ./*</command> as the &root; user and you
|
---|
[2c8fdfc] | 157 | do not change to the $LFS directory or the <envar>LFS</envar>
|
---|
[e286d8db] | 158 | environment variable is not set for the &root; user, it will destroy
|
---|
[02b2631] | 159 | your entire host system. YOU ARE WARNED.</para></warning>
|
---|
| 160 |
|
---|
[2198b5e] | 161 | <screen role="nodump"><computeroutput>cd $LFS
|
---|
| 162 | rm -rf ./*
|
---|
[02b2631] | 163 | tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
|
---|
| 164 |
|
---|
| 165 | <para>
|
---|
[ebecd08] | 166 | Again, double check that the environment has been set up properly
|
---|
[02b2631] | 167 | and continue building the rest of the system.
|
---|
| 168 | </para>
|
---|
| 169 |
|
---|
| 170 | <important>
|
---|
| 171 | <para>
|
---|
| 172 | If you left the chroot environment to create a backup or restart
|
---|
| 173 | building using a restore, remember to check that the virtual
|
---|
[ebecd08] | 174 | file systems are still mounted (<command>findmnt | grep
|
---|
[02b2631] | 175 | $LFS</command>). If they are not mounted, remount them now as
|
---|
| 176 | described in <xref linkend='ch-tools-kernfs'/> and re-enter the chroot
|
---|
| 177 | environment (see <xref linkend='ch-tools-chroot'/>) before continuing.
|
---|
| 178 | </para>
|
---|
| 179 | </important>
|
---|
[2c8fdfc] | 180 |
|
---|
[02b2631] | 181 | </sect2>
|
---|
| 182 |
|
---|
| 183 | </sect1>
|
---|