source: BOOK/chroot/common/kernfs.xml@ 38a0176

clfs-3.0.0-sysvinit sysvinit
Last change on this file since 38a0176 was 677f8ac, checked in by Chris Staub <chris@…>, 10 years ago

Updated file system mount commands for chroot

Conflicts:

BOOK/introduction/common/changelog.xml

  • Property mode set to 100644
File size: 2.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-chroot-kernfs">
9 <?dbhtml filename="kernfs.html"?>
10
11 <title>Mounting Virtual Kernel File Systems</title>
12
13 <note os="a">
14 <para>The commands in the remainder of the book should be run as
15 the <systemitem class="username">root</systemitem> user. Check
16 that ${CLFS} is set in the
17 <systemitem class="username">root</systemitem> user&rsquo;s environment
18 before proceeding.</para>
19 </note>
20
21 <para>Various file systems exported by the kernel are used to communicate
22 to and from the kernel itself. These file systems are virtual in that no
23 disk space is used for them. The content of the file systems resides in
24 memory.</para>
25
26 <para>Begin by creating directories onto which the file systems will
27 be mounted:</para>
28
29<screen><userinput>mkdir -pv ${CLFS}/{dev,proc,run,sys}</userinput></screen>
30
31 <para>Two device nodes, <filename class="devicefile">/dev/console</filename>
32 and <filename class="devicefile">/dev/null</filename>, are required to be
33 present on the file system. These are needed by the kernel even before
34 starting Udev early in the boot process, so we create them here:</para>
35
36<screen><userinput>mknod -m 600 ${CLFS}/dev/console c 5 1
37mknod -m 666 ${CLFS}/dev/null c 1 3</userinput></screen>
38
39 <para>Once the system is complete and booting, the rest of our device
40 nodes will be created by the kernel's
41 <systemitem class="filesystem">devtmpfs</systemitem> file system. For now
42 though, we will just use the <quote>bind</quote> option in the mount command
43 to make our host system's <filename class="directory">/dev</filename> structure appear in the new CLFS file system:</para>
44
45<screen><userinput>mount -v -o bind /dev ${CLFS}/dev</userinput></screen>
46
47 <para>Now mount the remaining file systems:</para>
48
49<screen><userinput>mount -vt devpts -o gid=&gid-tty;,mode=620 devpts ${CLFS}/dev/pts
50mount -vt proc proc ${CLFS}/proc
51mount -vt tmpfs tmpfs ${CLFS}/run
52mount -vt sysfs sysfs ${CLFS}/sys</userinput></screen>
53
54 <para>On some host systems, <filename class="directory">/dev/shm</filename>
55 is a symbolic link to <filename class="directory">/run/shm</filename>.
56 If it is, create a directory in <filename class="directory">/run</filename>:</para>
57
58<screen><userinput>[ -h ${CLFS}/dev/shm ] &amp;&amp; mkdir -pv ${CLFS}/$(readlink ${CLFS}/dev/shm)</userinput></screen>
59
60 <para>Remember that if for any reason you stop working on the CLFS system
61 and start again later, it is important to check that these file systems
62 are mounted again before entering the chroot environment.</para>
63
64</sect1>
Note: See TracBrowser for help on using the repository browser.