source: chapter07/cleanup.xml@ 08a6368

multilib
Last change on this file since 08a6368 was 08a6368, checked in by Thomas Trepl (Moody) <thomas@…>, 3 years ago

Merge upstream

  • Property mode set to 100644
File size: 6.8 KB
Line 
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
8<sect1 id="ch-tools-cleanup">
9 <?dbhtml filename="cleanup.html"?>
10
11 <title>Cleaning up and Saving the Temporary System</title>
12
13 <sect2>
14 <title>Cleaning</title>
15
16 <para>First, remove the currently installed documentation to prevent them
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
21 <para>Second, the libtool .la files are only useful when linking with static
22 libraries. They are unneeded and potentially harmful when using dynamic
23 shared libraries, especially when using non-autotools build systems.
24 While still in chroot, remove those files now:</para>
25
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>
30
31 <para>
32 The current system size is now about 3 GB, however
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
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
48 (more carefully) is the best option to recover. Unfortunately, all the
49 temporary files will be removed, too. To avoid spending extra time to
50 redo something which has been built successfully, creating a backup of
51 the current LFS system may prove useful.
52 </para>
53
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
59 system as described below.
60 </para></note>
61
62 <para>
63 The following steps are performed from outside the chroot
64 environment. That means, you have to leave the chroot environment
65 first before continuing. The reason for that is to
66 get access to file system locations outside of the chroot
67 environment to store/read the backup archive which should
68 not be placed within the
69 <filename class="directory">$LFS</filename> hierarchy for
70 safety reasons.
71 </para>
72
73 <para>
74 If you have decided to make a backup, leave the chroot environment:
75 </para>
76
77<screen role="nodump"><userinput>exit</userinput></screen>
78
79 <important>
80 <para>
81 All of the following instructions are executed by
82 <systemitem class="username">root</systemitem> on your host system.
83 Take extra care about the commands you're going to run as mistakes
84 here can modify your host system. Be aware that the
85 environment variable <envar>LFS</envar>
86 is set for user <systemitem class="username">lfs</systemitem> by default
87 but may <emphasis>not</emphasis> be set for
88 <systemitem class="username">root</systemitem>.
89 </para>
90 <para>
91 Whenever commands are to be executed by <systemitem class="username">root</systemitem>,
92 make sure you have set <envar>LFS</envar>.
93 </para>
94 <para>
95 This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>.
96 </para>
97 </important>
98
99 <para>Before making a backup, unmount the virtual file systems:</para>
100
101<screen role="nodump"><userinput>umount $LFS/dev/pts
102umount $LFS/{sys,proc,run,dev}</userinput></screen>
103
104 <para>
105 Make sure you have at least 1 GB free disk space (the source tarballs
106 will be included in the backup archive) on the filesystem containing
107 directory where you create the backup archive.
108 </para>
109
110 <para>
111 Note that the instructions below specify the home directory of the host
112 system's <systemitem class="username">root</systemitem> user, which is
113 typically found on the root filesystem.
114 </para>
115
116 <para>
117 Replace <envar>$HOME</envar> by a directory of your choice if you
118 do not want to have the backup stored in <systemitem
119 class="username">root</systemitem>'s home directory.
120 </para>
121
122 <para>
123 Create the backup archive by running the following command:
124 </para>
125
126 <note>
127 <para>
128 Because the backup archive is compressed, it takes a relatively
129 long time (over 10 minutes) even on a resonably fast system.
130 </para>
131 </note>
132
133<screen role="nodump"><userinput>cd $LFS
134tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen>
135
136 </sect2>
137
138 <sect2>
139 <title>Restore</title>
140
141 <para>
142 In case some mistakes have been made and you need to start over, you can
143 use this backup to restore the system and save some recovery time.
144 Since the sources are located under
145 <filename class="directory">$LFS</filename>, they are included in the
146 backup archive as well, so they do not need to be downloaded again. After
147 checking that <envar>$LFS</envar> is set properly,
148 restore the backup by executing the following commands:
149 </para>
150
151<!-- Make the following look different so users don't blindly run the
152 restore when they don't need to. -->
153
154 <warning><para>The following commands are extremly dangerous. If
155 you run <command>rm -rf ./*</command> as the root user and you
156 do not change to the $LFS directory or the <envar>LFS</envar>
157 environment variable is not set for the root user, it will destroy
158 your entire host system. YOU ARE WARNED.</para></warning>
159
160<screen role="nodump"><computeroutput>cd $LFS
161rm -rf ./*
162tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
163
164 <para>
165 Again, double check that the environment has been setup properly
166 and continue building the rest of the system.
167 </para>
168
169 <important>
170 <para>
171 If you left the chroot environment to create a backup or restart
172 building using a restore, remember to check that the virtual
173 filesystems are still mounted (<command>findmnt | grep
174 $LFS</command>). If they are not mounted, remount them now as
175 described in <xref linkend='ch-tools-kernfs'/> and re-enter the chroot
176 environment (see <xref linkend='ch-tools-chroot'/>) before continuing.
177 </para>
178 </important>
179
180 </sect2>
181
182</sect1>
Note: See TracBrowser for help on using the repository browser.