1 |
Thanks, Gareth. |
2 |
|
3 |
But it is very interesting that with no special customizations, I am almost |
4 |
able to have a fully functional system. |
5 |
|
6 |
That new thing about having to use a initramfs when the root filesystem and |
7 |
the /usr directory are not present in the same physical partition, it turns |
8 |
out that it helps on having the "genkernel" generated initramfs do the job |
9 |
of mounting different arrangements for partitions, directories and unionfs |
10 |
mounts. That is because of the file "/etc/initramfs.mounts" where the |
11 |
specified mount entries, are extracted from the "/etc/fstab" and mounted |
12 |
before the initram gives way to the real root environment. |
13 |
|
14 |
For instance, in this system, for now, there is the directory structure |
15 |
bellow: |
16 |
|
17 |
/.var.rw - here a r/w ext4 partition is to be mounted; |
18 |
/.var.ro - here there are all files and directories expected to be on a |
19 |
usual /var; |
20 |
/var - here a unionfs mount is to join the ones above |
21 |
|
22 |
The part from fstab for this is ("/.var.ro" is present on the squashfs root |
23 |
file system): |
24 |
|
25 |
/dev/sda2 / squashfs |
26 |
noatime,ro 0 1 |
27 |
/dev/sda3 /.var.rw ext4 |
28 |
noatime,defaults 0 2 |
29 |
none /var unionfs |
30 |
nonempty,cow,umask=022,dirs=/.var.rw/=rw:/.var.ro/=ro 0 0 |
31 |
|
32 |
I said it is not yet fully functional because it seems there is something |
33 |
wrong with permissions, because it ends up with a unknown user prompt from |
34 |
which I could list the root directories (something similar is being made to |
35 |
"/etc"): |
36 |
|
37 |
total 9,0K |
38 |
drwxr-xr-x 23 root root 385 Out 18 14:18 ./ |
39 |
drwxr-xr-x 4 root root 4,0K Set 24 09:46 ../ |
40 |
drwxr-xr-x 47 root root 2,6K Out 17 16:03 .etc.ro/ |
41 |
drwxr-xr-x 2 root root 40 Out 18 15:09 .etc.rw/ |
42 |
drwxr-xr-x 11 root root 262 Out 17 16:03 .var.ro/ |
43 |
drwxr-xr-x 6 root root 4,0K Out 18 14:33 .var.rw/ |
44 |
drwxr-xr-x 2 root root 1,4K Out 7 14:46 bin/ |
45 |
drwxr-xr-x 4 root root 1,0K Out 18 14:15 boot/ |
46 |
d????????? 3 root root 2,3K Ago 1 00:17 dev/ |
47 |
drwxr-xr-x 1 root root 2,6K Out 17 16:03 etc/ |
48 |
drwxr-xr-x 3 root root 54 Ago 22 07:55 home/ |
49 |
lrwxrwxrwx 1 root root 5 Out 7 14:05 lib -> lib64/ |
50 |
drwxr-xr-x 12 root root 3,2K Out 17 08:51 lib64/ |
51 |
drwxr-xr-x 2 root root 28 Ago 1 00:16 media/ |
52 |
drwxr-xr-x 2 root root 28 Ago 1 00:16 opt/ |
53 |
drwxr-xr-x 2 root root 3 Jul 31 22:22 proc/ |
54 |
drwxr-xr-x 2 root root 136 Out 18 14:18 root/ |
55 |
drwxr-xr-x 5 root root 120 Ago 30 08:59 run/ |
56 |
drwxr-xr-x 2 root root 2,9K Out 17 08:51 sbin/ |
57 |
drwxr-xr-x 2 root root 28 Ago 1 00:16 sys/ |
58 |
drwxrwxrwt 2 root root 3 Out 18 14:18 tmp/ |
59 |
drwxr-xr-x 13 root root 267 Out 17 11:18 usr/ |
60 |
d????????? 1 root root 262 Out 17 16:03 var/ |
61 |
|
62 |
Any hints or suggestions? I will post this to the "gentoo-user" list, also, |
63 |
I guess it is an interesting thing that might be called a cool side effect |
64 |
of the recent issues. |
65 |
|
66 |
Thanks |
67 |
Francisco |
68 |
|
69 |
|
70 |
|
71 |
2013/10/17 Gareth McClean <disneysw@×××××××.com> |
72 |
|
73 |
> ** ** |
74 |
> |
75 |
> I do this using a slightly modified init script, aufs3 and a squashfs.**** |
76 |
> |
77 |
> ** ** |
78 |
> |
79 |
> Basically the system setups a tmpfs as a RW overlay on top of the |
80 |
> squashfs. Then for permanent storage there is a physical Ext4 partition |
81 |
> overlaid again on top of the /home directory. **** |
82 |
> |
83 |
> ** ** |
84 |
> |
85 |
> Symbolic links are then used for any configuration files (such as network |
86 |
> configuration) that require persistent storage. These links obviously |
87 |
> reference locations within the /home directory that is stored on an Ext4 |
88 |
> physical partition. **** |
89 |
> |
90 |
> ** ** |
91 |
> |
92 |
> My init script is slightly more complicated than this since it caters for |
93 |
> both live (squash plus aufs) and development (normal disc access) modes but |
94 |
> basically it boils down to:**** |
95 |
> |
96 |
> ** ** |
97 |
> |
98 |
> ** ** |
99 |
> |
100 |
> mount -t aufs aufs "${NEW_ROOT}" -o dirs=/rw=rw:/ro=rr**** |
101 |
> |
102 |
> ** ** |
103 |
> |
104 |
> # Mount RW_PERM**** |
105 |
> |
106 |
> echo "Mounting RW"**** |
107 |
> |
108 |
> mkdir -p /rw-perm**** |
109 |
> |
110 |
> mount "UUID=${RW_PERM_UUID}" /rw-perm**** |
111 |
> |
112 |
> mount -o bind /ro/home "${NEW_ROOT}/home"**** |
113 |
> |
114 |
> mount -t aufs aufs "${NEW_ROOT}/home" -o |
115 |
> dirs=/rw-perm=rw:/ro/home=rr**** |
116 |
> |
117 |
> ** ** |
118 |
> |
119 |
> where **** |
120 |
> |
121 |
> ro = squashfs**** |
122 |
> |
123 |
> rw = tmpfs**** |
124 |
> |
125 |
> rw-perm = physical Ext4 partition**** |
126 |
> |
127 |
> ** ** |
128 |
> |
129 |
> Note you need the “mount -o bind" command to allow an overlay on top of an |
130 |
> overlay with aufs3 otherwise you will get an error message.**** |
131 |
> |
132 |
> ** ** |
133 |
> |
134 |
> BTW, Unless you have a good reason for doing this I would not recommend |
135 |
> doing this since you have a physical hard drive. The reason I still do this |
136 |
> is mainly for backward compatibility. Of course it is nice to have the |
137 |
> ability to run our system from a liveUSB stick and it minimises software |
138 |
> download size when doing updates but debugging the init script is a very |
139 |
> time consuming process……**** |
140 |
> |
141 |
> **** |
142 |
> |
143 |
> ** ** |
144 |
> |
145 |
> ** ** |
146 |
> |
147 |
> ** ** |
148 |
> |
149 |
> ** ** |
150 |
> |
151 |
> *From:* Francisco Ares [mailto:frares@×××××.com] |
152 |
> *Sent:* 16 October 2013 13:49 |
153 |
> *To:* gentoo-embedded@l.g.o |
154 |
> *Subject:* [gentoo-embedded] planning a flash DOM x86 embedded system**** |
155 |
> |
156 |
> ** ** |
157 |
> |
158 |
> Hi.**** |
159 |
> |
160 |
> I am planning to build a system to be deployed in a SATA flash disk, and |
161 |
> most of the file system will be read-only. There will be a tempfs on /temp |
162 |
> and a read-write partition for /var (perhaps a unionfs with the static part |
163 |
> of /var and that read-write partition)**** |
164 |
> |
165 |
> Is there any resources on how to do this using Gentoo?**** |
166 |
> |
167 |
> There is already a development system with everything working as expected |
168 |
> on the final system. But when I put it to a squashfs, the system boots with |
169 |
> several errors, like when trying to write to /etc and /var.**** |
170 |
> |
171 |
> Looking on the new issue regarding /usr and / being on a different |
172 |
> partitions, I have found the file in /etc/initramfs.mounts. I have added |
173 |
> the needed fstab entries to be mounted before the system switches to the |
174 |
> real-root, (as the comments on top of this file claims) but there are |
175 |
> still errors during boot.**** |
176 |
> |
177 |
> ** ** |
178 |
> |
179 |
> Thanks |
180 |
> Francisco**** |
181 |
> |