source: chapter07/cleanup.xml@ d9c86378

multilib
Last change on this file since d9c86378 was d9c86378, checked in by Thomas Trepl <thomas@…>, 2 weeks ago

Automatic merge of trunk into multilib

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